aiofilepool
Async file-descriptor pool for Python.
FilePool caps how many OS file descriptors are open at once,
while your code can freely hold thousands of
logical async file handles.
- Async-native - built on
asyncio; blocking I/O is offloaded to a thread pool. - Chunked I/O - large reads/writes split via pluggable chunkers; you can open streams with
chunks(). - Zero dependencies - pure standard library.
Install
pip install aiofilepool
# or
uv add aiofilepool
Requires Python 3.12+.
Usage
import asyncio
from aiofilepool import FilePool
async def main():
# at most 128 real OS fds open at once
async with FilePool(descriptor_pool_size=128) as pool:
handle = await pool.open("data.bin", "w+")
await handle.write(b"hello world")
await handle.seek(0)
print(await handle.read()) # b"hello world"
await handle.fsync()
# handles auto-close on exit from pool. Also you can do this manually:
await handle.close()
# or with a manager:
async with pool.open("data.bin", "w+") as fd:
...
asyncio.run(main())
It bounds only the real fds and manages temporary closing and re-opening them, so this is completely fine:
async with FilePool(descriptor_pool_size=64) as pool:
handles = [await pool.open(f"part-{i}.bin", "w+") for i in range(1000)]
await asyncio.gather(*(h.write(payload) for h in handles))
Also you can read a large file in chunks:
handle = await pool.open("big.bin", "r")
async for chunk in handle.chunks():
process(chunk)
Although, the handle.read uses chunking too, so chunks are there just for convenience
API
FilePool- the pool:open(path, mode),manage(binary_io),close(), and an async context manager.FileHandle- an async file handle:read,write,seek,tell,sizeetc. A handler you use to talk to a file.AsyncBinaryIO- the async binary-IO protocolFileHandleimplements.BinaryIOAdapter- allows to wrap an existing synchronousBinaryIOas anAsyncBinaryIO.ModeSpec- a parsed file open-mode.Chunker,FixedChunker,BalancedChunker- chunking strategies. You can use them withAsyncBinaryIO.chunksor as a default for theFilePool.aiofilepool.errors- the exception hierarchy.
License
MIT — see LICENSE.
Metadata
Release files for aiofilepool 0.1.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 |
|---|---|---|---|---|
| aiofilepool-0.1.0.tar.gz | 9.9 kB | With provenance | Details for aiofilepool-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiofilepool-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for aiofilepool-0.1.0-py3-none-any.whl |
Total release size: 24.3 kB
Release files / aiofilepool-0.1.0.tar.gz
| Download URL | aiofilepool-0.1.0.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5530a5d13461d17d5d23404e53c743d66467412e31b66efc7b491a2bf0c3d987
|
|
BLAKE2b-256 checksum How to use checksums |
4ec12c95940c8c403055358b6f42f53c4fa8cf90dad51b3fe9c447793c30701e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / aiofilepool-0.1.0-py3-none-any.whl
| Download URL | aiofilepool-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dac56765ff57c86de1c00a864789ee116fc8b9e40c5d7b97a423eb82f3d08595
|
|
BLAKE2b-256 checksum How to use checksums |
0d531decffde6e18d4edfc53194cfbda0b8798ba295d2d779f296ce015fe7b4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logSecurity for aiofilepool 0.1.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for aiofilepool-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logA 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.