Pythonic task execution
Project description
To find out what’s new in this version of Invoke, please see the changelog.
Invoke is a Python (2.7 and 3.4+) task execution tool & library, drawing inspiration from various sources to arrive at a powerful & clean feature set.
Like Ruby’s Rake tool and Invoke’s own predecessor Fabric 1.x, it provides a clean, high level API for running shell commands and defining/organizing task functions from a tasks.py file:
from invoke import task @task def clean(ctx, docs=False, bytecode=False, extra=''): patterns = ['build'] if docs: patterns.append('docs/_build') if bytecode: patterns.append('**/*.pyc') if extra: patterns.append(extra) for pattern in patterns: ctx.run("rm -rf {}".format(pattern)) @task def build(ctx, docs=False): ctx.run("python setup.py build") if docs: ctx.run("sphinx-build docs docs/_build")
From GNU Make, it inherits an emphasis on minimal boilerplate for common patterns and the ability to run multiple tasks in a single invocation:
$ invoke clean build
Where Fabric 1.x considered the command-line approach the default mode of use, Invoke (and tools built on it) are equally at home embedded in your own Python code or a REPL:
>>> from invoke import run >>> cmd = "pip install -r requirements.txt" >>> result = run(cmd, hide=True, warn=True) >>> print(result.ok) True >>> print(result.stdout.splitlines()[-1]) Successfully installed invocations-0.13.0 pep8-1.5.7 spec-1.3.1
Following the lead of most Unix CLI applications, it offers a traditional flag-based style of command-line parsing, deriving flag names and value types from task signatures (optionally, of course!):
$ invoke clean --docs --bytecode build --docs --extra='**/*.pyo' $ invoke clean -d -b build --docs -e '**/*.pyo' $ invoke clean -db build -de '**/*.pyo'
Like many of its predecessors, it offers advanced features as well – namespacing, task aliasing, before/after hooks, parallel execution and more.
For documentation, including detailed installation information, please see http://pyinvoke.org. Post-install usage information may be found in invoke --help.
You can install the development version via pip install -e git+https://github.com/pyinvoke/invoke#egg=invoke.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file invoke-0.23.0.tar.gz
.
File metadata
- Download URL: invoke-0.23.0.tar.gz
- Upload date:
- Size: 306.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fdc99a5d5bf820a44200df9d25f7317d56d84c91869019fa6ab87ed7bd04625 |
|
MD5 | 213d6ee770a60e790e55a3b87f34762a |
|
BLAKE2b-256 | 449f2f6f14763636ccba3be2d694e89a266aacdb33ed415a0cb47e898922641c |
File details
Details for the file invoke-0.23.0-py3-none-any.whl
.
File metadata
- Download URL: invoke-0.23.0-py3-none-any.whl
- Upload date:
- Size: 158.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2f0cc934d17e54c366d09485478bdf68e1f98b59bc48aa227b31112b1395554 |
|
MD5 | a630287324311ba36410ce9a3d15c3ec |
|
BLAKE2b-256 | 1a5f3b2d246a7e4c8d0e6f9f1d391965ee3164f2ac468593ef50fa13db20a461 |
File details
Details for the file invoke-0.23.0-py2-none-any.whl
.
File metadata
- Download URL: invoke-0.23.0-py2-none-any.whl
- Upload date:
- Size: 159.7 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 593b9d7f1e3fb1f09c176fffd2cae756cd4ccbbd698e16bb54a7ac7349655da3 |
|
MD5 | 24f43d04b664fe3051ef53bd09a450c5 |
|
BLAKE2b-256 | 49f2dbd0090d843d4e6dc0af657116671ce5c1c178e364ef24fa3d0ef1d98f8a |