inotify_lite
inotify_lite provides a Python 3 wrapper around the Linux inotify API. This lets you monitor filesystem events, and execute callbacks. See inotify(7).
Requires
Linux >= 2.6.13 (or glibc >= 2.5)
Python >= 3.6
Installation
Install inotify_lite by running:
pip install inotify_lite
Usage
To use inotify_lite:
Create an Inotify instance, passing the name of the files (or directories) you wish to watch;
Register a handler (or many), a callable of two arguments:
an Inotify instance; and
an InotifyEvent instance.
call Inotify.read to read once, or Inotify.watch to watch until a keyboard interrupt is received.
Examples:
def my_callback(_, event):
print(event.name)
print(event.mask)
flags = INFlags.CREATE | INFlags.DELETE
watcher = Inotify("/home/", watch_flags=flags)
watcher.register_handler(INFlags.ALL_FLAGS, my_callback, exclusive=False)
watcher.watch()
def my_callback(_, event):
print(event.name)
print(event.mask)
watcher = TreeWatcher("/home/", watch_flags=INFlags.OPEN, timeout=10)
# Watch the home directory for OPEN events with a 10 second timeout.
watcher.register_handler(INFlags.ALL_FLAGS, my_callback, exclusive=False)
watcher.read_once()
The TreeWatcher class is provided to recursively watch directories.
See the documentation for details and options.
Contribute
Contributions are welcome. Open an issue for visibility.
To install the dev requirements run python setup.py -e .[dev].
To run the tests run make test.
Code should be formatted with black.
Issue Tracker: https://github.com/jams2/inotify_lite/issues
Source Code: https://github.com/jams2/inotify_lite.git
Support
Open an issue.
License
The project is licensed under GPLv3.
Metadata
Release files for inotify-lite 0.0.6
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 |
|---|---|---|---|---|
| inotify_lite-0.0.6.tar.gz | 8.3 kB | Without provenance | Details for inotify_lite-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| inotify_lite-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for inotify_lite-0.0.6-py3-none-any.whl |
Total release size: 31.4 kB
Release files / inotify_lite-0.0.6.tar.gz
| Download URL | inotify_lite-0.0.6.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db043e2ed8b56773e91f7aebe8f1f1ee97fd7a4f3102ee6edaf50204267794f7
|
|
BLAKE2b-256 checksum How to use checksums |
d2c06993f806104f7321bbeb7839a6c250d17f47f84ce7151c0b1152ae88430a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5
|
Release files / inotify_lite-0.0.6-py3-none-any.whl
| Download URL | inotify_lite-0.0.6-py3-none-any.whl |
|---|---|
| Size | 23.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e479dee4a7632c3e0e23f83a7c7673e773ec2d5f5796588d31aa4b87d62db2b0
|
|
BLAKE2b-256 checksum How to use checksums |
f81b21970c88ba73c7fc8a5ce5ec15aa0f27d44d2a7f52bd48d841e06cd4dbbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5
|
Security for inotify-lite 0.0.6
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.