gevent_inotifyx
Gevent-compatible low-level inotify bindings based on inotifyx.
Python 2 and 3 compatible
Exposes a low-level inotify(7) API
Allows to wait for events in a non-blocking way when using gevent.
Installation
$ pip install gevent_inotifyx
From source:
$ python setup.py install
To run the tests:
$ python setup.py test
Examples
Watch a directory while creating new files. This prints
event: test.txt IN_CLOSE|IN_CLOSE_WRITE|IN_ALL_EVENTS
every second:
#!/usr/bin/env python
from __future__ import print_function
import os
import gevent
import gevent_inotifyx as inotify
def create_file_events():
"""Open and close a file to generate inotify events."""
while True:
with open('/tmp/test.txt', 'a'):
pass
gevent.sleep(1)
def watch_for_events():
"""Wait for events and print them to stdout."""
fd = inotify.init()
try:
wd = inotify.add_watch(fd, '/tmp', inotify.IN_CLOSE_WRITE)
while True:
for event in inotify.get_events(fd):
print("event:", event.name, event.get_mask_description())
finally:
os.close(fd)
if __name__ == '__main__':
tasks = [
gevent.spawn(watch_for_events),
gevent.spawn(create_file_events),
]
gevent.joinall(tasks)
License
gevent_inotifyx is licensed under the MIT License. See the included file LICENSE for details.
Metadata
Release files for gevent_inotifyx 0.2
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 |
|---|---|---|---|---|
| gevent_inotifyx-0.2.tar.gz | 8.3 kB | Without provenance | Details for gevent_inotifyx-0.2.tar.gz |
Release files / gevent_inotifyx-0.2.tar.gz
| Download URL | gevent_inotifyx-0.2.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39ad04c8b26d8c8075faac8f4b1d6cb863dd37d85c15ac426ba2d551855ac978
|
|
BLAKE2b-256 checksum How to use checksums |
0b11cfd16b1cb00114806b94d5e800bcbca319ae78022d00439e63d3011be6f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for gevent_inotifyx 0.2
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.