Languages
Python
The Python SDK publishes to PyPI and is async-first, with optional synchronous variants.
Install
pip install your-org-api-clientOptions
| Option | Values | Default |
|---|---|---|
| Data model | pydantic, dataclass, typeddict | pydantic |
| Sync methods | omit, include | omit |
| Client style | class-namespaced, class, namespaced, functions | class-namespaced |
| Argument style | object, positional | positional |
| Namespace | tags, path | tags |
| Method naming | short, full | short |
| Doc comments | full, minimal | full |
| File header | omit, include | include |
| Usage example | full, concise | full |
Data model
How response models are represented. This is the choice your users feel most.
@dataclass
class User:
id: strStandard library, no dependencies, no runtime validation.
Runtime validation catches spec drift at the boundary instead of three frames deep, which is why it's the default. But it's a dependency and a performance cost your users didn't choose. If your consumers are FastAPI shops, that cost is already paid. If you're shipping to people who won't thank you for a transitive dependency, switch to dataclass before the first release rather than after.
Sync methods
The generated client is async. include emits synchronous variants alongside, for scripts and notebooks where an event loop is friction.
users = client.users.list_sync(limit=10)Package name
PyPI names are global and normalised: underscores and hyphens are treated the same, case is ignored. Acme_API and acme-api are the same project.
acme-api distribution name (pip install acme-api)
acme_api import name (import acme_api)Deleting a release does not free its version number. 1.0.0 published once is 1.0.0 forever. See Publishing.
What callers write
from acme_api import Acme, ClientAuthConfig, ClientConfig
acme = Acme(ClientConfig(
base_url="https://api.acme.com/v1",
auth=ClientAuthConfig(bearer_auth=os.environ["ACME_TOKEN"]),
))
async for user in acme.users.list_paginated(limit=100):
print(user.id)