Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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, 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's metadata and declared headers once 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 omittable fields. Unset fields stay absent during direct serialization; explicit null and values remain set, tracked via Pydantic's model_fields_set.
  • Authentication helpers (BearerTokenAuth, APIKeyAuth, BasicAuth, OAuth2ClientCredentialsAuth, OAuth2AuthorizationCodeAuth).
  • Middleware, batching, and testing utilities (MockClient, CassetteMiddleware).

Request field presence

Requests serialize Pydantic models with wire aliases and exclude_unset=True, recursively. A field omitted during construction is absent from JSON; a field explicitly set to None is sent as null. This also applies to nested models and models inside list or dictionary bodies. Unset non-null defaults are omitted too: pass the default value explicitly if the server should receive it.

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.21 require the 0.21 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.24.0a3

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.24.0a3
File Size Uploaded Provenance Actions
reflectapi_runtime-0.24.0a3.tar.gz 80.4 kB With provenance Details for reflectapi_runtime-0.24.0a3.tar.gz

Built distribution (wheel)

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

Total release size: 125.3 kB

Release files / reflectapi_runtime-0.24.0a3.tar.gz

Download URL reflectapi_runtime-0.24.0a3.tar.gz
Size 80.4 kB
Tags Source
SHA-256 checksum
How to use checksums
92f8d23cb5ff5ad25d3a38ec0da37b494ee2edef2ac740af5123978ffb775b95
BLAKE2b-256 checksum
How to use checksums
850d472650f2bce806e1e482c24dd00f58e84eeb7ce2adc9123acf9f8fd9963d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 6, 2026.

Transparency log

Release files / reflectapi_runtime-0.24.0a3-py3-none-any.whl

Download URL reflectapi_runtime-0.24.0a3-py3-none-any.whl
Size 44.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6cf5278aec6a86026a9cc4dd5eee561229fdf506d73f1f34b0e0375df4ac4ad3
BLAKE2b-256 checksum
How to use checksums
49414ce1fe62164e38990af47281ac6654be7ebe2a5dc080a5b4928ed8bcc3b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 6, 2026.

Transparency log

Security for reflectapi-runtime 0.24.0a3

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for reflectapi_runtime-0.24.0a3.tar.gz

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 Nov 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

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