Skip to main content

Asyncio-powered inotify library

Project description

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)

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

asyncio.run(work())

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')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aionotify-0.3.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

aionotify-0.3.0-py2.py3-none-any.whl (7.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file aionotify-0.3.0.tar.gz.

File metadata

  • Download URL: aionotify-0.3.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for aionotify-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e4e5286a9c84a0b4b9e7f7a382589be196878382d6a3d34b3fcaa062cf4d428e
MD5 1c1e9be5973dedeee3c514e17286ed1f
BLAKE2b-256 0d13ce14b7c30633f479af58ff2b22d8fd88d923f58436319e7ec0633f9e638b

See more details on using hashes here.

File details

Details for the file aionotify-0.3.0-py2.py3-none-any.whl.

File metadata

  • Download URL: aionotify-0.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for aionotify-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 dbf16208c958263db24596d12798dc743a99650514d9e79d1d533045104810db
MD5 dc6090a531726039b86cbc520802805f
BLAKE2b-256 87a01ec32fb3285e4c1fe81d9d028dc38646b4e1b7221aba445299e2e15bd404

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page