Skip to main content

Filesystem event watcher with decorator-based callbacks

Project description

philiprehberger-file-watcher

Tests PyPI version License

Filesystem event watcher with decorator-based callbacks.

Install

pip install philiprehberger-file-watcher

Usage

from philiprehberger_file_watcher import Watcher

watcher = Watcher("./src")

@watcher.on("created", pattern="*.py")
def on_new_python_file(event):
    print(f"New file: {event.path}")

@watcher.on("modified", pattern="*.css")
def on_css_change(event):
    print(f"CSS changed: {event.path}")

@watcher.on("any")
def on_anything(event):
    print(f"{event.type}: {event.path}")

# Blocking
watcher.start()

# Or background mode
watcher.start(background=True)
# ... do other work ...
watcher.stop()

Event Types

"created", "modified", "deleted", "moved", "any"

Options

Option Default Description
recursive True Watch subdirectories
debounce 0.5 Debounce interval in seconds

License

MIT

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

philiprehberger_file_watcher-0.1.3.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

philiprehberger_file_watcher-0.1.3-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file philiprehberger_file_watcher-0.1.3.tar.gz.

File metadata

File hashes

Hashes for philiprehberger_file_watcher-0.1.3.tar.gz
Algorithm Hash digest
SHA256 500f50e9be89568573cdcc78905bc5b1501eccdfb0fb6bfe367fc4f5897f998f
MD5 f20d43c14bebf719d0b60464b21e1623
BLAKE2b-256 d96994a487640e75a5881da3bfeb0ebf6639c96e1000c45b784269143555f362

See more details on using hashes here.

File details

Details for the file philiprehberger_file_watcher-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for philiprehberger_file_watcher-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 288e97e72f82275b332fd45ecc29d4b65a6356d468caf5ff3e69b1e9f16b1701
MD5 541fb5a6ef309304b21574cb600161eb
BLAKE2b-256 df5d7d98c50bb777c3acfe5b970c65ed3bc164fe697e822aef11abe7aa67519a

See more details on using hashes here.

Supported by

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