Skip to main content

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, unless given –ignore flags for user-specified ignores.

It always ignores files ending with .pyc or .pyo. This isn’t currently user-overrideable.

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

See issues at https://bitbucket.org/tartley/rerun/issues

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.

Thanks to Bitbucket user sgourley for reporting, chasing up and even offering to fix issue #1, an egregious bug in ignoring directories, before I finally spotted the error. Thanks for the prods!

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.17.zip (13.3 kB view details)

Uploaded Source

rerun-1.0.17.tar.gz (7.3 kB view details)

Uploaded Source

File details

Details for the file rerun-1.0.17.zip.

File metadata

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

File hashes

Hashes for rerun-1.0.17.zip
Algorithm Hash digest
SHA256 dc5b0be486d935ad661ad4f33960496a715c5481c3a0736bc912aba6a724b2fe
MD5 7ed758dfe282bc8b5d94daa5990c430f
BLAKE2b-256 a700a77210a4ed47db2dfd5535fc151685f917eb07e34835578e7e451eaaf284

See more details on using hashes here.

File details

Details for the file rerun-1.0.17.tar.gz.

File metadata

  • Download URL: rerun-1.0.17.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rerun-1.0.17.tar.gz
Algorithm Hash digest
SHA256 5a8dd2b1a92f2d84463262b449f729673b7007f9603e64aab7c86894ab461d7e
MD5 76b7d8c741e3cb45fd2ec6880398c9a6
BLAKE2b-256 e0af52a2caa5fbc6b5b4fd5d483f90d54c9666e3825d99cae969d42148f75a00

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