• Stars
    star
    116
  • Rank 303,894 (Top 6 %)
  • Language
    Python
  • License
    BSD 2-Clause "Sim...
  • Created over 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple, asyncio-based inotify library for Python

aionotify

https://secure.travis-ci.org/rbarrois/aionotify.png?branch=master Latest Version Supported Python versions Wheel status License

aionotify is a simple, asyncio-based inotify library.

Its use is quite simple:

import asyncio
import aionotify

# Setup the watcher
watcher = aionotify.Watcher()
watcher.watch(alias='logs', path='/var/log', flags=aionotify.Flags.MODIFY)

# Prepare the loop
loop = asyncio.get_eventloop()

async def work():
    await watcher.setup(loop)
    for _i in range(10):
        # Pick the 10 first events
        event = await watcher.get_event()
        print(event)
    watcher.close()

loop.run_until_completed(work())
loop.stop()
loop.close()

Links

Events

An event is a simple object with a few attributes:

  • name: the path of the modified file
  • flags: the modification flag; use aionotify.Flags.parse() to retrieve a list of individual values.
  • alias: the alias of the watch triggering the event
  • cookie: for renames, this integer value links the "renamed from" and "renamed to" events.

Watches

aionotify uses a system of "watches", similar to inotify.

A watch may have an alias; by default, it uses the path name:

watcher = aionotify.Watcher()
watcher.watch('/var/log', flags=aionotify.Flags.MODIFY)

# Similar to:
watcher.watch('/var/log', flags=aionotify.Flags.MODIFY, alias='/var/log')

A watch can be removed by using its alias:

watcher = aionotify.Watcher()
watcher.watch('/var/log', flags=aionotify.Flags.MODIFY)

watcher.unwatch('/var/log')

More Repositories

1

python-semanticversion

Semantic version comparison for Python (see http://semver.org/)
Python
266
star
2

xworkflows

Python "state machine" module
Python
188
star
3

django_xworkflows

Library to plug xworkflows into django models.
Python
106
star
4

throttle

UNMAINTAINED - A simple Python throttling lib relying on the token bucket algorithm
Python
38
star
5

mpdlcd

A small tool to display MPD status on a lcdproc server
Python
31
star
6

python-ldap

Git mirror of http://sourceforge.net/p/python-ldap/code/, predecessor of github.com/pyldap/pyldap
Python
28
star
7

inputexec

Simple program to execute commands on keypress on headless Linux
Python
21
star
8

nss-systemcerts

Create a system-wide NSS certificate database (https://wiki.mozilla.org/NSS) based on system-wide certificates (/etc/ssl/certs)
Shell
12
star
9

restricted_pkg

[OBSOLETE] Enforcing use of a private PyPI mirror in your setup.py script
Python
10
star
10

yubico-yubiserve

Standalone Yubico validation server
Python
10
star
11

tdparser

An easy to use parser library for Python, based on the TopDown parsing algorithm.
Python
10
star
12

fslib

Python wrapper around low-level FS-related calls, with support for advanced FS stacking
Python
8
star
13

volatildap

Temporary LDAP server launcher for testing purposes
Python
7
star
14

kconfgen

A generator of (minimal) Linux kernel configuration files.
Python
5
star
15

django-batchform

Generic view to fill a batch of identical forms from the cells of an uploaded file (csv/xlsx/odt).
Python
4
star
16

djadmin_export

Flexible export actions for Django admin
Python
4
star
17

django-shareddb

Faster tests in multi-thread, single control flow setups
Python
4
star
18

pydist

Tools to auto-convert Python modules into debian/gentoo packages
Python
4
star
19

bicti

Simple startup tool for docker containers
Python
2
star
20

python-inspector

Extensions to Python inspect.py module.
Python
2
star
21

confutils

Enhanced configuration file related tools for Python
Python
1
star
22

djpyro

Django/Pyro adapter, intended for remote control (e.g. integration testing)
Python
1
star
23

extypes

Enhancements over Python's standard types
Python
1
star
24

django-registration

Forked from https://bitbucket.org/ubernostrum/django-registration
Python
1
star
25

cliform

Convert a Django Form to an interactive command line prompt
Python
1
star
26

portage-mod_jabber

A XMPP elog module for Gentoo portage, based on http://svn.usrportage.de/portage-mod_jabber/. Fully rewritten.
Python
1
star
27

quern

Versatile image builder, targeting embedded systems, bare-metal servers and containers.
Python
1
star