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.

Files for Grigori, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size Grigori-1.0.1-py3-none-any.whl (4.2 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size Grigori-1.0.1.tar.gz (3.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page