Track the changes into the filesystem and trigger callback on changes detecting.
Project description
Tree Guardian
Track the changes into the filesystem and trigger callback on changes detecting.
Getting Started
Installation
pip install tree-guardian
Usage (Python)
Observe the changes into your project.
from tree_guardian import observe
# Target function to trigger
def cb():
from time import time
print('[{}] Changes detected...'.format(time()))
observe(cb) # Run observer
Run in background.
from time import sleep
from threading import Event
from tree_guardian import observe
# Target function to trigger
def cb():
from time import time
print('[{}] Changes detected...'.format(time()))
event = Event()
observe(cb, run_async=True, event=event) # Run observer
# Type your code below...
try:
sleep(10) # Run for 10 seconds or until interrupted
except KeyboardInterrupt:
event.set()
Usage (Cli)
You can also use tree-guardian commands in shell. To make observe, run, for example:
tree-guardian-observe --command='[YOUR SHELL COMMAND HERE]'
This command supports the following params:
usage: tree-guardian-observe [-h] [-d] -c CALLBACK [-p PATH] [-e [EXCLUDE ...]]
Observe directory and trigger callback on change detection
optional arguments:
-h, --help show this help message and exit
-d, --debug run observe on debug mode; it also displays all trigger-command output
-c [CALLBACK_COMMAND ...], --cmd [CALLBACK_COMMAND ...], --command [CALLBACK_COMMAND ...], --callback [CALLBACK_COMMAND ...], --callback-command [CALLBACK_COMMAND ...]
trigger command
-p PATH, --path PATH the observable root path
-e [EXCLUDE ...], --exclude [EXCLUDE ...]
excluded files from observe
Call it with --help
flag to get more details.
tree-guardian-observe --help
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tree_guardian-0.2.0.tar.gz
(5.8 kB
view details)
File details
Details for the file tree_guardian-0.2.0.tar.gz
.
File metadata
- Download URL: tree_guardian-0.2.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c21184458f256581c4a9c83e16354d1151a84ff7622e63dc4c9c62a758e6540 |
|
MD5 | 578ee31dd0bf1fb8acc8dd98a38ff82b |
|
BLAKE2b-256 | 3f9bc05e7ceb9280af5274a4b9bbd0da5f5adce7ec06f6a5a7fd4fd1fbd73f69 |