csrd-versioning
API versioning, dispatch, docs, and actuator for FastAPI.
Package: csrd.versioning · Import: from csrd.versioning import compose_versioned_apps, configure_versioned_api
What's included
- Version dispatch — raw ASGI middleware for version-aware routing (streaming/SSE safe)
- Swagger UI — custom docs with version picker, dark mode, SRI hashes, plugin system
- Actuator — Spring Boot-style management endpoints (health, info, env)
- Exception handlers — structured
APIErrorResponseJSON for HTTP and validation errors - Dependency wiring — auto path-param injection, bearer guard opt-out
Installation
uv pip install "csrd-versioning @ git+ssh://git@github.com/csrd-api/fastapi-common.git#subdirectory=packages/versioning"
Quick start
from enum import Enum
from fastapi import FastAPI
from csrd.versioning import compose_versioned_apps, VersionedApiConfig, VersionedAppComposeConfig
class Versions(Enum):
Unversioned = "Unversioned"
V1 = "2025-06-20"
unv = FastAPI()
v1 = FastAPI()
app = compose_versioned_apps(
{Versions.Unversioned: unv, Versions.V1: v1},
config=VersionedAppComposeConfig(
api=VersionedApiConfig(prefix="api"),
),
)
Security notes
/actuator/env: TheShowValues.ALWAYSsetting exposes environment variable values. UseShowValues.NEVER(default) in production to redact sensitive data.- CORS: Add
CORSMiddlewarebefore callingconfigure_versioned_api. The version dispatch middleware must be the outermost middleware. Example:
app = FastAPI()
app.add_middleware(CORSMiddleware, allow_origins=["https://app.example.com"], ...)
configure_versioned_api(app, version_mapping, ...)
Dependencies
csrd-models,csrd-context(Tier 1 packages —csrd-versioningis Tier 3)- For JWT auth, use
csrd-authalongside this package
Metadata
Release files for csrd-versioning 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| csrd_versioning-0.7.0.tar.gz | 72.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| csrd_versioning-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 154.1 kB
Release files / csrd_versioning-0.7.0.tar.gz
| Download URL | csrd_versioning-0.7.0.tar.gz |
|---|---|
| Size | 72.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1cdfd31032e3708ee6967fdaa931a7b7350758acf8ddd86d9594130f49ffe61
|
|
BLAKE2b-256 checksum How to use checksums |
e370f85b5490bed133bea550e9ec169d298fa7027df091e68553e583cbd8c543
|
| 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 16, 2026.
Transparency logRelease files / csrd_versioning-0.7.0-py3-none-any.whl
| Download URL | csrd_versioning-0.7.0-py3-none-any.whl |
|---|---|
| Size | 81.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e2ac976e9c4ad0b63fad2c0bb66143145a0ae72c9e48bfa5f96dede67c0c2b0f
|
|
BLAKE2b-256 checksum How to use checksums |
0b43dbdfb8dc66de4b910204bc7ae146e089d75eda1858382515fd91dcfcd11d
|
| 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 16, 2026.
Transparency log