libfilewatcher
Cross-platform file system watcher for real-time monitoring
Install
pip install libfilewatcher
Usage
from libfilewatcher import FileWatcher, FileWatcherEvent
watcher = FileWatcher(root_dir="/path/to/watch")
def on_file_change(event: FileWatcherEvent):
print(f"File {event.event_type}: {event.file}")
watcher.add_callback(on_file_change)
watcher.start()
# Or use async
import asyncio
event = await watcher.get_event(timeout=5.0)
API
FileWatcherEvent
Dataclass representing a file system event.
file: str— Absolute path to the fileevent_type: str— One of "add", "change", "unlink"
FileWatcher
Main class for watching file system changes.
FileWatcher(
root_dir: str | None = None,
ignore_patterns: list[str] | None = None,
enabled: bool = True,
)
Methods:
start()— Start watchingstop()— Stop watchingadd_callback(callback)— Add event callbackremove_callback(callback)— Remove callbackasync get_event(timeout)— Get next eventis_running— Property checking if watcher is active
FileWatcherManager
Manage multiple watchers.
manager = FileWatcherManager()
watcher = manager.create_watcher("name", root_dir="...")
manager.start_all()
manager.stop_all()
CLI
# Watch current directory
libfilewatcher watch
# Watch specific directory
libfilewatcher watch /path/to/directory
# Watch with ignore patterns
libfilewatcher watch /path/to/directory --ignore "*.log" --ignore "*.tmp"
Development
git clone https://github.com/daedalus/libfilewatcher.git
cd libfilewatcher
pip install -e ".[test]"
# run tests
pytest
# format
ruff format src/ tests/
# lint
ruff check src/ tests/
# type check
mypy src/
Metadata
Release files for libfilewatcher 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| libfilewatcher-0.1.0.tar.gz | 6.6 kB | Without provenance | Details for libfilewatcher-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| libfilewatcher-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for libfilewatcher-0.1.0-py3-none-any.whl |
Total release size: 14.8 kB
Release files / libfilewatcher-0.1.0.tar.gz
| Download URL | libfilewatcher-0.1.0.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fdb24296afa07726dc7e97f82e1c1a5aaf59431c9319c43d828787e3093c915c
|
|
BLAKE2b-256 checksum How to use checksums |
fc2830dda2a0db77b43a1a7b25c4755434555d56d9be263359b7ccb17432ba94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / libfilewatcher-0.1.0-py3-none-any.whl
| Download URL | libfilewatcher-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7679dd6182e105b7b13a5ad3dddee3a36717b5d60a614800ec1e31e65501510a
|
|
BLAKE2b-256 checksum How to use checksums |
40bf69512ec5a13e6bb62d51ac8f7a6fa7eacc1e32e35d3035db55cc78c9294e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for libfilewatcher 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.