Skip to main content

HitchTrigger

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

Use

import hitchtrigger

monitor = hitchtrigger.Monitor(
    "/path/to/project.watch"
    #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(
    "virtualenv",
    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

        Path("venv").rmtree(ignore_errors=True)
        virtualenv("venv").run()
        pip("install", "-r", "requirements.txt").run()
        pip("freeze").stdout(Path("freeze.txt")).run()
        pip("install", "dev_requirements.txt").run()

Metadata

Release files for hitchtrigger 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hitchtrigger 0.2
File Size Uploaded Provenance Actions
hitchtrigger-0.2.tar.gz 5.7 kB Without provenance Details for hitchtrigger-0.2.tar.gz

Release files / hitchtrigger-0.2.tar.gz

Download URL hitchtrigger-0.2.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
413c5da2b11dc7d46df0ae94a3961879aef3a6cb10a6682611cad9868060b9e3
BLAKE2b-256 checksum
How to use checksums
1fc63338cdd98afa5307a750e95e3e96a6ac0caae7826addd8775afa41e49e1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for hitchtrigger 0.2

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.

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page