turbofile
Real async file I/O for Python. A Rust core drives the best completion
mechanism each OS has — io_uring on Linux, POSIX AIO on macOS — behind an
aiofiles-compatible asyncio API.
Existing Python async-file libraries dispatch every call to a thread pool.
turbofile submits the I/O to the kernel and completes your await when the
kernel says the data moved:
- Zero-copy reads and writes. The kernel fills the
bytesobject yourawait f.read(n)returns; writes pin your buffer and hand the kernel its pointer. No intermediate copies on the hot paths. - Completion batching. A burst of completions costs one event-loop wakeup
(one
call_soon_threadsafedoorbell per burst, drained entirely in Rust). - Parallel large reads. Read-all on a large file is split into chunks filled concurrently into one buffer.
- Whole-file ops.
read_bytes/write_bytesdo open+read/write+close as a single submission — one round trip per file.
import turbofile
async def main() -> None:
async with turbofile.open("data.bin", "rb") as f:
payload = await f.read()
async with turbofile.open("log.txt", "a", encoding="utf-8") as f:
await f.write("one line\n")
data = await turbofile.read_bytes("data.bin") # whole file, one op
text = await turbofile.read_text("notes.md")
turbofile.open mirrors aiofiles.open: binary and text modes, buffering,
encoding/errors/newline with full universal-newline semantics,
seek/tell (text cookies follow CPython's _pyio scheme), readline,
async iteration, readinto, truncate, fsync via sync. Migration is
import turbofile as aiofiles for the open API.
Benchmarks
make bench compares against aiofiles on your machine. On an Apple-silicon
Mac (macOS 26.4, POSIX AIO backend, page-cache-hot files):
| workload | vs aiofiles |
|---|---|
4 KiB whole-file read (read_bytes) |
2.5x |
| 32 concurrent 4 KiB random reads | 15x |
| 200 small files read concurrently | 3.6x |
8 MiB whole-file read (open + read) |
1.0x |
| 8 MiB sequential write (1 MiB chunks) | 1.0x |
Large sequential transfers are memory-bandwidth-bound in the page cache, so
every implementation converges there; turbofile wins where per-op overhead and
concurrency dominate, which is what an asyncio application actually does.
io_uring numbers on Linux come from CI; run make bench there for your
hardware.
Backends
| OS | backend | mechanism |
|---|---|---|
| Linux | compio (fusion driver) | io_uring, automatic polling fallback under seccomp/old kernels |
| macOS | darwin-aio | POSIX AIO (aio_read/aio_write/aio_fsync in XNU) |
| macOS | compio (opt-in) | kqueue polling driver with thread dispatch |
TURBOFILE_BACKEND=compio selects the compio driver on macOS (benchmarking,
or as an escape hatch). Windows (IOCP via compio) is planned.
Limitations
opener=and integer file descriptors are not supported.read_byteson very large files pays one buffer copy; preferopen(...).read()for multi-megabyte files.- Cancelling an
awaitdetaches the future; the kernel op still completes (and, forreadinto, may still write into the buffer) — standard completion-model semantics.
Development
make develop # build the extension into the venv (uv + maturin)
make test # cargo test + pytest
make lint # clippy -D warnings
make bench # benchmark against aiofiles
License
MIT OR Apache-2.0
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file turbofile-0.1.0.tar.gz.
File metadata
- Download URL: turbofile-0.1.0.tar.gz
- Upload date:
- Size: 37.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
645030886961151d016ef19e93bcaa4f5fc73b1599c14ff1d2887a4a2474afd9
|
|
| MD5 |
7ac61cff57f5ac932a6dac4cae064d3a
|
|
| BLAKE2b-256 |
e133f7529cb2a7d9733631dc9354cb5105636e8eef55c6e39b19e8039a08c58c
|
Provenance
The following attestation bundles were made for turbofile-0.1.0.tar.gz:
Publisher:
release-please.yaml on 4thel00z/turbofile
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
turbofile-0.1.0.tar.gz -
Subject digest:
645030886961151d016ef19e93bcaa4f5fc73b1599c14ff1d2887a4a2474afd9 - Sigstore transparency entry: 2672921099
- Sigstore integration time:
-
Permalink:
4thel00z/turbofile@85e2323efcdd69a07b9cfec77db015e518275141 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/4thel00z
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-please.yaml@85e2323efcdd69a07b9cfec77db015e518275141 -
Trigger Event:
push
-
Statement type:
File details
Details for the file turbofile-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: turbofile-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 474.1 kB
- Tags: CPython 3.12+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a77fcefe4be092b4c17ceccfe99f0805a01775f60e5ad6bae8ea123ae69b258
|
|
| MD5 |
b0930c472363110d7208d604547a287c
|
|
| BLAKE2b-256 |
a95c32080f46583c05c2bf28acc2a77b6077216a121e637ed9041eb8dc604cd6
|
Provenance
The following attestation bundles were made for turbofile-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release-please.yaml on 4thel00z/turbofile
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
turbofile-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
3a77fcefe4be092b4c17ceccfe99f0805a01775f60e5ad6bae8ea123ae69b258 - Sigstore transparency entry: 2672921128
- Sigstore integration time:
-
Permalink:
4thel00z/turbofile@85e2323efcdd69a07b9cfec77db015e518275141 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/4thel00z
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-please.yaml@85e2323efcdd69a07b9cfec77db015e518275141 -
Trigger Event:
push
-
Statement type:
File details
Details for the file turbofile-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: turbofile-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 470.1 kB
- Tags: CPython 3.12+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
125a455753efc14a05f48f569b9be0059bcab91707be358cb93cc8fc118add55
|
|
| MD5 |
495291b4d157f9371cf1be0a43068e0c
|
|
| BLAKE2b-256 |
7c7dad244dfe800aa5e9e92b288ab1b4c1531b1545a2091b9c54eceff44868eb
|
Provenance
The following attestation bundles were made for turbofile-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release-please.yaml on 4thel00z/turbofile
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
turbofile-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
125a455753efc14a05f48f569b9be0059bcab91707be358cb93cc8fc118add55 - Sigstore transparency entry: 2672921171
- Sigstore integration time:
-
Permalink:
4thel00z/turbofile@85e2323efcdd69a07b9cfec77db015e518275141 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/4thel00z
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-please.yaml@85e2323efcdd69a07b9cfec77db015e518275141 -
Trigger Event:
push
-
Statement type:
File details
Details for the file turbofile-0.1.0-cp312-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: turbofile-0.1.0-cp312-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 423.9 kB
- Tags: CPython 3.12+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a3711976031406b52d63cb25bdc347e855d725bce8dd6ec9e35cdb3248d6490
|
|
| MD5 |
eb7298044e9cdcba30300042d18c9939
|
|
| BLAKE2b-256 |
7de7310ec59876cff3e11893f4d50e4c03ae0c0eebf9b0597093a14c55272267
|
Provenance
The following attestation bundles were made for turbofile-0.1.0-cp312-abi3-macosx_11_0_arm64.whl:
Publisher:
release-please.yaml on 4thel00z/turbofile
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
turbofile-0.1.0-cp312-abi3-macosx_11_0_arm64.whl -
Subject digest:
5a3711976031406b52d63cb25bdc347e855d725bce8dd6ec9e35cdb3248d6490 - Sigstore transparency entry: 2672921227
- Sigstore integration time:
-
Permalink:
4thel00z/turbofile@85e2323efcdd69a07b9cfec77db015e518275141 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/4thel00z
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-please.yaml@85e2323efcdd69a07b9cfec77db015e518275141 -
Trigger Event:
push
-
Statement type: