reflectapi-runtime
Runtime support library for Python clients generated by
reflectapi. Generated code
imports from reflectapi_runtime; you don't normally call this library
directly.
What it provides
ClientBase/AsyncClientBase— base classes used by the generatedClient/AsyncClient. They wraphttpxand handle request build-up, Pydantic-based response validation, and middleware.ApiResponse[T, E, H]— typed wrapper around the response value, transport metadata, the optional typed error, and the API's declared response headers (.headers).ApiStream[T, H]/AsyncApiStream[T, H]— iterators returned by streaming methods, exposing the response'smetadataand declaredheadersonce iteration starts.ApplicationError,NetworkError,TimeoutError,ValidationError— exceptions raised by the generated methods on non-2xx, transport, and validation failures respectively.ReflectapiPartialModel— base class for generated models with three-state fields (value / explicit-null / absent) so absent and explicit-null can round-trip, tracked via Pydantic'smodel_fields_set.- Authentication helpers (
BearerTokenAuth,APIKeyAuth,BasicAuth,OAuth2ClientCredentialsAuth,OAuth2AuthorizationCodeAuth). - Middleware, batching, and testing utilities (
MockClient,CassetteMiddleware).
Streaming endpoints
Endpoints declared with Builder::stream_route on the server are exposed on
the generated client as ordinary methods that return an iterator:
async with AsyncClient("http://localhost:3000") as client:
async for event in client.pets.cdc_events(headers=headers):
... # process each event
The sync client returns a regular Iterator; both validate each event
against the declared item model. The wire format is Server-Sent Events
(data: <json>\n\n); init failures (4xx/5xx) raise ApplicationError and
do not enter the iterator. Breaking out of the loop or calling
stream.aclose() releases the underlying HTTP connection.
Events are validated against the generated model. Closed response enums reject
unfamiliar variants; enums declared with #[reflectapi(open)] retain them as
an unknown case with the tag and parsed JSON, and #[serde(other)] uses the
declared fallback. A malformed known variant raises ValidationError
mid-stream and terminates the iterator. Earlier items remain delivered.
Compatibility
Python 3.12+. SDKs generated with ReflectAPI 0.20 require the 0.20 runtime. Pydantic 2.10 or newer supports the generated generic models; Python 3.14 requires Pydantic 2.12 or newer. Installing the runtime resolves these requirements and the supported HTTP dependencies automatically.
Metadata
Release files for reflectapi-runtime 0.20.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| reflectapi_runtime-0.20.1.tar.gz | 73.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| reflectapi_runtime-0.20.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 114.5 kB
Release files / reflectapi_runtime-0.20.1.tar.gz
| Download URL | reflectapi_runtime-0.20.1.tar.gz |
|---|---|
| Size | 73.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
64291e67e7b096e2972c13b29df527c19532e692a88911c25b806919715e51df
|
|
BLAKE2b-256 checksum How to use checksums |
ea83665645d726f61abeca38df7ddb9dda0d39a854f00272ce1836e2b04a0d7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / reflectapi_runtime-0.20.1-py3-none-any.whl
| Download URL | reflectapi_runtime-0.20.1-py3-none-any.whl |
|---|---|
| Size | 41.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f33a5411941ffaf9eaf239d2c018e5ccdfa4df822b521189467ff43f903e4c8c
|
|
BLAKE2b-256 checksum How to use checksums |
dd9dce4b4fd6b1311622530ef206c7da790b3cf38ed341a26d5c3fccd5c92c78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency log