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.1 -m "Ferronit 0.12.1" && git push origin v0.12.1
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.1 .
docker run --rm -p 8000:8000 ferronit:0.12.1
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.1
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.1.tar.gz | 68.9 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| ferronit-0.12.1-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details |
| ferronit-0.12.1-cp312-abi3-musllinux_1_2_x86_64.whl | CPython 3.12 | abi3 | Linux musl 1.2+ x86-64 | Details |
| ferronit-0.12.1-cp312-abi3-manylinux_2_28_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| ferronit-0.12.1-cp312-abi3-manylinux_2_28_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| ferronit-0.12.1-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details |
| ferronit-0.12.1-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.1.tar.gz
| Download URL | ferronit-0.12.1.tar.gz |
|---|---|
| Size | 68.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0ff6e3cc5eb7b9a3c38cf2b24545ee8fc04a791e4963e7c63cf367c65e8a8116
|
|
BLAKE2b-256 checksum How to use checksums |
b922a6ee38817dcd3c2724c27b1905ba5c31782adc7878f7a8e3acfbbc73106e
|
| 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.1-cp312-abi3-win_amd64.whl
| Download URL | ferronit-0.12.1-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 342.7 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
ad6d94b5bcf17903200895140005217843525ded5746f3dd3940c97cb8548b2c
|
|
BLAKE2b-256 checksum How to use checksums |
dc049def79ca8326af37b9bf350ff1920e1a8107c653deeb21d513bc35a516ac
|
| 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.1-cp312-abi3-musllinux_1_2_x86_64.whl
| Download URL | ferronit-0.12.1-cp312-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 645.6 kB |
| Tags | CPython 3.12 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
95ee7570a58b72216eca0987569f1089b2e2cec93d0703775bd4b25b60e420dd
|
|
BLAKE2b-256 checksum How to use checksums |
2ec99aa9de47002c16f7b0761a1f632bb5c87cd0249cb7dbef2185dca4a2701d
|
| 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.1-cp312-abi3-manylinux_2_28_x86_64.whl
| Download URL | ferronit-0.12.1-cp312-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 436.9 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
4b6d1a8fb059a1f931605e85381149af3ee065bc76a5d0beb52091fe6a8a4c6b
|
|
BLAKE2b-256 checksum How to use checksums |
f83a586caa8013354e1fc075dff308cd84e2fb45cd7ab7c42f36926344156472
|
| 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.1-cp312-abi3-manylinux_2_28_aarch64.whl
| Download URL | ferronit-0.12.1-cp312-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 421.2 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
5074c387df2b44d2701bc9132eafeebf8a75ef1cae6c65ac42e8480a3bcc431d
|
|
BLAKE2b-256 checksum How to use checksums |
2140acdb454ecc053099f98cda85f4d87412ad6bc6b43cf2fe2aec3b09ca4737
|
| 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.1-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | ferronit-0.12.1-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 397.6 kB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
600e3c01c8a03c96a99650ad4d3b81addc38e6667f9e40d14f5e3528086fe136
|
|
BLAKE2b-256 checksum How to use checksums |
aa605e44302df97c57b024fa1b7ec4e2a6abb001b49bc54268e2459aa1c1fc56
|
| 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.1-cp312-abi3-macosx_10_12_x86_64.whl
| Download URL | ferronit-0.12.1-cp312-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 408.2 kB |
| Tags | CPython 3.12 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
2f1dfe94d317b43049d26487b804f8b8bee8979b5804ae04998bf28c74344649
|
|
BLAKE2b-256 checksum How to use checksums |
428efdfcdb813b2b269c568aa6566c5f3c495cf748be44be75f0ef4803910308
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|