Skip to main content

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 generated Client / AsyncClient. They wrap httpx and handle request build-up, Pydantic-based response validation, and middleware.
  • ApiResponse[T, E] — typed wrapper around the response value, transport metadata, and the optional typed error.
  • 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's model_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.

Validation is strict: an event whose payload doesn't match the item model (for example, an unknown discriminated-union variant added by a newer server) raises ValidationError mid-stream and the iterator terminates. Items received before the bad event are still delivered.

Compatibility

Python 3.12+. The package targets the same reflectapi minor version as the schema you generate from; mismatches will surface at import time.

Metadata

Release files for reflectapi-runtime 0.18.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reflectapi-runtime 0.18.0
File Size Uploaded
reflectapi_runtime-0.18.0.tar.gz 68.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for reflectapi-runtime 0.18.0
File Interpreter ABI Platform
reflectapi_runtime-0.18.0-py3-none-any.whl Python 3 none any Details

Total release size: 107.6 kB

Release files / reflectapi_runtime-0.18.0.tar.gz

Download URL reflectapi_runtime-0.18.0.tar.gz
Size 68.7 kB
Tags Source
SHA-256 checksum
How to use checksums
05f47dfe22469f7756d0dc12311f39be250d0d6ed9c45b15542c798c5a3c1abb
BLAKE2b-256 checksum
How to use checksums
0c6fc83ed9e7a3b320f77789b5bbc9f58f5dfeaba584c40b26929c88196df47c
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 Sep 27, 2026.

Transparency log

Release files / reflectapi_runtime-0.18.0-py3-none-any.whl

Download URL reflectapi_runtime-0.18.0-py3-none-any.whl
Size 38.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4242358c20ccb451b60716cf3af6cfed80c6dfd7aa3e27e691a1099882edf31b
BLAKE2b-256 checksum
How to use checksums
37e0f35413db00c7d7d82c633684823e45af7b9556505808aba5283a9a35da08
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 Sep 27, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page