Skip to main content

Build tool to selectively run blocks of build commands under specified conditions

Project description

HitchTrigger is a self contained build tool designed to trigger blocks of build commands when a condition is met that necessitates a rebuild.

The conditions can be one or more combined of any of the following:

  • A file or files (e.g. source files) have changed.
  • A specified (build) directory did not exist.
  • A period of time has elapsed.
  • A ‘watched’ variable has changed its value.
  • An exception occurred the previous time the commands were run (always by default).

To install from pypi:

$ hitch install hitchtrigger


import hitchtrigger

monitor = hitchtrigger.Monitor(
    #override=["virtualenv", ],

# Will run in the following cases:
## The command block has never been run before.
## An exception was triggered within the context manager on the previous run.
## venv directory is non-existent.
## A period of 7 days has elapsed
## A previous block named 'previousblock' was run.
## Either requirements.txt or dev_requirements.txt have been modified (file modification dates are monitored).
## Var "v=1" is changed (e.g. to "v=2").
## The line 'override=["virtualenv", ]' is uncommented.

with monitor.block(
    monitor.nonexistent("venv") | monitor.not_run_since(days=7) | monitor.was_run("previousblock")
    monitor.modified(["requirements.txt", "dev_requirements.txt"]) | monitor.var(v=1)
).context() as trigger:
    if trigger:
        print(trigger.why)  # Prints out reason for running

        pip("install", "-r", "requirements.txt").run()
        pip("install", "dev_requirements.txt").run()

Project details

Release history Release notifications | RSS feed

This version


Download files

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

Files for hitchtrigger, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size hitchtrigger-0.2.tar.gz (5.7 kB) File type Source Python version None Upload date Hashes View

Supported by

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