Filesystem event polling
Project description
KeepFresh
A command line interface for polling changes in a directory and either logging or triggering a termination and restart of a provided command. Watchdogs' utility tool watchmedo should be used as opposed to this. This was created due to lack of Watchdog documentation regarding running the tool in CLI with the polling mode.
This was developed for the usecase of hot-reloading in a Docker container where the host has a volume mount in the container.
Currently the provided directory is searched recursively for all file types, with the ability to ignore certain directories, and to consider either all file types, or specific file types.
Installation
pip install keepfresh
Which will install keepfresh
as a command.
Usage
usage: keepfresh [-h] [-d D] [-e E [E ...]] [-x X [X ...]]
{log,auto-restart} ...
optional arguments:
-h, --help show this help message and exit
-d D Directory (if not specified, defaults to current directory)
-e E [E ...] Excluded directories
-x X [X ...] File extensions to watch (if not specified, all are watched)
actions:
{log,auto-restart}
log Run the logging monitor
auto-restart Run the command auto-restarter
Examples
Usage for logging event changes: (This example logs any changes in the current directory ('.') at a 1 second polling interval, we haven't specified filetypes or excluded directories, so all are watched)
$ keepfresh log -i 1 -d .
Usage for auto-restarting a command: (This example polls the current directory. No directory is specified, so it defaults to the current directory. -c is the command to terminate and restart when changes are detected)
$ keepfresh auto-restart -c echo "Hello World"
If you only want to consider certain file types, use the x
parameter
(This example polls every second in the current directory with logging, but only looks at .py and .txt files
$ keepfresh log -i 1 -x py txt
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
File details
Details for the file keepfresh-0.0.5.tar.gz
.
File metadata
- Download URL: keepfresh-0.0.5.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0.post20200106 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c5148f0116ca89ef35883a5d28424e33d7f23fb6fcb80f25159e1c33ce32e08 |
|
MD5 | 6aecebdc66831eb359479e28d3ef7abb |
|
BLAKE2b-256 | 6f984eb315bb14d1244df16b83a0b2ad14e8647082063377ec20661262ee383d |