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.2.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.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for philiprehberger_file_watcher-0.1.2.tar.gz
Algorithm Hash digest
SHA256 819de4b39cfd5d222a32e95b59a548070b06137f04ea3d73e1259d19303804e3
MD5 d2ad59efef39c314b00a90b704f0108f
BLAKE2b-256 59792805be8798126f2497ac5eff839f407165f2d495cc4104c420cfe9ee38a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for philiprehberger_file_watcher-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 404a9ff82a5e53bad921d4d53f8c7c129da22ab3c21154b962325cae24028eb8
MD5 730c606aba5bfd74e89f30629533836e
BLAKE2b-256 295bc459ed87521041d1fa40ddaf3d2273d0c4f3eab064311a22f3b84318aefe

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