Skip to main content

Ferronit

English · Русский

PyPI Python License GitHub stars

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.py is the DDD example.
  • The package ships py.typed; type stubs for the Rust core live in ferronit/_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.16.0 -m "Ferronit 0.16.0" && git push origin v0.16.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.16.0 .
docker run --rm -p 8000:8000 ferronit:0.16.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.16.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ferronit 0.16.0
File Size Uploaded Provenance Actions
ferronit-0.16.0.tar.gz 74.4 kB Without provenance Details for ferronit-0.16.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for ferronit 0.16.0
File Actions
ferronit-0.16.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for ferronit-0.16.0-cp312-abi3-win_amd64.whl
ferronit-0.16.0-cp312-abi3-musllinux_1_2_x86_64.whl CPython 3.12 abi3 Linux musl 1.2+ x86-64 Details for ferronit-0.16.0-cp312-abi3-musllinux_1_2_x86_64.whl
ferronit-0.16.0-cp312-abi3-manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.28+ x86-64 Details for ferronit-0.16.0-cp312-abi3-manylinux_2_28_x86_64.whl
ferronit-0.16.0-cp312-abi3-manylinux_2_28_aarch64.whl CPython 3.12 abi3 Linux glibc 2.28+ ARM64 Details for ferronit-0.16.0-cp312-abi3-manylinux_2_28_aarch64.whl
ferronit-0.16.0-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for ferronit-0.16.0-cp312-abi3-macosx_11_0_arm64.whl
ferronit-0.16.0-cp312-abi3-macosx_10_12_x86_64.whl CPython 3.12 abi3 macOS 10.12+ x86-64 Details for ferronit-0.16.0-cp312-abi3-macosx_10_12_x86_64.whl

Total release size: 2.8 MB

Release files / ferronit-0.16.0.tar.gz

Download URL ferronit-0.16.0.tar.gz
Size 74.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2b05eb4fd4886639820b8217e5358914f0adf71a365c9bb57b7d67477a9831f8
BLAKE2b-256 checksum
How to use checksums
3fcdcb9c4f3bd504a1511b1ca5a6e0a8017ca0b8c1477ef9c1b3d88211903810
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.16.0-cp312-abi3-win_amd64.whl

Download URL ferronit-0.16.0-cp312-abi3-win_amd64.whl
Size 349.8 kB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
4a766b980068718af41701d6348a3982de9a42535db2fbfb11076d096eb74161
BLAKE2b-256 checksum
How to use checksums
bd7c53be0d31f2b114949d70d3e568518ebd40d4096cd6dbaa96db89c93e41e1
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.16.0-cp312-abi3-musllinux_1_2_x86_64.whl

Download URL ferronit-0.16.0-cp312-abi3-musllinux_1_2_x86_64.whl
Size 652.3 kB
Tags CPython 3.12 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
10ea74531ecc9cd7c8835ed2f7f62f4e820b6934f2adb26cf420816a68a2d8e4
BLAKE2b-256 checksum
How to use checksums
7a2cbad3586734328cf6bca44394dcd69c2c49b3b753e5ebdf2774026424b9ff
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.16.0-cp312-abi3-manylinux_2_28_x86_64.whl

Download URL ferronit-0.16.0-cp312-abi3-manylinux_2_28_x86_64.whl
Size 443.6 kB
Tags CPython 3.12 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
0091617c809468c326b4edbcaa2180e8333454fa0b631e2c18e397f81aa6740a
BLAKE2b-256 checksum
How to use checksums
e4b7b98d156971ecdb984f5d374657c287e8ed9f381fa8e45ace752c18aa5a18
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.16.0-cp312-abi3-manylinux_2_28_aarch64.whl

Download URL ferronit-0.16.0-cp312-abi3-manylinux_2_28_aarch64.whl
Size 427.5 kB
Tags CPython 3.12 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
0e6b725a75996b6deee843083bd70eca8e6dc194809c056a6c83783e5320010c
BLAKE2b-256 checksum
How to use checksums
48b0059d362a66f7704a5b4ba4d990f0431bd4922a5a86120f8e2693a798e8e2
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.16.0-cp312-abi3-macosx_11_0_arm64.whl

Download URL ferronit-0.16.0-cp312-abi3-macosx_11_0_arm64.whl
Size 404.2 kB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
374927e3eeb3b59b9e36fb29157ef912b6243f2c9b6786ff0cb080ced3c4afaf
BLAKE2b-256 checksum
How to use checksums
258d353798becf4a91454cd92ebf7d68fed86af7666b3d2ea723c2d7c340c6e0
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.16.0-cp312-abi3-macosx_10_12_x86_64.whl

Download URL ferronit-0.16.0-cp312-abi3-macosx_10_12_x86_64.whl
Size 415.0 kB
Tags CPython 3.12 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
75e029afafadbcc0dfa865368180a7f0985fd784d4028637944810351c063e51
BLAKE2b-256 checksum
How to use checksums
de0ecc576c5638ebefbcc87426e40f894029c5147b509a13d208849d113586ca
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.16.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page