Simple inotify
Very thin inotify(7) wrapper for Linux.
- Pure Python, depends on ctypes in standard library, no other dependencies
- Simply group and expose the underlying syscall, Linux specific
- Only simple event parsing, no complex event model or worker thread
- No recursive watching support, the same as the underlying syscall
- Supports non-blocking mode and get the fd, to be polled in your event loop
Example
from simple_inotify import *
observer = Inotify()
wd = ovserver.add_watch("/tmp")
while True:
events = observer.read()
for ev in events:
print(ev)
API reference
The import module name is simple_inotify
Please refer to inotify(7) for details
inotify_event
inotify_event = namedtuple("inotify_event", ("wd", "mask", "cookie", "len", "name"))
class Inotify
Inotify class thar wraps inotify functions.
init(self, flags = 0)
Initializer, calling inotify_init1(2) with flags and holds the returned fd. Available flags are IN_CLOEXEC and IN_NONBLOCK.
close(self)
Calling close(2) on the inotify fd.
fileno(self)
Gets the underlying inotify fd, could be used to poll(2) elsewhere.
add_watch(self, path, /, mask = IN_ALL_EVENTS)
Calling inotify_add_watch(2) to register a new watch item, returns the watch descriptor.
rm_watch(self, wd)
Calling inotify_rm_watch(2) with given wd to unregister a watch.
get(self, wd)
Gets the path used to register the watch wd, returns None if not known.
read(self)
Calling read(2) on the inotify fd and parse the results. Returns a list of inotify_event. If the IN_NONBLOCK flag is set, returns an empty list if there is no new data.
constants
- IN_ACCESS
- IN_MODIFY
- IN_ATTRIB
- IN_CLOSE_WRITE
- IN_CLOSE_NOWRITE
- IN_OPEN
- IN_MOVED_FROM
- IN_MOVED_TO
- IN_CREATE
- IN_DELETE
- IN_DELETE_SELF
- IN_MOVE_SELF
- IN_UNMOUNT
- IN_Q_OVERFLOW
- IN_IGNORED
- IN_CLOSE
- IN_MOVE
- IN_ONLYDIR
- IN_DONT_FOLLOW
- IN_EXCL_UNLINK
- IN_MASK_CREATE
- IN_MASK_ADD
- IN_ISDIR
- IN_ONESHOT
- IN_ALL_EVENTS
- IN_CLOEXEC
- IN_NONBLOCK
Reference
Metadata
Release files for simple-inotify 0.0.1
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 |
|---|---|---|---|---|
| simple_inotify-0.0.1.tar.gz | 4.4 kB | With provenance | Details for simple_inotify-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| simple_inotify-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for simple_inotify-0.0.1-py3-none-any.whl |
Total release size: 9.7 kB
Release files / simple_inotify-0.0.1.tar.gz
| Download URL | simple_inotify-0.0.1.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db44e3ae7b90ecc86d600e9e28c0bde4d17a7b38fc4b058367c712fc918ab75b
|
|
BLAKE2b-256 checksum How to use checksums |
8f8be53af0cc0b72f2c226cc9dd80d44b9325713632e9da43f0fe04fdfc8be34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2025.
Transparency logRelease files / simple_inotify-0.0.1-py3-none-any.whl
| Download URL | simple_inotify-0.0.1-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
949dc94337394d153b0f6e34e9269bfbcfb8152087872db03be8d62263a0673a
|
|
BLAKE2b-256 checksum How to use checksums |
e54482f910e0d0737ce6ef78141e6b3186f18e2afc418a1c2c8c463854bf3531
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2025.
Transparency logSecurity for simple-inotify 0.0.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for simple_inotify-0.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2025.
Transparency logA 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.