Very thin inotify(7) wrapper for Linux.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simple_inotify-0.0.1.tar.gz.
File metadata
- Download URL: simple_inotify-0.0.1.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db44e3ae7b90ecc86d600e9e28c0bde4d17a7b38fc4b058367c712fc918ab75b
|
|
| MD5 |
2b635248c4b5a857f86c8ccbb324dea8
|
|
| BLAKE2b-256 |
8f8be53af0cc0b72f2c226cc9dd80d44b9325713632e9da43f0fe04fdfc8be34
|
Provenance
The following attestation bundles were made for simple_inotify-0.0.1.tar.gz:
Publisher:
python-publish.yml on USN484259/simple-inotify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_inotify-0.0.1.tar.gz -
Subject digest:
db44e3ae7b90ecc86d600e9e28c0bde4d17a7b38fc4b058367c712fc918ab75b - Sigstore transparency entry: 729595391
- Sigstore integration time:
-
Permalink:
USN484259/simple-inotify@21fd787c42b6272ad8ab7ced2c2d46163c268ac6 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/USN484259
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@21fd787c42b6272ad8ab7ced2c2d46163c268ac6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file simple_inotify-0.0.1-py3-none-any.whl.
File metadata
- Download URL: simple_inotify-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
949dc94337394d153b0f6e34e9269bfbcfb8152087872db03be8d62263a0673a
|
|
| MD5 |
6cf36860e4e1bf3532138a7ad4aa1090
|
|
| BLAKE2b-256 |
e54482f910e0d0737ce6ef78141e6b3186f18e2afc418a1c2c8c463854bf3531
|
Provenance
The following attestation bundles were made for simple_inotify-0.0.1-py3-none-any.whl:
Publisher:
python-publish.yml on USN484259/simple-inotify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_inotify-0.0.1-py3-none-any.whl -
Subject digest:
949dc94337394d153b0f6e34e9269bfbcfb8152087872db03be8d62263a0673a - Sigstore transparency entry: 729595395
- Sigstore integration time:
-
Permalink:
USN484259/simple-inotify@21fd787c42b6272ad8ab7ced2c2d46163c268ac6 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/USN484259
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@21fd787c42b6272ad8ab7ced2c2d46163c268ac6 -
Trigger Event:
release
-
Statement type: