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.12.2 -m "Ferronit 0.12.2" && git push origin v0.12.2
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.12.2 .
docker run --rm -p 8000:8000 ferronit:0.12.2
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.12.2
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.12.2.tar.gz | 69.4 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| ferronit-0.12.2-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details |
| ferronit-0.12.2-cp312-abi3-musllinux_1_2_x86_64.whl | CPython 3.12 | abi3 | Linux musl 1.2+ x86-64 | Details |
| ferronit-0.12.2-cp312-abi3-manylinux_2_28_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| ferronit-0.12.2-cp312-abi3-manylinux_2_28_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| ferronit-0.12.2-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details |
| ferronit-0.12.2-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.12.2.tar.gz
| Download URL | ferronit-0.12.2.tar.gz |
|---|---|
| Size | 69.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a32048ccceddb4fb9108fd0d436d2750b94695431e927c18e0be385a6a02b5db
|
|
BLAKE2b-256 checksum How to use checksums |
0d1e416d778e6ecb22d2089d227ef18f6c51865fac1d0e0493990a02e9bbcbe4
|
| 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.12.2-cp312-abi3-win_amd64.whl
| Download URL | ferronit-0.12.2-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 343.1 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f971062a8338e5d3b1ab86b597487a15ccc52a6e51483bcb131a8eb793ee799b
|
|
BLAKE2b-256 checksum How to use checksums |
5df65d9c7093444413441ec077123200ab776cda5c9bcd4c6a81fc72655e86f9
|
| 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.12.2-cp312-abi3-musllinux_1_2_x86_64.whl
| Download URL | ferronit-0.12.2-cp312-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 646.0 kB |
| Tags | CPython 3.12 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
04aae593abf9e3495e1ba9d47ce98ae4f5074ae3acb275cc4bee233f9add5257
|
|
BLAKE2b-256 checksum How to use checksums |
c8d2ecdf4ac10bb3fbc68bae01de1347aebc72dcf20d9aa6d9daf197e80fc889
|
| 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.12.2-cp312-abi3-manylinux_2_28_x86_64.whl
| Download URL | ferronit-0.12.2-cp312-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 437.2 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7187b2784339dd27e3f33a918b56a5e252dc7efb3fdd2c6d3a427c7c09705096
|
|
BLAKE2b-256 checksum How to use checksums |
65907b87e22807d05f1a6d243871f73a0fa3ac07a1bb8d8ac063d5de557eee06
|
| 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.12.2-cp312-abi3-manylinux_2_28_aarch64.whl
| Download URL | ferronit-0.12.2-cp312-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 421.5 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
a17829235f491f2081ee2be82159edaf776e3cf69e6f73841cf4e5d852239637
|
|
BLAKE2b-256 checksum How to use checksums |
f1c9e719f4aef2b412d1d4033d3d52ae80bd41834d78e1da9c7766ece224866c
|
| 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.12.2-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | ferronit-0.12.2-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 398.0 kB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
92a6fa49f77b9980044f6e758278e033a8833e758d5b6d4de93242eb1d26bda6
|
|
BLAKE2b-256 checksum How to use checksums |
afe72d048aee2a53ee2c24ef8f80053b2c975b705049668c6a12e8c43ad8f638
|
| 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.12.2-cp312-abi3-macosx_10_12_x86_64.whl
| Download URL | ferronit-0.12.2-cp312-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 408.5 kB |
| Tags | CPython 3.12 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
44b43337e87c72dd542be7e35341af715731cd1f478b9938e4db3c870ece3866
|
|
BLAKE2b-256 checksum How to use checksums |
1f5930ad488c85235dba109ecfecd23380833831d43baaadff9663fddf5002f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|