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.0 -m "Ferronit 0.12.0" && git push origin v0.12.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.12.0 .
docker run --rm -p 8000:8000 ferronit:0.12.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.12.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.12.0.tar.gz | 68.0 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| ferronit-0.12.0-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details |
| ferronit-0.12.0-cp312-abi3-musllinux_1_2_x86_64.whl | CPython 3.12 | abi3 | Linux musl 1.2+ x86-64 | Details |
| ferronit-0.12.0-cp312-abi3-manylinux_2_28_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| ferronit-0.12.0-cp312-abi3-manylinux_2_28_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| ferronit-0.12.0-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details |
| ferronit-0.12.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.12.0.tar.gz
| Download URL | ferronit-0.12.0.tar.gz |
|---|---|
| Size | 68.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39bca8906da34a7185d8280abfc853759c350449eefa61180b071b78182923c9
|
|
BLAKE2b-256 checksum How to use checksums |
a650ef18b765f76fe60d68e4bb22cfcb2c2ccfadc0d9caa3b5520c24bd247c68
|
| 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.0-cp312-abi3-win_amd64.whl
| Download URL | ferronit-0.12.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 341.8 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
bc204c128be2546399c6f75e5e6b60fa2735decc1ef4e270bc64827ad09c26f7
|
|
BLAKE2b-256 checksum How to use checksums |
0dc315f2f4acacea1111bae84728a2f1599cc00375a20c7c4da332bc653019d7
|
| 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.0-cp312-abi3-musllinux_1_2_x86_64.whl
| Download URL | ferronit-0.12.0-cp312-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 644.7 kB |
| Tags | CPython 3.12 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f11b02bed35a5a3840eca9be3c374eeaffe96f2d7b118384b0dd8c7b5dfca04b
|
|
BLAKE2b-256 checksum How to use checksums |
ab16aca1046c95d9cbb5fc91c72b7c5b4bd119f3c4a3a158dc50ed3b6dc38bc4
|
| 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.0-cp312-abi3-manylinux_2_28_x86_64.whl
| Download URL | ferronit-0.12.0-cp312-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 435.9 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
286061c0934d58132cbff030273b4412920b92a72c3309d3c32356de90372903
|
|
BLAKE2b-256 checksum How to use checksums |
37fbda4815cacb0022a6dda6f3efe7ea50fc7abed905327a5a93a68b31d41b5e
|
| 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.0-cp312-abi3-manylinux_2_28_aarch64.whl
| Download URL | ferronit-0.12.0-cp312-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 420.2 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
5aac903c86865f536c6878a35ff673c9539603464ea2bb3ec5659da69220974b
|
|
BLAKE2b-256 checksum How to use checksums |
c1cf61fd28408f84de02a56c9f110ca00be3a3cf6488bbfd0899e0fc00b99b50
|
| 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.0-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | ferronit-0.12.0-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 396.7 kB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
550f8cfd9705e6d7ac6ffbf69f496b4de2337a9a3a8c065bbaf019393327a24c
|
|
BLAKE2b-256 checksum How to use checksums |
38152a0c420e961ed2c9273a38f7f3b889d889d9e0f3d0ec8888d1192c85f354
|
| 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.0-cp312-abi3-macosx_10_12_x86_64.whl
| Download URL | ferronit-0.12.0-cp312-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 407.3 kB |
| Tags | CPython 3.12 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
ef8833345304937c8a5bc7e1d0a6d62c064e5981a2ddf9323b36fdd9f79a48b6
|
|
BLAKE2b-256 checksum How to use checksums |
66c1caf9ab10807a14e4de0cd4395ed8514b54d6ed19f1ed11efbbd1226dbb4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|