https://github.com/roma-glushko/notifykit
👀 A performant, cross-platform, modern Pythonic toolkit for building applications that need watching filesystem events
https://github.com/roma-glushko/notifykit
asyncio cross-platform filesystem fsevents inotify linux macos python python3
Last synced: 4 months ago
JSON representation
👀 A performant, cross-platform, modern Pythonic toolkit for building applications that need watching filesystem events
- Host: GitHub
- URL: https://github.com/roma-glushko/notifykit
- Owner: roma-glushko
- License: apache-2.0
- Created: 2023-09-06T17:38:58.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-02T11:52:37.000Z (over 1 year ago)
- Last Synced: 2024-10-10T19:39:26.887Z (9 months ago)
- Topics: asyncio, cross-platform, filesystem, fsevents, inotify, linux, macos, python, python3
- Language: Rust
- Homepage: https://notifykit.readthedocs.io/en/latest/
- Size: 708 KB
- Stars: 7
- Watchers: 3
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
👀 A cross-platform filesystem watcher toolkit for Python**notifykit** is a set of components for building modern Python applications with a need for watching filesystem events efficiently.
> [!Warning]
> notifykit is under active development right now## Installation
```bash
pip install notifykit
# or
poetry add notifykit
# or
pdm add notifykit
```notifykit is available for:
CPython 3.8-3.12 on the following platforms:
- **Linux**: x86_64, aarch64, x86, armv7, s390x, ppc64le, musl-x86_64, musl-aarch64
- **MacOS**: x86_64 & arm64
- **Windows**: x64 & x86PyPY 3.8-3.10 on the following platforms:
- **Linux**: x86_64 & aarch64
- **MacOS**: x86_64## Usage
```python
import asyncio
import os
from pathlib import Pathfrom notifykit import Notifier
async def watch(watched_dir: Path) -> None:
notifier = Notifier(debounce_ms=200, debug=True)
notifier.watch([watched_dir])async for event in notifier:
# process your events
print(event)if __name__ == "__main__":
watched_dir = Path("./watched_dir")
os.makedirs(watched_dir, exist_ok=True)asyncio.run(watch(watched_dir))
```## Features
- Simple Modern Pythonic API, both sync and async
- High Performance
- Cross-platform (support not only Linux, but also MacOS)
- Easy to mock in tests
- Makes common cases easy and advance cases possible## Sources of Inspiration
- https://github.com/seb-m/pyinotify/issues
- https://github.com/absperf/asyncinotify/
- https://docs.rs/notify/latest/notify/
- https://github.com/samuelcolvin/watchfiles
- https://github.com/pantsbuild/pants/tree/612e891e90432e994327b6ddaf57502366a714c0/src/rust/engine
- https://github.com/pola-rs/polars/blob/d0c8de592b71d4b934b1598926536f03e10007bd/py-polars/src/file.rs#L206
- https://github.com/TheoBabilon/async-tail/