Skip to main content

Inotify Recursive - Recursive inotify watches for Python

Inotify Recursive is a Python package that offers a simple way to watch a directory-tree recursively for file changes via the inotify functionality of the Linux kernel. It uses the inotify_simple package to set and remove the inotify watches and also incorporates its whole functionality. The package is written in Python and licensed as open-source under the LGPL version 3.

At the moment the main purpose of Inotify Recursive is to provide the file watching functionality for Synoindex Watcher, a small tool that automatically updates the media index of Synology DiskStations.

This Python package is still an alpha! Its core functionality has been tested and is working, but there could still be undiscovered bugs. Also breaking interface changes are likely to happen, so it is not recommended to use it in production projects, yet.

Features

  • Small About 150 lines of code (including comments)
  • Powerful All features of inotify_simple plus recursive watching
  • Agnostic Python 2 and Python 3 compatible (minimum tested version is 2.7)

Installation

The recommended installation method is via pip:

python -m pip install --upgrade inotifyrecursive

You can use the same command to upgrade Inotify Recursive from an older version.

This will also install its dependency inotify_simple.

Documentation

Please read the docs for inotify_simple first, since the basic usage is the same.

The INotify class of Inotify Recursive provides three additional methods, which are useful, if a directory shall be watched recursively:

inotify.add_watch_recursive(path, mask, filter = None)

  • path The path to watch
  • mask The mask of events to watch for
  • filter A function to ignore certain sub-directories

Returns the descriptor for the newly created watch of the directory where the given path points to. Unlike add_watch() this function also creates watches for all sub-directories below it. The descriptors of the sub-watches are not returned.

The filter function is optional. It takes the name of the file or directory and the descriptor of the watcher of the parent directory. The filter returns a boolean value, which describes whether the directory shall be watched (True) or ignored (False). If no filter is set, all files and sub-directories will be watched.

inotify.rm_watch_recursive(wd)

  • wd The watch descriptor to remove

Removes the watch with the given descriptor and all associated sub-watches. Should be used for any watch that has been created by add_watch_recursive().

inotify.get_path(wd)

  • wd The watch descriptor the path is fetched for

Returns the absolute path of the directory associated to the watch with given descriptor.


Copyright 2019,2020 Torben Haase <https://pixelsvsbytes.com>

Metadata

Release files for inotifyrecursive 0.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inotifyrecursive 0.3.5
File Size Uploaded Provenance
inotifyrecursive-0.3.5.tar.gz 4.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for inotifyrecursive 0.3.5
File Interpreter ABI Platform
inotifyrecursive-0.3.5-py3-none-any.whl Python 3 none any Details

Total release size: 12.6 kB

Release files / inotifyrecursive-0.3.5.tar.gz

Download URL inotifyrecursive-0.3.5.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a2c450b317693e4538416f90eb1d7858506dafe6b8b885037bd2dd9ae2dafa1e
BLAKE2b-256 checksum
How to use checksums
193a9ed038cb750a3ba8090869cf3ad50f5628077a936d911aee14ca83e40f6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

Release files / inotifyrecursive-0.3.5-py3-none-any.whl

Download URL inotifyrecursive-0.3.5-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e5f4a2e1dc2bef0efa3b5f6b339c41fb4599055a2b54909d020e9e932cc8d2f
BLAKE2b-256 checksum
How to use checksums
c7fc4e5a141c3f7c7bed550ac1f69e599e92b6be449dd4677ec09f325cad0955
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

Security for inotifyrecursive 0.3.5

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page