Skip to main content

No project description provided

Project description

Directory Observer

(Windows only) The package implements an observable to monitor directory changes, and to notify observers when a change is detected. The observable is running in a separate daemon thread, and is being locked while there are no changes (non-busy-waiting).

Installation

python3 -m pip install directory-observer

Usage Examples

from directory_observer import DirectoryObservable


def update(path: str):
    # Handle change in path

# Initialize Observable with update() as observer function
observable = DirectoryObservable(path, observers=[update])
observable.start()  # Start observable thread

observable.remove_observer(update) # Remove observer
observable.add_observer(update) # Add new observer

observable.stop()  # Stop observable thread
# Use "with" statement to call start() and stop()
with DirectoryObservable(path, observers=[update]) as observable:
    # Observe directory in this section

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

directory_observer-1.0.1.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

directory_observer-1.0.1-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

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