Ferronit
English · Русский
⚠️ Early development — not production-ready. The API and internals are still changing; use at your own risk.
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). On database reads Ferronit beats the
competition with positional row-mapping (rawmodel) + msgspec. Methodology — ab
(C client) only, granian, 1 worker; full breakdown in
docs/benchmarks.md.
| Scenario | Ferronit | BlackSheep | FastAPI |
|---|---|---|---|
| GET /ping (dict) | 98 197 req/s | 93 523 req/s | 19 036 req/s |
| GET /rows?limit=100 | 8 350 req/s | 8 065 req/s | 956 req/s |
| GET /rows?limit=1000 | 2 334 req/s | 1 780 req/s | 158 req/s |
Data layer
One thin layer over asyncpg — rawdb + rawmodel: declarative models, a query DSL
(select), relations, a Unit of Work — no ORM. Details:
docs/data/overview.md.
from typing import Annotated
from ferronit import Ferronit
from ferronit.contrib.rawdb import create_pool
from ferronit.contrib.rawmodel import Model, Relation
class OrderItem(Model):
__table__ = "order_items"
id: int = 0
order_id: int = 0
name: str = ""
class Order(Model):
__table__ = "orders"
id: int = 0
items: Annotated[list[OrderItem], Relation("order_id")] = [] # 1:N, always loaded
app = Ferronit()
@app.route("/orders")
async def orders():
pool = await create_pool("postgresql://user:pass@localhost/db") # usually lifespan/DI
async with pool.uow(readonly=True) as uow:
rows = await uow.model(Order).list(limit=10)
return {"orders": rows} # items nested in JSON, one WHERE fk = ANY($1)
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 # 265 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.17.0 -m "Ferronit 0.17.0" && git push origin v0.17.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.17.0 .
docker run --rm -p 8000:8000 ferronit:0.17.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.17.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 | Provenance | Actions |
|---|---|---|---|---|
| ferronit-0.17.0.tar.gz | 75.0 kB | Without provenance | Details for ferronit-0.17.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| ferronit-0.17.0-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details for ferronit-0.17.0-cp312-abi3-win_amd64.whl |
| ferronit-0.17.0-cp312-abi3-musllinux_1_2_x86_64.whl | CPython 3.12 | abi3 | Linux musl 1.2+ x86-64 | Details for ferronit-0.17.0-cp312-abi3-musllinux_1_2_x86_64.whl |
| ferronit-0.17.0-cp312-abi3-manylinux_2_28_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ x86-64 | Details for ferronit-0.17.0-cp312-abi3-manylinux_2_28_x86_64.whl |
| ferronit-0.17.0-cp312-abi3-manylinux_2_28_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ ARM64 | Details for ferronit-0.17.0-cp312-abi3-manylinux_2_28_aarch64.whl |
| ferronit-0.17.0-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details for ferronit-0.17.0-cp312-abi3-macosx_11_0_arm64.whl |
| ferronit-0.17.0-cp312-abi3-macosx_10_12_x86_64.whl | CPython 3.12 | abi3 | macOS 10.12+ x86-64 | Details for ferronit-0.17.0-cp312-abi3-macosx_10_12_x86_64.whl |
Total release size: 2.8 MB
Release files / ferronit-0.17.0.tar.gz
| Download URL | ferronit-0.17.0.tar.gz |
|---|---|
| Size | 75.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81d3e042525273a89e92ae363233196e369f62478df565955eec945f5916f667
|
|
BLAKE2b-256 checksum How to use checksums |
bc8d607a0448ccc690dd0dd72118ca7c2e94f109cdc13dcacb709aec7b13d7f5
|
| 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.17.0-cp312-abi3-win_amd64.whl
| Download URL | ferronit-0.17.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 350.7 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7e6ff55c292bf4ec89ae661648c6317d80c92bc5ce1954ff01c701ac7eca602b
|
|
BLAKE2b-256 checksum How to use checksums |
4a24893dc05b71a788796da8021cc66551421043507c26f8e70ba518accc3104
|
| 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.17.0-cp312-abi3-musllinux_1_2_x86_64.whl
| Download URL | ferronit-0.17.0-cp312-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 653.2 kB |
| Tags | CPython 3.12 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
1d73dad22d2bbf5a0932bc41bc5656a213874ac21bf869c2898e61b10e1d1c0e
|
|
BLAKE2b-256 checksum How to use checksums |
b7fb54f91c3d4e9817aabb70279c135ba6999b8972b2cb0a9fd3e14b06f4c60b
|
| 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.17.0-cp312-abi3-manylinux_2_28_x86_64.whl
| Download URL | ferronit-0.17.0-cp312-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 444.3 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e62b297cd642f8a731afc1ae4ec0000c4b12b3523d110a503f305a6c8e4ffef7
|
|
BLAKE2b-256 checksum How to use checksums |
91f376592094ab73a6919a4ad25a16f30e05fde5cc10ae5fae4ac54bc390c4ea
|
| 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.17.0-cp312-abi3-manylinux_2_28_aarch64.whl
| Download URL | ferronit-0.17.0-cp312-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 428.2 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
b494c8057d209a9eae398f78fdbbbc8fa60a323a32e99c80bd53e11679fb0301
|
|
BLAKE2b-256 checksum How to use checksums |
bbebcb9f905af10cc6d3ca3aab048704c595b6e93574d3f0b6437c59e48411d8
|
| 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.17.0-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | ferronit-0.17.0-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 405.0 kB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
5ddc8ce5a6ca970fdf823e86e87b36f098e2a92d4c71466b71b5c82dc34d6378
|
|
BLAKE2b-256 checksum How to use checksums |
763e9279145180232cfe17e91e298f2a3a309defa3877d8bafa3183b16f5f226
|
| 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.17.0-cp312-abi3-macosx_10_12_x86_64.whl
| Download URL | ferronit-0.17.0-cp312-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 415.8 kB |
| Tags | CPython 3.12 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
a201067f0ccd89f66c1832495e8bffdb23cfa0eece062831178225673b93d7a5
|
|
BLAKE2b-256 checksum How to use checksums |
7cba0d2ee7b65d7275c56920f3134e5d50b5cdc735237b048cfd88284d80f8be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for ferronit 0.17.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.