Skip to main content

Extends pythonic task management & command execution with file dependencies.

Project description

Extends pythonic task management & command execution with file dependencies.

Latest Version on PyPI Supported Implementations

Documentation

pyinvokedepends is an extension of pyinvoke to allow more "makefile" like task definitions.

It introduces an additional decorator @depends which can be used in addtion to pyinvoke's decorator @task. Adding this decorator to a task will make sure that the task is only executed when any of to files is newer than one of the created files.

For a simple example, consider the following tasks.py. In contrast to traditional make, this will always run gcc hello.c

from invoke import task
@task
def compile(c):
  c.run("gcc hello.c", echo=True)

With pyinvokedepends we can add dependencies:

from invoke import task
from pyinvokedepends import depends
@depends(on=["./hello.c"], creates=["./a.out"])
@task
def test(c):
def compile(c):
  c.run("gcc hello.c", echo=True)

The task will only execute if the file ./hello.c is newer than the file ./a.out. Otherwise, the execution will be skipped.

The values of the parameters on and creates are lists of globs. At lease one the files matching (one of) the on globs must exist. The task is executed

  • if no file exists which matches (any of) the creates globs, or
  • one of the files matching the on globs is newer than at least one file of the creates globs.

It does not automatically add pre or post steps to the task based on the dependencies.

Project details


Download files

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

Files for pyinvokedepends, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size pyinvokedepends-1.0.0-py3-none-any.whl (5.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pyinvokedepends-1.0.0.tar.gz (3.3 kB) File type Source Python version None Upload date Hashes View

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 Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page