Ferronit
English · Русский
Your legacy Python service is hitting its performance ceiling. Ferronit moves the hot path — routing, request parsing, JSON, gzip, CORS, PostgreSQL — into a Rust core, while your handlers stay plain Python. A migration, not a rewrite.
Documentation: docs/ — quick start, routing, requests,
dependency injection, the data layer (rawdb + rawmodel), DDD/DI, the Rust core,
benchmarks, ASVS. (Docs are currently written in Russian.)
Installation
pip install ferronit # installs the Python layer and the native core together
Ferronit is a single package built with maturin as a
mixed project. The core (ferronit._core) is compiled with the abi3-py312 feature, so
one wheel works on every CPython from 3.12 to 3.15+. Its only runtime dependencies are
msgspec (fast JSON/validation) and asyncpg (the rawdb/rawmodel data layer).
# app.py
from ferronit import Ferronit
app = Ferronit()
@app.route("/hello/{name}")
async def hello(name: str):
return {"hello": name}
ferronit dev # dev server (uvicorn, reload)
ferronit dev --server granian # granian (Rust, ~4× faster)
ferronit run --workers 4 # production: granian, uvicorn fallback
Why it is fast
Routing is Rust matchit, effectively O(1): Ferronit does not degrade as the number of
routes grows, while FastAPI loses up to 4× inside a single routing table. Methodology —
ab (C client) only; the full analysis is in docs/benchmarks.md.
| Scenario | Ferronit | FastAPI | Gap |
|---|---|---|---|
| uvicorn, 1000 routes | 20 216 req/s | 2 817 req/s | ×7.2 |
| granian, 1000 routes | 94 873 req/s | 3 416 req/s | ×27.8 |
Data layer
Three options for different jobs — from "request → whole JSON response in Rust" to a
full ORM. Which one to pick: docs/data/overview.md.
Development
poetry install --all-extras # environment in .venv + all dependencies
PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 poetry run maturin develop --release # build the Rust core
./scripts/check.sh # lint → types → docstrings → core build → tests
poetry run pytest tests/ -q # 263 tests
Poetry manages the environment (poetry.toml keeps the venv inside the project), while the
wheel carrying the Rust core is built by maturin (see [tool.maturin] in pyproject.toml),
so Poetry itself never installs the project.
- AGENTS.md — guidance for code agents (Claude Code, Codex, Cursor, …).
examples/— minimal, DI, LLM + SSE, RAG, WebSocket;examples/app.pyis the DDD example.- The package ships
py.typed; type stubs for the Rust core live inferronit/_core.pyi. bench/— the measurement rig behind every number above; not part of the package.
Release
# the version lives in two files: ferronit/__init__.py and ferronit-rs/Cargo.toml
git tag -a v0.14.0 -m "Ferronit 0.14.0" && git push origin v0.14.0
Pushing a v* tag triggers .github/workflows/release.yml: checks and tests → wheels
(Linux glibc/musl, macOS, Windows) and sdist → GitHub Release with the artifacts → publish
to PyPI (API token from the PYPI_API_TOKEN repository secret). If the tag version does not
match Cargo.toml/__init__.py, the workflow fails before publishing anything.
Docker
docker build -t ferronit:0.14.0 .
docker run --rm -p 8000:8000 ferronit:0.14.0
License
Apache License 2.0 — see LICENSE. Use, modification and distribution are permitted, including commercial use; copyright notices and the patent grant must be preserved.
Metadata
Release files for ferronit 0.14.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ferronit-0.14.0.tar.gz | 72.8 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| ferronit-0.14.0-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details |
| ferronit-0.14.0-cp312-abi3-musllinux_1_2_x86_64.whl | CPython 3.12 | abi3 | Linux musl 1.2+ x86-64 | Details |
| ferronit-0.14.0-cp312-abi3-manylinux_2_28_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| ferronit-0.14.0-cp312-abi3-manylinux_2_28_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| ferronit-0.14.0-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details |
| ferronit-0.14.0-cp312-abi3-macosx_10_12_x86_64.whl | CPython 3.12 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 2.7 MB
Release files / ferronit-0.14.0.tar.gz
| Download URL | ferronit-0.14.0.tar.gz |
|---|---|
| Size | 72.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37da147b7f8f5656bf4165313ffa53312bf6d9ad9e1940d38f41979dc1d7e28b
|
|
BLAKE2b-256 checksum How to use checksums |
6345207706b303fb8e4a04e477fb888014b6dc7f1f1c7856cb7a174e207a87d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / ferronit-0.14.0-cp312-abi3-win_amd64.whl
| Download URL | ferronit-0.14.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 346.3 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
c6b69ead948b5bc84b3ccd783b26edc070d934c5c1dc4c3a314b431413ef2cbf
|
|
BLAKE2b-256 checksum How to use checksums |
9eed58569a50e9d8e7492fc086b7719c8e166809d30f6509faecce456b6947fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / ferronit-0.14.0-cp312-abi3-musllinux_1_2_x86_64.whl
| Download URL | ferronit-0.14.0-cp312-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 649.1 kB |
| Tags | CPython 3.12 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
164e502611b8677a2e517537fd258190b2d1aac0a430c093666baedcf58d1819
|
|
BLAKE2b-256 checksum How to use checksums |
f080bcf98b1a672b928e63219995d2f916c08983680656c0a51fbd64cc1f1f6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / ferronit-0.14.0-cp312-abi3-manylinux_2_28_x86_64.whl
| Download URL | ferronit-0.14.0-cp312-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 440.4 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
b8a65dc3c768d64822bd841335d630567db90aa8c89ef7056dea74b70bc24f8a
|
|
BLAKE2b-256 checksum How to use checksums |
032fd29577e17d106628bbe70af04a4e33acbbc67a4514840a079b7cb7db8d91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / ferronit-0.14.0-cp312-abi3-manylinux_2_28_aarch64.whl
| Download URL | ferronit-0.14.0-cp312-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 424.7 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
b414569ae2004979f38ac73e3fea9ea21f0caf22bc83173176f47172a2980e3e
|
|
BLAKE2b-256 checksum How to use checksums |
a87632b7a369043bb75ad2d7423432d2899340e28ac8fb88fe3b753d331403f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / ferronit-0.14.0-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | ferronit-0.14.0-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 401.1 kB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c7e3e3c2ac3b09e64ca971ba492291d4a7009f980662ebf6ced6a6fa89d83430
|
|
BLAKE2b-256 checksum How to use checksums |
0ef46ee97b68c30eb00b7b64fbf6e0360179d837811fee48e60585baeee8f4cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / ferronit-0.14.0-cp312-abi3-macosx_10_12_x86_64.whl
| Download URL | ferronit-0.14.0-cp312-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 411.7 kB |
| Tags | CPython 3.12 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
dfca66618f72f5f117bf95751d5cbaedd3a89f93294daf59e75c0f0a7fe34e42
|
|
BLAKE2b-256 checksum How to use checksums |
bb8e29d498d79a73f956f2459c864520ddef5a66d7afc71679f308f28d4679d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|