@sdk-it/python
v0.46.1
Published
Generate asynchronous Python SDKs from OpenAPI specifications.
Readme
@sdk-it/python
Generate asynchronous Python SDKs from OpenAPI specifications.
Generated SDK Features
- Pydantic request and response models
- Async HTTP transport using
httpx - API groups derived from OpenAPI tags
- Error classes for HTTP failures
- Docstrings derived from operation summaries and descriptions
Generate an SDK
npx @sdk-it/cli@latest generate python \
--spec ./openapi.json \
--output ./your_sdk \
--name ClientThe CLI writes a complete Python package to ./your_sdk and formats it with Black or Ruff when either formatter is available.
Generated SDK Structure
├── requirements.txt # Python dependencies
├── client.py # Main client class
├── api/ # API group clients
│ ├── __init__.py
│ ├── users_api.py
│ └── pets_api.py
├── models/ # Data models
│ ├── __init__.py
│ ├── user.py
│ └── pet.py
├── inputs/ # Request input models
│ ├── __init__.py
│ └── ...
├── outputs/ # Response output models
│ ├── __init__.py
│ └── ...
└── http/ # HTTP transport layer
├── __init__.py
├── dispatcher.py
├── interceptors.py
└── responses.pyInstall Generated Dependencies
python -m pip install -r ./your_sdk/requirements.txtOperation methods live in the generated api/ modules and use snake_case operationId names. Follow those emitted signatures instead of flattening request inputs into keyword arguments.
Dependencies
The generated requirements.txt includes:
httpx- Modern async HTTP clientpydantic- Data validation and serializationtyping-extensions- Enhanced type hints supportpython-dateutil- Date and time handling
