PatrolTrigger
Trigger custom commands from filesystem events.
Patrol uses libuv, which creates event driven hooks to filesystem events using epoll, kqueue or IOCP.
You can use it to selectively build your project when files change and run tests as soon as you hit the save button.
Use
To install:
sudo pip install patroltrigger
Create a patrol.py file in your project’s root directory:
#!/usr/bin/python
from patroltrigger import runnable, run, trigger
@trigger(["*.py", ], exclude=['venv/*',])
def trigger1(filenames):
print "trigger1"
run("""echo first command triggered""")
the_output_is_in_this_variable_though = run("echo this command is run, but the output is not displayed", silent=True)
@trigger(["*.py", ], exclude=['venv/*',])
def trigger2(filenames):
print "trigger2 command triggered with filename: {}".format(', '.join(filenames))
run("false", ignore_errors=True) # If ignore_errors=False, nothing further will be executed.
run("""echo if ignore_errors is False or not specified, you wont ever see this command *or* the results of trigger3.""")
@trigger(["*.py", ], exclude=['venv/*',])
def trigger3(filenames):
print "trigger3 command triggered with filename: {}".format(', '.join(filenames))
runnable(__name__)
Run like so:
$ python patrol.py
Or get help:
$ python patrol.py --help
Usage: patrol.py [options]
Options:
-h, --help show this help message and exit
-r RUN, --run=RUN Specify a method in patrol.py to run directly.
-a, --all Run all methods in patrol.py in priority order.
-p POST, --post=POST Command to run after a trigger (e.g. guake)
-d DIRECTORY, --directory=DIRECTORY
Directory to run patrol.py in (default:
/home/user/yourproject).
Features
If multiple methods are triggered by a changed file, they will run in the order they appear in patrol.py.
Queue up triggers by putting a file named ‘lock’ in the directory patrol.py is run from. Once ‘lock’ is removed, the pent up triggers will all be fired.
Each time a set of methods are triggered, the total run time is timed.
If a command fails (e.g. a unit test), the method is aborted by default at that point to shorten feedback time. Subsequent methods will not run.
Run a custom command after each method is finished (e.g. guake, notify-send).
Ability to run commands manually.
Metadata
Release files for patroltrigger 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| patroltrigger-0.3.tar.gz | 5.2 kB | Without provenance | Details for patroltrigger-0.3.tar.gz |
Release files / patroltrigger-0.3.tar.gz
| Download URL | patroltrigger-0.3.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6512f6f5426e9d407b66d4f7b8d9d174dc7ba21c746898a3d6aa3aac48a7f16c
|
|
BLAKE2b-256 checksum How to use checksums |
b009d9d5eb0e623c10356260b3f3a000ce1db21ba0a050f986b813e290811ba8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for patroltrigger 0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.