A complete asynchronous implementation of Python's pathlib for asyncio and trio, enabling non-blocking file system operations.
aiopath is an asynchronous implementation of Python's pathlib module that provides non-blocking file system operations. It allows developers to use familiar pathlib APIs with async/await syntax, preventing I/O operations from blocking the event loop in async applications. This is particularly useful for applications that need to handle concurrent network and disk operations.
Python developers building asynchronous applications with asyncio or trio who need to perform file system operations without blocking their event loops. This includes web scraping scripts, async web servers, and data processing pipelines.
Developers choose aiopath because it provides a drop-in replacement for pathlib with full async support, maintaining API compatibility while enabling true concurrency. Its direct subclass relationship with pathlib.Path ensures seamless interoperability with existing code.
📁 Asynchronous pathlib for Python
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
All pathlib methods are awaitable, preventing event loop blocks and enabling concurrent network and disk operations, as shown in the web scraping example.
AsyncPath is a direct subclass of pathlib.Path, allowing easy conversion between sync and async paths and interoperability with existing code.
Works with asyncio, trio, and any async/await framework, as stated in the README, making it versatile for different async ecosystems.
Methods like glob() return async generators, enabling non-blocking file traversal without suspending other async tasks.
Separate development branches for Python 3.9 and 3.10+ (0.5.x vs 0.6.x) can confuse users and complicate maintenance.
To use libaio via aiofile for optimized async I/O on Linux, additional system packages are required, adding setup complexity not needed on other OSes.
As a niche library, it has fewer stars and contributions on GitHub compared to pathlib, which may lead to slower bug fixes and less community support.