Skip to main content

Filesystem event watcher with decorator-based callbacks

Project description

philiprehberger-file-watcher

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.1.tar.gz (3.5 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.1-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for philiprehberger_file_watcher-0.1.1.tar.gz
Algorithm Hash digest
SHA256 33b4ee18b5a734ce230c599c35d8f9ff775888329ac6b0cb690bbcb9301768ce
MD5 fb38d39982d70b6a351f65d6c46bd6cd
BLAKE2b-256 b1909626d5d236dd0f4108d434e63d63a17e81932a735006a87ca750046d86fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for philiprehberger_file_watcher-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fb6acebd84a065ad5c7b5772529e4b3a45dbdf8b278a21071e275e00b966cb11
MD5 7e4a63eb9ab194e105e21813ab6751cb
BLAKE2b-256 3e703617761a3edbaff48bf6cf0e774a4155d50a63f1aa3cd8a20e5bca2da632

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