aiofiles
File support for asyncio.
Decision gist · record as of 2026-08-14
Yes. aiofiles is a mature, actively maintained library (Production/Stable status, first release 2015-04-06) with no known vulnerabilities, permissive licensing, and zero runtime dependencies. It solves a real problem—blocking file I/O in asyncio—with a familiar API. Install it if your asyncio application needs to perform disk I/O without freezing the event loop.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later; asyncio event loop must be running.
- Low friction: pure Python wheel with no runtime dependencies.
- Active maintenance with recent releases and a stable codebase (3252 stars, last commit 2026-07-18).
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most projects.
last release 2025-10-09 (309 days) · last repo commit 2026-07-18 · 3,252 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 162,003,375 downloads/mo, #255 on PyPI
Alternatives
Verify before relying
pip install aiofiles
import aiofiles
async with aiofiles.open('filename', mode='r') as f:
contents = await f.read()
async with aiofiles.tempfile.TemporaryFile('wb') as f:
await f.write(b'Hello, World!')What it is and what it does
aiofiles wraps Python's standard file I/O operations to make them non-blocking within asyncio applications. Local disk file I/O is inherently blocking and would freeze an asyncio event loop if called directly; aiofiles solves this by running file operations in a thread pool executor, allowing the event loop to remain responsive. The library exposes an async API that mirrors the built-in open() function and file methods, so developers can use familiar patterns like async context managers and async iteration.
The package supports buffered and unbuffered binary files, buffered text files, and provides async wrappers for the tempfile module (TemporaryFile, NamedTemporaryFile, SpooledTemporaryFile, TemporaryDirectory). It also includes async versions of common os module functions like stat, rename, mkdir, listdir, and path operations. With no runtime dependencies and support for Python 3.9 through 3.14, it integrates cleanly into asyncio-based applications.
Use it for
- Reading or writing files in an asyncio web server without blocking the event loop.
- Processing large files line-by-line asynchronously using async iteration.
- Creating temporary files or directories in async contexts (e.g., during async test fixtures).
- Performing file system operations like rename, mkdir, or listdir concurrently with other async tasks.
- Mocking file I/O in async unit tests by patching aiofiles.threadpool.sync_open.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
aiofiles is a mature, actively maintained library (Production/Stable status, first release 2015-04-06) with no known vulnerabilities, permissive licensing, and zero runtime dependencies. It solves a real problem—blocking file I/O in asyncio—with a familiar API. Install it if your asyncio application needs to perform disk I/O without freezing the event loop.
Install
aiofiles on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Active maintenance with recent releases and a stable codebase (3252 stars, last commit 2026-07-18).
Requires Python 3.9 or later; asyncio event loop must be running.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install aiofiles
import aiofiles
async with aiofiles.open('filename', mode='r') as f:
contents = await f.read()
async with aiofiles.tempfile.TemporaryFile('wb') as f:
await f.write(b'Hello, World!')
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 309 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 162,003,375 / month, #255 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: AsyncIOLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy |
Evidence: aiofiles-25.1.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “async file io”
- aiofilesProvides non-blocking file I/O for asyncio applications by delegating…
- caioProvides async file I/O for Python via multiple backends: io_uring…
- aiofileProvides asynchronous file I/O operations for asyncio programs, with…
Give your agent the search over MCP, or paste the wish link into any chat.
Similar packages
Provides async-friendly versions of shutil functions that run blocking file operations in a thread pool, preventing event loop blocking in asyncio applications.
However, note that the package is aging (last update 297 days ago) and has modest adoption.
Provides asynchronous file I/O operations for asyncio programs, with automatic selection of the best available backend (io_uring, libaio, thread-based, or pure Python) depending on your system.
Provides async-compatible CSV reading and writing using AsyncReader, AsyncDictReader, AsyncWriter, and AsyncDictWriter classes that work with objects exposing async read/write coroutines.
Async-compatible reimplementation of Python's pathlib with awaitable I/O operations, compatible with asyncio and trio.
However, the dormant maintenance status means no active support for bugs or Python version changes—verify that Python 3.12+ support meets your needs and that the…
Provides asyncio-compatible wrappers around multiprocessing objects (Queue, Lock, Process, Pool, etc.) so their blocking methods can be awaited in async code without freezing the event loop.
Manages a pool of concurrent asyncio coroutines, enforcing a fixed limit on how many can run simultaneously while maintaining a familiar pool interface.
See also blockbuster · aioconsole · types-aiofiles · miniopy-async