Skip to main content

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

Metadata

Release files for keepfresh 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for keepfresh 0.0.5
File Size Uploaded
keepfresh-0.0.5.tar.gz 4.1 kB Details

Release files / keepfresh-0.0.5.tar.gz

Download URL keepfresh-0.0.5.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4c5148f0116ca89ef35883a5d28424e33d7f23fb6fcb80f25159e1c33ce32e08
BLAKE2b-256 checksum
How to use checksums
6f984eb315bb14d1244df16b83a0b2ad14e8647082063377ec20661262ee383d
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.5 This release

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page