rn-forge-fastapi
Documentation · Changelog · Source · All pykit packages
FastAPI adapters over rn-forge-web.
rn-forge-web settles the wire — the problem body, the cursor codec, the ETag
semantics, the idempotency reuse rule, the readiness aggregate, the 401/403
boundary. This package is the FastAPI-shaped plumbing that puts those decisions
into an application: exception-handler registration, Depends factories, a
router factory and an OpenAPI repair. It makes no wire decision of its own.
| Module | What it adapts |
|---|---|
problem |
register_problem_handlers(app) — every error the app produces, including FastAPI's own 404/405/422, as application/problem+json |
openapi |
FastApiApp.openapi() repairs the cached document — adds ProblemDetail and the problem responses it can actually produce, accuracy only; operation_id — the shared operationId convention |
dependencies |
page_params, require_idempotency_key, require_if_match |
health |
health_router(checks=...) — /healthz and /readyz |
auth |
auth_router and SessionMiddleware — the /auth routes, login sessions and CSRF protection over rn-forge-auth; bearer_auth, basic_auth, current_principal, requires, requires_permission, PolicyGuard — Security dependencies; rate limiting; auth.redis — the Redis CSRF store and rate limiter (redis extra) |
sse |
sse_response(events) — an EventSourceResponse that rejects forged frame fields, sends a retry frame first and ends a failed stream with one problem frame (sse extra) |
app |
FastApiApp(config) — a FastAPI subclass with the standard adapters installed |
Where it sits
rn-forge-fastapi depends on rn-forge-web, rn-forge-auth and FastAPI; it
never imports rn_forge.django, rn_forge.cli or rn_forge.tooling;
task lint proves it.
The import path
This package is rn_forge.fastapi; the framework is fastapi. The two do not
collide: from fastapi import APIRouter always resolves to the framework,
unless a process puts src/rn_forge/ itself on sys.path.
Installation
Require the packages by version range:
dependencies = [
"rn-forge-fastapi>=0.4,<0.5",
"rn-forge-web>=0.3,<0.4",
]
Application code imports rn_forge.web directly (wire models, pagination,
problem types, the auth contract), and this package does not re-export it.
Declare rn-forge-web as well, so the import is not an undeclared transitive
dependency.
Extras: oidc (JWKS bearer auth and OIDC login, rn-forge-auth[oidc]), redis
(the Redis stores and rn_forge.fastapi.auth.redis), transfer
(rn-forge-data and python-multipart, for rn_forge.fastapi.transfer), sse
(sse-starlette, for rn_forge.fastapi.sse) and testing (assertpy, httpx
and pytest).
Minimum example
from rn_forge.fastapi import FastApiApp
app = FastApiApp(title="Orders")
The app serves /healthz and /readyz and renders every error as a problem
body; the
quickstart
adds pagination and readiness checks.
What this package deliberately does not ship
- Settings, infrastructure, or application policy.
FastApiAppwires the standard adapters from an explicitAppConfig; applications still construct their settings, clients, authenticators, stores and product routes. - A dependency-injection container, a settings facade, any store. FastAPI's
Dependsis the DI framework; configuration arrives as function arguments; anAsyncIdempotencyStoreis SQL- or Redis-backed and belongs to the application. - A tracing middleware. Tracing is W3C Trace Context through OpenTelemetry's
own
FastAPIInstrumentor, not a house middleware —FastApiAppcalls it by default (AppConfig.tracing). The current trace id reaches a 500 the same way it reaches any other response:render_problemreads it from the active span, andServerErrorMiddlewaresits inside the instrumentation's span, not outside it. - A token verifier. The auth binding takes any
rn_forge.auth.Authenticator; verifying a JWT against a JWKS is that authenticator's job. For OIDC that authenticator already exists —rn_forge.auth.oidc.OidcAuthenticator, via this package'soidcextra — and is shared withrn-forge-djangoso both stacks accept the same tokens. Nothing here wraps it; pass it tobearer_auth.
Dependencies
rn-forge-web — every module adapts one of its primitives.
rn-forge-commons — declared directly: problem uses its AppLogger.
rn-forge-auth — a base dependency: the auth package is built on its
login flows, Principal, Requirement and authenticator contracts. Its OIDC
adapter comes with this package's oidc extra, and its Redis stores with the
redis extra, which also installs the client for auth.redis.
fastapi (>=0.141.1) — a hard dependency, not an extra. It is used as
documented, not abstracted away — an application keeps APIRouter, Depends,
Header and response_model exactly as FastAPI defines them. pydantic (2.13
resolved) and starlette arrive with it; the rn_forge.web.WireModel
configuration uses validate_by_name/serialize_by_alias, which need pydantic
≥ 2.11.
Not wrapped: FastAPI's HTTPBearer/HTTPBasic are used with
auto_error=False — kept for the securitySchemes entry they put in the
schema, stripped of their own 401 body and non-RFC-6750 challenge.
OpenAPI across stacks
Wire behaviour and operationId are identical to the Django stack; the rest of
the document text is not. Page[T] keeps pydantic's own name, Page_UserOut_.
An operation outside the six CRUD verbs is a custom method, spelled
POST /orders/{orderId}:cancel and named ordersCancel (see rn-forge-web's
api-conventions.md §9). Spelled as a plain path segment it still gets a
mechanical name and wants an explicit operation_id=.
operationId must be unique across the document. drf-spectacular warns and
appends a numeral on a collision; FastAPI does neither, so two routes ending in
the same literal segment collide silently here.
Documentation
task docs:build builds the combined site and every package site. The wiring
guide is the page an application is written from.
Metadata
Release files for rn-forge-fastapi 0.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rn_forge_fastapi-0.5.2.tar.gz | 52.1 kB | With provenance | Details for rn_forge_fastapi-0.5.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rn_forge_fastapi-0.5.2-py3-none-any.whl | Python 3 | none | any | Details for rn_forge_fastapi-0.5.2-py3-none-any.whl |
Total release size: 116.3 kB
Release files / rn_forge_fastapi-0.5.2.tar.gz
| Download URL | rn_forge_fastapi-0.5.2.tar.gz |
|---|---|
| Size | 52.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d026043bd0f74abbe2084f41df90f24eec2cffa4ef077069d693b05e712daa20
|
|
BLAKE2b-256 checksum How to use checksums |
def27119b1b6c6519a000568481785604c263646c9ce420adca995c62d3dca19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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 21, 2026.
Transparency logRelease files / rn_forge_fastapi-0.5.2-py3-none-any.whl
| Download URL | rn_forge_fastapi-0.5.2-py3-none-any.whl |
|---|---|
| Size | 64.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7bcf9f51dae3f2f5f07f31adb31f77ddac5cb416ddc2d319477938f6d6828b6
|
|
BLAKE2b-256 checksum How to use checksums |
4a380c4357f5963961a354ad524aa41e534476873c1247644366b51dbcc3b03e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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 21, 2026.
Transparency logSecurity for rn-forge-fastapi 0.5.2
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.
Attestation for rn_forge_fastapi-0.5.2.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 21, 2026.
Transparency logA 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.