aioshutil is a Python library that provides asynchronous versions of functions from the standard `shutil` module. It achieves asynchronicity by running blocking I/O operations in a thread pool, thereby preventing the blocking of the asyncio event loop. The library is actively maintained, with the current version being 1.6.
pip install aioshutilVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `aioshutil` to perform common file operations like copying, moving, and removing directories asynchronously within an `asyncio` application. It mirrors the `shutil` API but with `await` calls.
Understand that 'asynchronous' in this context means non-blocking to the Python event loop, not necessarily non-blocking kernel I/O. Benchmark if extreme low-level I/O latency is critical.
Initialize `asyncio` primitives within an `async` function (e.g., inside `main()` or as part of an `__init__` method for async classes) after the event loop has been established by `asyncio.run()`. Python 3.10 and later mitigate this specific issue for `asyncio.Lock` by removing the `loop` parameter.
Install the package using pip: 'pip install aioshutil'.
Ensure you are using the correct function names as provided by 'aioshutil'.
Use 'await' when calling asynchronous functions: 'await aioshutil.rmtree(path)'.
Verify the available functions in 'aioshutil' and use the correct ones.
Use 'nest_asyncio' to allow nested use of 'asyncio' in environments like Jupyter Notebook.
No dependency data recorded yet.