Skip to main content

Re-run the given command every time files are modified in the current directoryor 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.

Runs 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:

http://pypi.python.org/pypi/rerun/

Souce code and issues:

https://bitbucket.org/tartley/rerun

Contact the author:

Jonathan Hartley, email: tartley at domain tartley.com, twitter: tartley.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

rerun-1.0.11.alpha.zip (10.4 kB view details)

Uploaded Source

rerun-1.0.11.alpha.tar.gz (5.6 kB view details)

Uploaded Source

File details

Details for the file rerun-1.0.11.alpha.zip.

File metadata

  • Download URL: rerun-1.0.11.alpha.zip
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rerun-1.0.11.alpha.zip
Algorithm Hash digest
SHA256 3ba5c1f3c2e5b0f68cb9a6fa82667555c03b5849d5e4517f445405315686ef56
MD5 481b5cd70d9166df18b540ba83d4fba1
BLAKE2b-256 eaa6a7c4c1b179fa5f36808de372d15db7ed14704ff1f66d6e66eb49fb7c2d8d

See more details on using hashes here.

File details

Details for the file rerun-1.0.11.alpha.tar.gz.

File metadata

File hashes

Hashes for rerun-1.0.11.alpha.tar.gz
Algorithm Hash digest
SHA256 1ef775bedd20e3c37bdb201ef22685f76c745f93d9fb0a2219501373e49e4851
MD5 c0769981ee23eab6f4b568d974ffd529
BLAKE2b-256 2e7f2683c1fcb934a3fbb58df99675f6a3ffdf174cb1418c86a653c83fce1e6a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page