Skip to main content

pytask is a workflow management system that facilitates reproducible data analyses.

Project description

pytask


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

pytask is a workflow management system that 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 pluggy, a plugin management framework that 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 that is detected if the module and the function name are prefixed with task_. Here is an example.

# Content of task_hello.py.

from pathlib import Path

from pytask import Product
from typing import Annotated


def task_hello_earth(path: Annotated[Path, Product] = Path("hello_earth.txt")):
    path.write_text("Hello, earth!")
  • The purpose of the task is to create the file hello_earth.txt and add some content.

  • To tell pytask that hello_earth.txt is a product and not an input, use the Product annotation.

    (If you are not used to type annotations, do not worry. pytask also offers simpler interfaces without type annotations.)

  • Since you pass a pathlib.Path to the function, pytask will check whether the file exists after the function is executed.

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

image

Documentation

You find the documentation 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 excellent work of Holger Krekel and pytest's many contributors, this project would not have been possible. Thank you!

pytask owes 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.5.2.tar.gz (100.0 kB view details)

Uploaded Source

Built Distribution

pytask-0.5.2-py3-none-any.whl (130.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytask-0.5.2.tar.gz
  • Upload date:
  • Size: 100.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pytask-0.5.2.tar.gz
Algorithm Hash digest
SHA256 f51ef851af311e67f315468e07d65374931deec0189b9f7e4e32d89a144571b9
MD5 ec2fc5e28e3b87d983e4f31e18351cdf
BLAKE2b-256 fa7b181fd3e705e7352bf3f435563dcf10f8e0a9dd77c65806f77f7402bce853

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytask-0.5.2.tar.gz:

Publisher: publish-to-pypi.yml on pytask-dev/pytask

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: pytask-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 130.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pytask-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 183d526e0bd56982b0d332451a9f0735903b5f4f5c9f3e2c692b4358ec97d602
MD5 69d3eb0d313d40331a937e39b7751570
BLAKE2b-256 bd7a9f486465753fe54b9808040deccb9315abc981beae7383e2c9859732ea1d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytask-0.5.2-py3-none-any.whl:

Publisher: publish-to-pypi.yml on pytask-dev/pytask

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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