Skip to main content

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.

CI

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.json with 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) and oxyroute.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 patchelf on 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

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 documentation
  • tests/ — 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oxyroute-0.4.0.tar.gz (186.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

oxyroute-0.4.0-cp310-abi3-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.10+Windows x86-64

oxyroute-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

oxyroute-0.4.0-cp310-abi3-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

oxyroute-0.4.0-cp310-abi3-macosx_10_12_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file oxyroute-0.4.0.tar.gz.

File metadata

  • Download URL: oxyroute-0.4.0.tar.gz
  • Upload date:
  • Size: 186.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for oxyroute-0.4.0.tar.gz
Algorithm Hash digest
SHA256 f97cb4cdcb60f5a6e2406e3b071dcce960c9deae79ff257c94c0c516c73e1797
MD5 bc9fa37c90894587991e8390e108fb6e
BLAKE2b-256 19c0bd9b0e3b5a2e2da4fc37186165b76f8ed8b0c55821294fb2339c373dd991

See more details on using hashes here.

File details

Details for the file oxyroute-0.4.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: oxyroute-0.4.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 2.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

Hashes for oxyroute-0.4.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 fe780d4663ab201e66fad5efa212aed4c40bde62357b9bb18966f8ba007473bc
MD5 56544b904cc24b910f60adcacb6ddf3d
BLAKE2b-256 d5d60c2f556b60290242b7480f9a11837e442b958ff68091b26c6221dbc69705

See more details on using hashes here.

File details

Details for the file oxyroute-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for oxyroute-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 27bde72e55dd6c63b433d1f31caa1b34374e01bfc6435fc2b192e371e5403414
MD5 a6cc3a091a03bf76f9bb57d7856bdb95
BLAKE2b-256 dc70da1963ef4dfe30d2f5dbddabc5b0f7278047f01659bfdb066a6f56dde943

See more details on using hashes here.

File details

Details for the file oxyroute-0.4.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for oxyroute-0.4.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 10209c97478817aec20d99fab7b307dc31048d62f9e9be26d8be7e181bd1dd93
MD5 11be73d8d01f3ece986d40a46f469dd1
BLAKE2b-256 e0adeef5125a73cba9f9e47b97015dcef1bb9349907e298b281374651bd4bf12

See more details on using hashes here.

File details

Details for the file oxyroute-0.4.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for oxyroute-0.4.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 030f9bf83e467e3e773030d700fcee2aa00037dc1679cc4e3dfcc510a70f63e6
MD5 c21f4173a9e5a6621f8d46139ea899d9
BLAKE2b-256 b6e389d21c72819b397640a7acf9fff10ac1371620ed414c3f85ea8902cb1b84

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page