Octri

Languages

Python

The Python SDK publishes to PyPI and is async-first, with optional synchronous variants.

Install

bash
pip install your-org-api-client

Options

OptionValuesDefault
Data modelpydantic, dataclass, typeddictpydantic
Sync methodsomit, includeomit
Client styleclass-namespaced, class, namespaced, functionsclass-namespaced
Argument styleobject, positionalpositional
Namespacetags, pathtags
Method namingshort, fullshort
Doc commentsfull, minimalfull
File headeromit, includeinclude
Usage examplefull, concisefull

Data model

How response models are represented. This is the choice your users feel most.

python
@dataclass
class User:
    id: str

Standard library, no dependencies, no runtime validation.

pydantic is the default, and it is a dependency

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.

python
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.

text
acme-api      distribution name (pip install acme-api)
acme_api      import name (import acme_api)
PyPI never lets you reuse a version

Deleting a release does not free its version number. 1.0.0 published once is 1.0.0 forever. See Publishing.

What callers write

python
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)