RSGI-first web framework: routing, JSON, and JWT in Rust (PyO3), Python handlers
Project description
OxyRoute
High-performance web framework for Granian RSGI, tuned for high single-worker throughput: routing, JSON/form parsing, JWT checks, response mapping, and native WebSockets run on a Rust hot path (PyO3 + Maturin), while business logic stays in plain Python handlers.
Features
- RSGI entrypoint (
async def __rsgi__(scope, protocol)) compatible with Granian’s RSGI implementation - Routing via matchit (path parameters like
/users/:id) - JSON, form, and multipart bodies parsed on the native path; successful values passed to handlers as kwargs
- JWT verification on the Rust path before your handler runs (
require_jwt, HS*, RSA, EC, EdDSA public-key verification) - Optional
GET /openapi.jsonwith a minimal OpenAPI-style document - Dependencies: linear list of named factories (
Depends, sync or async) passed as kwargs - Optional middleware layers for pre-route decisions, CORS, CSRF, and browser security headers
- Native RSGI WebSockets via
@app.websocket(path)andoxyroute.WebSocket - Native extension wheel (abi3) for Python ≥ 3.10
Start with the full Usage guide, or use docs/index.md for topic-specific pages.
Requirements
- Python 3.10 or newer
- For running a pre-built wheel: only
pip(and a server such as Granian) - For building from source: Rust toolchain + maturin (and
patchelfon some Linux setups is recommended for best wheel layout; see docs/installation.md)
Install
From PyPI (when published):
pip install oxyroute
Development / optional test dependencies:
pip install "oxyroute[dev]"
From a git checkout (builds the native module):
pip install maturin
maturin develop
# or: pip install .
Quick start (RSGI + Granian)
examples/rsgi_app.py:
from oxyroute import App
app = App(title="Hello OxyRoute")
@app.get("/")
def root() -> str:
return "OxyRoute RSGI OK"
@app.get("/hello/:name")
def hello_name(name: str) -> dict:
return {"message": f"Hello, {name}"}
Run (from the repo, after maturin develop or an editable install):
granian --interface rsgi examples.rsgi_app:app
Per-worker setup (__rsgi_init__) is shown in examples/rsgi_lifespan_app.py and docs/rsgi.md.
OxyRoute v0.3.0 supports only Granian RSGI; the legacy ASGI bridge (uvicorn / granian --interface asgi) was removed.
Usage docs
- Usage guide — install, run, routing, bodies, responses, middleware, CORS, CSRF, JWT, WebSockets, deployment notes, limitations
- RSGI and Granian — app entrypoint, lifespan hooks, worker process model
- Handlers — injected parameters and response mapping details
- Routing — methods, path syntax,
APIRouter,freeze() - JWT, CORS, CSRF, Security headers
- WebSockets and SSE
Production notes
OxyRoute is designed for Granian RSGI deployments. For public traffic, place it behind a normal production boundary (TLS, request-size limits, timeouts, logging, process supervision) and keep OXYROUTE_DEBUG disabled. Request bodies and multipart files are currently buffered in memory before parsing, so enforce limits both at the edge and with OXYROUTE_MAX_BODY_BYTES.
Project layout
oxyroute/— Python package (App,Depends)src/— Rust extension (_oxyroute, routing, dispatch, JWT helpers)docs/— detailed English documentationtests/— pytest suite (run from a temp directory or an installed wheel so the source tree does not shadow the package; see docs/development.md)
Contributing
See CONTRIBUTING.md (build, tests, issue backlog, batch gh script).
License
This project is licensed under the MIT License.
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oxyroute-0.3.0.tar.gz.
File metadata
- Download URL: oxyroute-0.3.0.tar.gz
- Upload date:
- Size: 166.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8380ae9d2b1596b756e0f2f69853608d6d6932e74f1bfca414223e596c09ce88
|
|
| MD5 |
bbb84364fc7f952fb2881a021e19eae4
|
|
| BLAKE2b-256 |
6c3d23e6335f00b1741f9e770c4cafbbf832b5f98e063d92190179a2d29a311d
|
File details
Details for the file oxyroute-0.3.0-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: oxyroute-0.3.0-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9f0c3dae618cb637d522f73be3855d8310d18c84ce6198710b0fbb8c8be80f9
|
|
| MD5 |
f39c686faf6ccd9d6609ecaec40876a9
|
|
| BLAKE2b-256 |
af00b93fa03b9d775910ed77721ed0edef0d77294ebbcfce37456498af67e8ee
|
File details
Details for the file oxyroute-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: oxyroute-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc5bbb28be437f4110380e77e56372a3fcb5b2b5d13d89cb6e1f07fbbf2a75ec
|
|
| MD5 |
17bb434400efe418d862bd5edcedbda5
|
|
| BLAKE2b-256 |
dadf1fd24f7d9c47abc2206d1d2c5f30010928c2f111ea241b3d98f3435e2715
|
File details
Details for the file oxyroute-0.3.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: oxyroute-0.3.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ba89943a2f69ab7823a97a929359ddd057323180aa81d90b947646a3b6b4d91
|
|
| MD5 |
bf6dd9b261aaa9be4f9477946b8a7d3d
|
|
| BLAKE2b-256 |
1c3bfcd42bbaf3ad6cea24a0b47560e3304a60de6c38085e1f35cb00a55618f0
|
File details
Details for the file oxyroute-0.3.0-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: oxyroute-0.3.0-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34039fd2b144d174b033b0aa55406b0534e8b9cb5cf92e96622f9512cd5ca327
|
|
| MD5 |
f35f152bb246dc3fe20c1b3cd04dc3af
|
|
| BLAKE2b-256 |
f3bcd73c595b97c753fd2c60a7dcc9429f17d593fd4deaeaf034a2229a8c25d7
|