Command-line executable Python script to re-run the given command every timefiles are modified in the current directory or its subdirectories.
Project description
Usage
rerun [--help|-h] [--verbose|-v] [--ignore|-i=<file>] [--version] <command>
Where:
<command> Command to execute --help|-h Show this help message and exit. --ignore|-i=<file> File or directory to ignore. Any directories of the given name (and their subdirs) are excluded from the search for changed files. Any modification to files of the given name are ignored. The given value is compared to basenames, so for example, "--ignore=def" will skip the contents of directory "./abc/def/" and will ignore file "./ghi/def". Can be specified multiple times. --verbose|-v Display the names of changed files before the command output. --version Show version number and exit.
Description
Rerun detects changes to files by polling file modification times once per second. It looks in the current directory and all its subdirectories. On detecting any changes, it clears the terminal and reruns the given command.
It always ignores directories called .svn, .git, .hg, .bzr, build and dist.
It always ignores files ending with .pyc or .pyo.
e.g:
rerun python -m unittest mypackage.mymodule
will rerun your tests every time you save your source code, but it won’t rerun the tests a second time when .pyo files get updated as a result of executing the tests. Handy for seeing the new test results in another console window after you hit ‘save’ in your editor, without having to change window focus.
Dependencies
Tested on MacOSX, Ubuntu, WindowsXP, Windows 7.
Tested under Python2.7 or 3.2. May run under Python 2.6 or older with PyPI package ‘argparse’ installed.
No other dependencies.
Install
pip install rerun
Known Problems
Polling for modification times perhaps isn’t ideal. Registering of OS-specific notifications of file system events might be better. In practice though, I haven’t noticed it burden my machine in directories containing hundreds of files.
It might be handy if ‘–ignore’ accepted globs, e.g. “*.tmp”
See issues at https://bitbucket.org/tartley/rerun/issues?status=new&status=open
Alternatives
PyPI package ‘watchdog’ is a cross-platform library for handling file-system events, which includes script ‘watchmedo’, which looks like a more serious and heavy-duty version of ‘Rerun’.
Thanks
The idea came from the Bash command ‘watch’, and inspiration for this implementation came from an old blog post by Jeff Winkler, whos website http://jeffwinkler.net seems to have now died.
Contact
- Documentation & download:
- Souce code and issues:
- Contact the author:
Jonathan Hartley, email: tartley at domain tartley.com, Twitter: @tartley.
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 Distributions
File details
Details for the file rerun-1.0.16.zip
.
File metadata
- Download URL: rerun-1.0.16.zip
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0db8835c2d8b563e5e3097c4fa05db80fe72e7e0770030ef7646d0d8a816bed1 |
|
MD5 | 35ea3a3e4165a22d587a772a08c4fcf5 |
|
BLAKE2b-256 | 80029d6b9e01b448e499b316d2dbbe066d3e0b46d7e6ec9611f280fa66a94362 |
File details
Details for the file rerun-1.0.16.tar.gz
.
File metadata
- Download URL: rerun-1.0.16.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b912235f5edb2b1cd7b80aa4057ce63312addda8b888b2d643440e0f08baaac |
|
MD5 | 1057157227d232045fff92f698defd3f |
|
BLAKE2b-256 | bb65e396e47ff1a3a916332207d4d6938e3886d64d465b3cf86beeca936d260d |