Invoke pytask from the command line with
$ pytaskUse the following flags to learn more about pytask and its configuration.
$ pytask --version
$ pytask -h | --helppytask has multiple commands listed on the main help page.
--8<-- "docs/source/_static/md/help-page.md"
The build command is the default command, meaning the following two calls are
identical.
$ pytask
$ pytask buildDisplay command-specific information by adding the help flag after the command.
$ pytask <command-name> -h/--helpThe build command accepts many
options and paths as positional arguments. If no paths
are passed via the command line interface, pytask will look for
paths in the configuration file. At
last, pytask will collect tasks from the current working directory and subsequent
folders.
You can also pass any number of paths of directories or modules to the program.
$ pytask path/to/task_module.py path/to/folderDon't use paths to run task subsets. Use expressions instead. When pytask collects tasks from subpaths of your project, it cannot infer the whole structure of dependencies and products and might run your tasks with missing or outdated dependencies.
Here are a few selected options for the build command.
To show errors immediately when they occur, use
$ pytask --show-errors-immediatelyIt can be helpful when you have a long-running workflow but want feedback as soon as it
is available. See --show-errors-immediately.
To stop the build of the project after the first n failures, use
$ pytask -x | --stop-after-first-failure # Stop after the first failure
$ pytask --max-failures 2 # Stop after the second failureSee -x, --stop-after-first-failure and
--max-failures.
Do a dry run with --dry-run to see which tasks will be
executed without executing them.
--8<-- "docs/source/_static/md/dry-run.md"
Use the --explain flag to understand why tasks need to
be executed. This shows what changed (source files, dependencies, products, previous
tasks) and helps you understand pytask's execution decisions.
--8<-- "docs/source/_static/md/explain.md"
The explanation output respects the --verbose flag:
- Default verbosity: Shows tasks that would be executed and skipped tasks
-vor--verbose 1: Same as default, with summary for persisted and unchanged tasks--verbose 2: Shows detailed information including persisted and unchanged tasks with change reasons
!!! seealso
`pytask` also has a functional interface that is explained in
[this article](../how_to_guides/functional_interface.ipynb).