Metadata-Version: 2.4
Name: philiprehberger-file-watcher
Version: 0.1.2
Summary: Filesystem event watcher with decorator-based callbacks
Project-URL: Homepage, https://github.com/philiprehberger/py-file-watcher#readme
Project-URL: Repository, https://github.com/philiprehberger/py-file-watcher
Project-URL: Issues, https://github.com/philiprehberger/py-file-watcher/issues
Project-URL: Changelog, https://github.com/philiprehberger/py-file-watcher/blob/main/CHANGELOG.md
Author: Philip Rehberger
License-Expression: MIT
License-File: LICENSE
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: watchdog>=3.0
Description-Content-Type: text/markdown

# philiprehberger-file-watcher

[![Tests](https://github.com/philiprehberger/py-file-watcher/actions/workflows/publish.yml/badge.svg)](https://github.com/philiprehberger/py-file-watcher/actions/workflows/publish.yml)
[![PyPI version](https://img.shields.io/pypi/v/philiprehberger-file-watcher.svg)](https://pypi.org/project/philiprehberger-file-watcher/)
[![License](https://img.shields.io/github/license/philiprehberger/py-file-watcher)](LICENSE)

Filesystem event watcher with decorator-based callbacks.

## Install

```bash
pip install philiprehberger-file-watcher
```

## Usage

```python
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
