Skip to main content

In its highest aspirations, pytask tries to be pytest as a build system.

Project description

pytask


PyPI PyPI - Python Version image image PyPI - License image image image pre-commit.ci status image

pytask is a workflow management system which facilitates reproducible data analyses. Its features include:

  • Automatic discovery of tasks.
  • Lazy evaluation. If a task, its dependencies, and its products have not changed, do not execute it.
  • Debug mode. Jump into the debugger if a task fails, get feedback quickly, and be more productive.
  • Repeat a task with different inputs. Loop over task functions to run the same task with different inputs.
  • Select tasks via expressions. Run only a subset of tasks with expressions and marker expressions.
  • Easily extensible with plugins. pytask is built on top of pluggy, a plugin management framework, which allows you to adjust pytask to your needs. Plugins are available for parallelization, LaTeX, R, and Stata and more can be found here. Learn more about plugins in this tutorial.

Installation

pytask is available on PyPI and on Anaconda.org. Install the package with

$ pip install pytask

or

$ conda install -c conda-forge pytask

Color support is automatically available on non-Windows platforms. On Windows, please, use Windows Terminal which can be, for example, installed via the Microsoft Store.

To quickly set up a new project, use the cookiecutter-pytask-project template or start from other templates or example projects.

Usage

A task is a function which is detected if the module and the function name are prefixed with task_. Here is an example.

# Content of task_hello.py.

import pytask


@pytask.mark.produces("hello_earth.txt")
def task_hello_earth(produces):
    produces.write_text("Hello, earth!")

Here are some details:

  • Dependencies and products of a task are tracked via markers. For dependencies use @pytask.mark.depends_on and for products use @pytask.mark.produces. Use strings and pathlib.Path to specify the location.
  • Use produces (and depends_on) as function arguments to access the paths of the dependencies and products inside the function. All values are converted to pathlib.Path's. Here, produces holds the path to "hello_earth.txt".

To execute the task, enter pytask on the command-line

image

Documentation

The documentation can be found under https://pytask-dev.readthedocs.io/en/stable with tutorials and guides for best practices.

Changes

Consult the release notes to find out about what is new.

License

pytask is distributed under the terms of the MIT license.

Acknowledgment

The license also includes a copyright and permission notice from pytest since some modules, classes, and functions are copied from pytest. Not to mention how pytest has inspired the development of pytask in general. Without the amazing work of Holger Krekel and pytest's many contributors, this project would not have been possible. Thank you!

pytask ows its beautiful appearance on the command line to rich written by Will McGugan.

Repeating tasks in loops is inspired by ward written by Darren Burns.

Citation

If you rely on pytask to manage your research project, please cite it with the following key to help others to discover the tool.

@Unpublished{Raabe2020,
    Title  = {A Python tool for managing scientific workflows.},
    Author = {Tobias Raabe},
    Year   = {2020},
    Url    = {https://github.com/pytask-dev/pytask}
}

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

pytask-0.2.2.tar.gz (88.0 kB view details)

Uploaded Source

Built Distribution

pytask-0.2.2-py3-none-any.whl (103.6 kB view details)

Uploaded Python 3

File details

Details for the file pytask-0.2.2.tar.gz.

File metadata

  • Download URL: pytask-0.2.2.tar.gz
  • Upload date:
  • Size: 88.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for pytask-0.2.2.tar.gz
Algorithm Hash digest
SHA256 83a0c671bd8a38502ba7692c01334c5e98180754e25cd447503f233cb0040a7d
MD5 5c58cf56b253c3561f25c15a3c945554
BLAKE2b-256 5f65a26b588838f8830d010b95d2b3aa895cb7ef325b92f3c776abcf80330daa

See more details on using hashes here.

File details

Details for the file pytask-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: pytask-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 103.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for pytask-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cd3b57578162644369c71bec9ecfd8123dde354de7e4b47a7f4fb4ca998cf3f1
MD5 7dddacfe8a8ead5f637ed3aa43ae67a0
BLAKE2b-256 a646a9d398b433961b6b9558d3b38f024135e5e21d2bebc649360d6c9373aa68

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page