asyncinotify is a simple, optionally-async Python inotify library, focusing on ease of use and modern Python features. It provides a Pythonic interface to Linux's inotify API, built on `ctypes` without external dependencies. The library is actively maintained, currently at version 4.4.4, and supports Python 3.6 and newer. It offers both asynchronous (async/await) and synchronous modes of operation for file system event monitoring.
pip install asyncinotifyVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to asynchronously watch a temporary directory for common file system events (create, modify, access, delete). It uses `Inotify` as a context manager to ensure the inotify handle is properly closed. Events are iterated asynchronously, printing details as they occur.
Implement logic to watch parent directories for `Mask.MOVE_SELF` or `Mask.MOVED_FROM`/`Mask.MOVED_TO` events, and programmatically update or re-add watches with the new paths.
Ensure that asynchronous iteration loops have a defined exit condition, such as a counter, a timeout, or a signal-based shutdown mechanism.
Plan to migrate to Python versions that are actively supported by the Python community (e.g., Python 3.10+) to ensure continued compatibility and receive security updates.
Install the package using pip: 'pip install asyncinotify'.
Ensure you are importing the correct class or function from 'asyncinotify'. Refer to the official documentation for the correct import statements.
Verify that you have installed the correct version of 'asyncinotify' that includes the 'Inotify' class. Check the module's documentation for the correct usage.
Ensure that the directory or file you are trying to watch with `inotify.add_watch()` exists before creating the watch.
Run your application on a Linux-based operating system. If using FreeBSD 15+, the warning might still appear but the functionality should be available.
No dependency data recorded yet.