Wreath
A complete Python web stack, compiled around the application you declare.
Framework, PostgreSQL stack, identity, policy, durable work, observability and a native HTTP server in one Python 3.14-first package. The core has no mandatory runtime dependencies and remains an ordinary ASGI application.
Documentation · Build a serious API · Runnable example · Issues
Declare the application once
The route below gets compiled binding, bounded fields, native JSON, replay-safe writes, request IDs, security headers and an OpenAPI operation from the same declarations.
from dataclasses import dataclass
from typing import Annotated
from wreath import Request, Wreath
from wreath.binding import Body, Field
from wreath.policy import HttpPolicy, IdempotencyPolicy
from wreath.policy.request_id import RequestIdPolicy
from wreath.policy.security import SecurityHeadersPolicy
@dataclass
class RunRequest:
prompt: Annotated[str, Field(min_length=3, max_length=2_000)]
model: Annotated[str, Field(min_length=2, max_length=80)]
app = Wreath(
http_policy=HttpPolicy(
idempotency=IdempotencyPolicy(),
request_id=RequestIdPolicy(),
security_headers=SecurityHeadersPolicy(),
)
)
@app.post("/runs")
async def create_run(
request: Request,
command: Annotated[RunRequest, Body()],
) -> dict:
return {"state": "queued", "model": command.model, "prompt": command.prompt}
app.enable_api_docs(environments=("development",), try_it_out=True)
uv add wreath
uv run wreath dev app:app
uvicorn app:app is valid too. Choose Wreath's native server when you
want its full HTTP, TLS, telemetry and flight-recording path.
One lifecycle, fewer seams
HTTP and policy
Routing, binding, middleware, security, CORS, CSRF, sessions, caching, idempotency, rate limits, OpenAPI and response delivery share one compiled application image. Wreath also makes modern HTTP useful at the declaration: QUERY, API Catalog, Link-Template, Content-Digest, Cache-Status, Cache-Groups, Deprecation, Sunset and incremental delivery.
Data and durable work
The owned PostgreSQL driver, migrations, declarative models, prepared queries, transactions, lease/fence primitives, jobs, schedules, event delivery and outbox patterns use the same startup and shutdown boundary. The data guide starts small; the migration workflow covers production changes.
Billing and subscriptions
Hosted checkout, subscriptions, portals, refunds, Stripe Connect and Managed Payments share one provider-neutral control plane. Wreath maps application plans to provider prices, projects verified webhooks into its owned ledger, derives atomic Cedar entitlements, and reconciles remote state without holding a database transaction across network I/O. Direct card capture is deliberately outside the API; deployment-owned compliance decisions remain visible instead of becoming a framework promise. See billing and subscriptions.
ChatOps
One typed command declaration can serve Slack, Microsoft Teams and Discord with no provider SDK dependency. Wreath owns ingress verification, manifests, acknowledgements and bounded delivery, then reuses the application's identity, organization, Cedar, rate-limit, durable-job, stream, notification and agent infrastructure. Existing Entra or Google-backed users can resolve through the same application identity and permission stores; profile fields never silently provision or merge accounts. See the ChatOps runtime.
Identity and operations
Bearer and cookie identity, OAuth BFF sessions, step-up authentication, SAML, SCIM, Cedar authorization, tenant boundaries, privacy work, audit evidence, metrics and forensic capture are first-class surfaces. Unsupported combinations fail when the application compiles, before they become production slow paths.
Build the part that is hard
The guides are backed by complete systems, not disconnected snippets:
- secure product API, live energy depot, and personal device fleet
- automation backplane, governed MCP control room, and enterprise control plane
- time-series laboratory, noon-drop storefront, and offline operations service
The conventional paths remain close at hand: HTTP and OpenAPI, browser applications, CLI tasks, and the production runbook.
Performance you can audit
Wreath skips request-time work by compiling stable facts at startup, crosses the Python/native boundary in batches, and moves byte-heavy work into owned native kernels. It does not treat “rewritten in C” as evidence.
Both charts come from the retained raw samples. The request includes TLS 1.3, policy and sessions, nested typed input, bearer and Cedar authorization, PostgreSQL and HTTP wire calls, temporal, geospatial and vector work, ranked pagination, protobuf, MessagePack, templates and compression. Every response is verified before a sample is accepted.
Instructions use five alternating 30/15-request slopes and an unchanged A/A
control. Memory uses five separate fresh-process runs, summing the server and all
descendants from /proc/<pid>/smaps_rollup; PSS apportions shared mappings while
RSS counts each mapping in every process. The 2 ms process-tree scan can miss a
shorter-lived peak. These are instruction and memory accounts, not elapsed-time
or throughput claims.
The motion is authored with Anime.js and sampled into standalone SVG animation;
the complete final frame is the fallback when a host does not animate SVG. The
dependency exists only in tools/readme_charts,
never in Wreath or its wheel. The
benchmark guide carries the commands, equivalent-work
checks, framework-specific limitations, cache counters and native gzip corpus.
Install
pip install wreath
# or
uv add wreath
uv add 'wreath[linux]' # io_uring reactor and native TLS on Linux
uv add 'wreath[h3]' # HTTP/3; `http3` is an alias
The base wheel includes Wreath's portable C implementation. Use the framework on any conforming ASGI server, or select the accelerated server components explicitly.
Wreath is pre-1.0. The version, platform and upgrade contract states what each release supports.
Engineering contract
Performance changes keep repeated equivalent measurements and raw evidence. Wire behavior is checked against independent implementations or standards. Unsupported declarations refuse at startup. Native code owns no process-global mutable state. Hot-path complexity and Python/native crossings have executable baselines, and behavior changes ship with focused tests.
uv sync
uv run wreath-check
uv run wreath test
The repository's AGENTS.md is the complete engineering contract.
Metadata
Release files for wreath 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| wreath-0.5.0-cp314-cp314-win_amd64.whl | CPython 3.14 | CPython 3.14 | Windows x86-64 | Details |
| wreath-0.5.0-cp314-cp314-manylinux_2_34_x86_64.whl | CPython 3.14 | CPython 3.14 | Linux glibc 2.34+ x86-64 | Details |
| wreath-0.5.0-cp314-cp314-manylinux_2_34_aarch64.whl | CPython 3.14 | CPython 3.14 | Linux glibc 2.34+ ARM64 | Details |
| wreath-0.5.0-cp314-cp314-macosx_11_0_arm64.whl | CPython 3.14 | CPython 3.14 | macOS 11.0+ ARM64 | Details |
| wreath-0.5.0-cp314-cp314-macosx_10_13_x86_64.whl | CPython 3.14 | CPython 3.14 | macOS 10.13+ x86-64 | Details |
Total release size: 32.9 MB
Release files / wreath-0.5.0-cp314-cp314-win_amd64.whl
| Download URL | wreath-0.5.0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1110bc392962cf6c5ba8e944448225569b73eb08f48ebedcac2d6bd199449b18
|
|
BLAKE2b-256 checksum How to use checksums |
6737a6bd2cc15309751a66fe9c11daccd8f573a3e288523b714e052bc3b80050
|
| 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 7, 2026.
Transparency logRelease files / wreath-0.5.0-cp314-cp314-manylinux_2_34_x86_64.whl
| Download URL | wreath-0.5.0-cp314-cp314-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 8.9 MB |
| Tags | CPython 3.14 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
ba3dc7ee1c588b564173dfc8a0af11b715bd93d0f11eaa6f51110b8b64e8e565
|
|
BLAKE2b-256 checksum How to use checksums |
e2039324307b41dbc21f0a244193bd0b1fd9ca731831987f883f2096821d27bc
|
| 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 7, 2026.
Transparency logRelease files / wreath-0.5.0-cp314-cp314-manylinux_2_34_aarch64.whl
| Download URL | wreath-0.5.0-cp314-cp314-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 8.7 MB |
| Tags | CPython 3.14 Linux glibc 2.34+ ARM64 |
|
SHA-256 checksum How to use checksums |
32176d96d92152033f58acae63782cd3c9fd30c344a0596aa024b04b4abe8bb8
|
|
BLAKE2b-256 checksum How to use checksums |
9e5804e0d92d4d9a90450aa935ccfc112d82238e02f33e92ef675dc3b2e6af4c
|
| 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 7, 2026.
Transparency logRelease files / wreath-0.5.0-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | wreath-0.5.0-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
3b6adb9d9a1a1fab60f1bdbb05a290e4d9a6bf496b9d14067e6d2e9e74b8418c
|
|
BLAKE2b-256 checksum How to use checksums |
40d32885040f2baff3b17d4c110f0f5ee75774590dcfd7ee67a598dd206f4f0d
|
| 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 7, 2026.
Transparency logRelease files / wreath-0.5.0-cp314-cp314-macosx_10_13_x86_64.whl
| Download URL | wreath-0.5.0-cp314-cp314-macosx_10_13_x86_64.whl |
|---|---|
| Size | 5.2 MB |
| Tags | CPython 3.14 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
1c67c2356461909916ecd437d776102f03c9aa65a066efbbfba2374a8f4c5814
|
|
BLAKE2b-256 checksum How to use checksums |
7b0ba6527e4c8fc3992a766c95b9c1b94f78a0699f8c386e406aededdc98fa8d
|
| 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 7, 2026.
Transparency log