Skip to main content

Trigger custom commands from filesystem events.

Project description


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.


To install:

pip install patrol

Example code:

import patrol

def build(filenames):

def run_test(filenames):
            includes=["data/*", ],
            excludes=['data/exclude/*', 'output/*', ],
            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


  • 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.

Project details

Download files

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

Source Distribution

patrol-0.3.1.tar.gz (5.6 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page