pytask facilitates reproducible data analyses. Its features are:
- Automatic discovery of tasks
- Lazy execution: Skip tasks when inputs and outputs are unchanged.
- Debug mode: Jump into the debugger if a task fails.
- Repeat a task with different inputs: Loop over task functions.
- Task Selection: Run subsets with expressions and markers.
- Plugins: Extend pytask with plugins for parallelization, LaTeX, R, and Stata, and more.
Installation
pytask is available on PyPI and on conda-forge. Install the package with
$ uv add pytask
or
$ pixi add 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.txtand add some content. -
To tell pytask that
hello_earth.txtis a product and not an input, use theProductannotation.(If you are not used to type annotations, do not worry. pytask also offers simpler interfaces without type annotations.)
-
Since you pass a
pathlib.Pathto the function, pytask will check whether the file exists after the function is executed.
To execute the task, enter pytask on the command-line
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}
}
Metadata
Release files for pytask 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytask-0.7.0.tar.gz | 125.1 kB | Without provenance | Details for pytask-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytask-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for pytask-0.7.0-py3-none-any.whl |
Total release size: 285.1 kB
Release files / pytask-0.7.0.tar.gz
| Download URL | pytask-0.7.0.tar.gz |
|---|---|
| Size | 125.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a9cf5452d8b50d92a3d429d9eb815688e89e21fb83de19012c90c7f019b661a
|
|
BLAKE2b-256 checksum How to use checksums |
1c3efeb1c574c3634c411082ddc4a9c9c69e42f91619617cbb1e16c67458d870
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / pytask-0.7.0-py3-none-any.whl
| Download URL | pytask-0.7.0-py3-none-any.whl |
|---|---|
| Size | 160.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
af4234c934f3b2ba998787f5d6037d38a63856d444102fe57a6b96f651c6e36e
|
|
BLAKE2b-256 checksum How to use checksums |
2de1356cdba9e7e97c543dc722cafe75369475385f2d9bf70b30d92be605981b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for pytask 0.7.0
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.