ferro_io
Multi-core async runtime for Python, backed by Tokio. Ships with ferro_io, a
100% drop-in replacement for asyncio (every public symbol resolves; 313
tests verify it, including real asyncpg / SQLAlchemy / FastAPI integration).
# Mode 1 — library-level
import ferro_io as asyncio
asyncio.run(main())
# Mode 2 — process-wide (third-party libs also benefit)
import ferro_io
ferro_io.install()
import aiofiles # now uses ferro_io under the hood
Why
CPython's GIL serializes asyncio onto one core. ferro_io moves the scheduler
into Tokio with a multi-thread runtime, so:
- IO workloads stay at the theoretical sleep floor (no slower than stdlib).
- CPU workloads that go through
ferro_io.AsyncRuntime.map_blockingusetokio::task::spawn_blockingand bypass the GIL entirely.
Benchmarks (M-series Mac, 14 cores)
Best of 5 trials. Full matrix with uvloop in benchmarks/RESULTS.md.
| Workload | stdlib asyncio | uvloop | ferro_io | vs stdlib |
|---|---|---|---|---|
| 50 × 50ms IO sleep | 51.62 ms | 51.57 ms | 51.44 ms | ~1× (sleep floor) |
| 200 × 20ms IO sleep | 22.94 ms | 22.00 ms | 21.23 ms | ~1× (sleep floor) |
| 14 CPU chains × 5M LCG iters | 6036 ms | 5578 ms | 6.37 ms | 🔥 947× |
IO workloads: ferro_io and uvloop are both pinned at the theoretical sleep floor —
neither beats physics. CPU workloads: uvloop (libuv) stays GIL-bound like stdlib
because it optimizes the event loop, not CPU parallelism. ferro_io's map_blocking
routes through tokio::task::spawn_blocking, which releases the GIL and saturates
all worker threads.
Coverage
- Symbol-level: 119/119 asyncio public symbols resolve through
ferro_io. - Real-world programs verified:
TaskGroup, subprocess pipelines, TCP client/server with streams,to_thread,Queueproducer/consumer, gather withreturn_exceptions,wait_for,timeout,Runnerwith contextvars. - Third-party library smoke test:
aiofilesworks underferro_io.install(). - Heavyweight libraries verified against real services under
ferro_io.install():asyncpg(Cython records, prepared statements, transactions, pools),SQLAlchemyasync (greenlet sync→async bridge over asyncpg),FastAPI/Starlette(anyio, contextvars middleware,to_thread). Seetests/test_heavyweights.py. - 307 unit tests + 6 heavyweight integration tests, 0 skipped, 0 failed.
Compatibility matrix
| stdlib | uvloop | trio | ferro_io | |
|---|---|---|---|---|
Drop-in asyncio replacement |
— | ✅ | ❌ | ✅ |
asyncio symbol coverage |
100% | ~98% | 0% | 100% (119/119) |
asyncio.TaskGroup (3.11+) |
✅ | ✅ | n/a (nurseries) | ✅ |
| Multi-core CPU workloads | ❌ GIL | ❌ GIL | ❌ GIL | ✅ (via spawn_blocking) |
| Windows support | ✅ | ❌ | ✅ | ✅ |
httpx / aiohttp / websockets |
✅ | ✅ | partial | ✅ (tested) |
asyncpg (Cython records) |
✅ | ✅ | ❌ | ✅ (tested — see test_heavyweights.py) |
SQLAlchemy async (greenlets) |
✅ | ✅ | ❌ | ✅ (tested) |
FastAPI / Starlette |
✅ | ✅ | partial | ✅ (tested) |
All "tested" cells are backed by tests/test_heavyweights.py, which runs in the
integration CI job against a real Postgres service container and also executes
a matching stdlib-control run so a test-script bug can't masquerade as a ferro_io
incompatibility.
Heavyweight compat tests run in the integration CI job against a real
Postgres service container. To run them locally:
docker compose -f tests/docker-compose.yml up -d
FERRO_IO_INTEGRATION=1 pytest tests/test_heavyweights.py -v
Benchmark matrix vs uvloop
Generate the full matrix (runs each column in a subprocess so uvloop.install()
can't contaminate the others):
pip install uvloop # optional
python benchmarks/bench_matrix.py # writes benchmarks/RESULTS.md
See benchmarks/RESULTS.md for the latest numbers.
TL;DR: uvloop and ferro_io both sit at the IO sleep floor (within noise of
each other). On workload C, ferro_io's spawn_blocking path bypasses the GIL
while uvloop — like stdlib — remains serialized.
Caveat for process-wide mode
Code that does from asyncio import sleep at module top-level captures the
stdlib reference at import time, before ferro_io.install() can run. To work
around it, call ferro_io.install() as the very first statement in your entry
point — before any third-party import.
Build
python -m venv .venv && source .venv/bin/activate
pip install maturin pytest pytest-asyncio
maturin develop --release
pytest tests/ -v
python benchmarks/bench.py
Built with PyO3 0.28 + pyo3-async-runtimes 0.28 + Tokio + maturin. ABI3 wheels cover Python 3.9+.
Metadata
Release files for ferro-io 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| ferro_io-0.2.0-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details for ferro_io-0.2.0-cp39-abi3-win_amd64.whl |
| ferro_io-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64 | Details for ferro_io-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| ferro_io-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ ARM64 | Details for ferro_io-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
| ferro_io-0.2.0-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details for ferro_io-0.2.0-cp39-abi3-macosx_11_0_arm64.whl |
| ferro_io-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl | CPython 3.9 | abi3 | macOS 10.12+ x86-64 | Details for ferro_io-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl |
Total release size: 2.1 MB
Release files / ferro_io-0.2.0-cp39-abi3-win_amd64.whl
| Download URL | ferro_io-0.2.0-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 379.8 kB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
71686fdc8efb95e36182b5b5f8edd19409e540f34f30fdbef738591c50b86191
|
|
BLAKE2b-256 checksum How to use checksums |
d4e3d476d89c393995954c4bb946dabb870225a5b08b8f8d2ceed45899b30830
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.13.1
|
Release files / ferro_io-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | ferro_io-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 457.8 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
14d5e2e96f0e7d0c018f81d036a6e558fffca008196dbeca8197de4a51a3d21b
|
|
BLAKE2b-256 checksum How to use checksums |
039ed8c8a2e32cb64c6e0d5f4f2a7b76a1790346760cd1e1fd94160c03f3a1a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.13.1
|
Release files / ferro_io-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | ferro_io-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 446.0 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
c6a8b826c9ceb6622e9ec5cf55bde578a4c28fa58134974949490d8f59d539b6
|
|
BLAKE2b-256 checksum How to use checksums |
5004863a4b7eddbae6700edb3e3831bdaa701414e9d15f2fb599e344d9f2c37c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.13.1
|
Release files / ferro_io-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | ferro_io-0.2.0-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 405.8 kB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
241edc97aed9ff75c37f4956cc0b977fc8e9bade28194f454309f60276562cc5
|
|
BLAKE2b-256 checksum How to use checksums |
4153c1047bce9063ee12c9560c28aadefbc08e4dc70e623e296f1d91a2836b6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.13.1
|
Release files / ferro_io-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | ferro_io-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 421.3 kB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
2e9fb91743b186372be7ecf251e59bcde2a2f8bed6d18f490ade564ea54bc47b
|
|
BLAKE2b-256 checksum How to use checksums |
119b3bc4c23f8809ac45f042d02e0b1a73b699264ebc1948c581b6f8759d7696
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.13.1
|
Security for ferro-io 0.2.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.