Skip to main content

Watches a directory for file changes.

Project description

# Grigori

Grigori is a small Python 3 module that watches over your files and notifies you of changes.

## Usage

There are currently 2 ways you can use Grigori, with a for loop, or with callbacks.

**For loops**

For the complete example, see `/examples/basic.py`.

```python
w = Watcher(directory)

for changes in w.watch():
for change in changes:
print("file '%s' has been changed in the following way: '%s'" % (change["file"], change["type"]))
```

**Callbacks**

For the complete example, see `/examples/callbacks.py`.

```python
w = Watcher("./directory/to/watch")

# Bind the callbacks.
w.on(Change.ADDED, on_added)
w.on(Change.MODIFIED, on_modified)
w.on(Change.DELETED, on_deleted)

w.wait() # Start watching the files.
```

## To Do

Allow for watching multiple top-level directories, which will be each watched in threads using a thread pool.

Add `inotify` support.

Add Handler classes that can be used instead of for loops or callbacks.


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

Grigori-1.0.1.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

Grigori-1.0.1-py3-none-any.whl (4.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page