Patrol
Trigger methods from changed files - e.g. selectively rebuild your project or run tests as soon as you hit the save button on your text editor or IDE.
Patrol works well with ProjectKey.
Use
To install:
pip install patrol
Example code:
import patrol
def build(filenames):
touch("output/build_started")
time.sleep(2)
touch("output/build_finished")
def run_test(filenames):
touch("output/test_started")
time.sleep(30)
touch("output/test_finished")
patrol.watch([
patrol.Trigger(
build,
includes=["data/*", ],
excludes=['data/exclude/*', 'output/*', ],
),
patrol.Trigger(
run_test,
includes=["data/*", ],
excludes=['data/exclude/*', 'output/*', ],
reaper=patrol.Reaper(), # If triggered while method is in progress, this will stop it and start it again.
fire_on_initialization=True, # When the watch is initiated, this trigger will also fire.
),
],
directory=os.getcwd(), # By default it patrols the present working directory.
lockfiles=[".git/index.lock", ], # This will wait until git has finished its operations before firing any triggers
)
Features
Patrol does not use polling to detect file changes. It uses libuv, which creates event driven hooks to filesystem events using epoll, kqueue or IOCP.
You can queue up triggers when a specified lockfile is present - e.g. you can use to prevent triggers from firing until git operations are done.
Patrol comes with a customized Reaper class that can be used to specify how a process is stopped.
Metadata
Release files for patrol 0.3.1
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 |
|---|---|---|---|---|
| patrol-0.3.1.tar.gz | 5.6 kB | Without provenance | Details for patrol-0.3.1.tar.gz |
Release files / patrol-0.3.1.tar.gz
| Download URL | patrol-0.3.1.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
47534ed32c5ff85f8b2f067fbc3aa0a6361f6c751414915ba225f9e3875b7331
|
|
BLAKE2b-256 checksum How to use checksums |
a725e9f2d078a668f966c8cb3ad557b77e4bb3cf5d3d65152ffffa9df99c8082
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for patrol 0.3.1
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.