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)
  • OpenAPI GET /openapi.json plus optional Scalar/Swagger UI at /docs
  • 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 (on_startup / Granian-compatible __rsgi_init__) is shown in examples/rsgi_lifespan_app.py and docs/rsgi.md.

OxyRoute supports only Granian RSGI; the legacy ASGI bridge (uvicorn / granian --interface asgi) was removed in v0.3.0.

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.5.0.tar.gz (206.1 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.5.0-cp310-abi3-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.10+Windows x86-64

oxyroute-0.5.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.5.0-cp310-abi3-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

oxyroute-0.5.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.5.0.tar.gz.

File metadata

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

File hashes

Hashes for oxyroute-0.5.0.tar.gz
Algorithm Hash digest
SHA256 49d099859297f28eddfd7b0f4df3d88d899c738548d54a387e574912c3251290
MD5 d36f5216184084843940562fe5736545
BLAKE2b-256 87d185946aaad1fb6922efd8b4a863eda91621155b8e5d39b4c595302fbc72cc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oxyroute-0.5.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.14

File hashes

Hashes for oxyroute-0.5.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a1a84f48f6fbeb64aaed8602ac84c8cf518c45c530c9d30a54f5216f51ca883c
MD5 ff5f87367d45b9e0baa1bc5a4a0eacd4
BLAKE2b-256 67a9aa6ac80cc7b3396b37eae6e41611b3c046f5f414f3c8b413a588cd5ad394

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxyroute-0.5.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c76aa414547aaf7255905f08882fb77a6ae4c17941f2d8bf6fa9075fa865c005
MD5 44a0281c744932f98deeee8fb016e7b8
BLAKE2b-256 852643a071903738972c7af5a994a300c2c5910fcce9d8618044c12c7bad1f3c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxyroute-0.5.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 66b835bf033cac37e52db865450d1c663ae0c86ef6898cfcfa0106106ba058fb
MD5 c799f1b3f0da88a6849cf8c54fb2818b
BLAKE2b-256 b246beee99d30062631b89f3de191d544e78392e60229ce14938b371dd3d5584

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxyroute-0.5.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 310d9f38937bc04bff87b3112e7e609538f9bc950480a9bdc2011c75735af1e3
MD5 cb966a231df1f571c942d21d7273715a
BLAKE2b-256 cc95c49ecc112281e6e72eedf9a93369a250de3b24c89a94a430f21839e6677d

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