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.13.0 -m "Ferronit 0.13.0" && git push origin v0.13.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.13.0 .
docker run --rm -p 8000:8000 ferronit:0.13.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.13.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.13.0.tar.gz | 70.7 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| ferronit-0.13.0-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details |
| ferronit-0.13.0-cp312-abi3-musllinux_1_2_x86_64.whl | CPython 3.12 | abi3 | Linux musl 1.2+ x86-64 | Details |
| ferronit-0.13.0-cp312-abi3-manylinux_2_28_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| ferronit-0.13.0-cp312-abi3-manylinux_2_28_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| ferronit-0.13.0-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details |
| ferronit-0.13.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.13.0.tar.gz
| Download URL | ferronit-0.13.0.tar.gz |
|---|---|
| Size | 70.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
05e66a2d95673d03452af74169320f29edb488f051dc9420624c6c836e9783cc
|
|
BLAKE2b-256 checksum How to use checksums |
78421a40b12e4cb4aabae75440b83fa517b93061e61477ff00f291586ab86775
|
| 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.13.0-cp312-abi3-win_amd64.whl
| Download URL | ferronit-0.13.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 344.2 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
54d762f83f17163a53aa35d1b99a6a6eeb61c1bc820c1554e34215e6ffb6ab47
|
|
BLAKE2b-256 checksum How to use checksums |
3e202ca2468078e668ca9c15328d3bec1e56ef683cf2c5c11790f083efea34c6
|
| 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.13.0-cp312-abi3-musllinux_1_2_x86_64.whl
| Download URL | ferronit-0.13.0-cp312-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 647.1 kB |
| Tags | CPython 3.12 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
97297ca0703b2fe010ab17fb7a1429e7c4f03035f7b64ed74ba86c1707089a9a
|
|
BLAKE2b-256 checksum How to use checksums |
700c1b333fba2e1dd0915ed154d98025c0eb5313514aeb4b4c2a1e039e8ec5e1
|
| 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.13.0-cp312-abi3-manylinux_2_28_x86_64.whl
| Download URL | ferronit-0.13.0-cp312-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 438.4 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
6840cbbaf18d13c270a2302c9d4034aa7e5dad8da1420c7e8e319d9ce8f47408
|
|
BLAKE2b-256 checksum How to use checksums |
2108ed6961ca1b71e3885eae9c76bcea5fec85ef8189e875267193835728ad79
|
| 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.13.0-cp312-abi3-manylinux_2_28_aarch64.whl
| Download URL | ferronit-0.13.0-cp312-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 422.7 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
5d518733e6b533a9b21f6cefb62b4df587e7dc31c6718dc4ce68689649473cb6
|
|
BLAKE2b-256 checksum How to use checksums |
ab55d3148723e3cd18ac4843f56a75148bcd36c03749804b53f159b355202859
|
| 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.13.0-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | ferronit-0.13.0-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 399.1 kB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ff6ff377696199f836e92220bf5ece3e93ba24c53c1e4cad5de929e3c574336e
|
|
BLAKE2b-256 checksum How to use checksums |
bf2dee768a894ec87b368a93fb85f7938d692786068eaf07c540ce3f00670147
|
| 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.13.0-cp312-abi3-macosx_10_12_x86_64.whl
| Download URL | ferronit-0.13.0-cp312-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 409.7 kB |
| Tags | CPython 3.12 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
b926a094e97b801f7da2a511d2b92875f2bf3f71d092904558b8d3084a7b953d
|
|
BLAKE2b-256 checksum How to use checksums |
1cb0f68333dc7851ed023a7c43c0e57284bc9a465f7784bed7536ba0e0a3f2ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|