Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/source_files/pixi_tomls/task_visibility.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[workspace]
channels = []
platforms = []

# --8<-- [start:project_tasks]
# Hidden task that is only intended to be used by other tasks
[tasks._git-clone]
args = ["url"]
cmd = "echo git clone {{ url }}"

# Hidden task that clones a dependency
[tasks._clone-subproject]
depends-on = [
{ task = "_git-clone", args = [
"https://git.hub/org/subproject.git",
] },
]

# Task to build the project which depends on cloning a dependency
[tasks.build]
cmd = "echo Building project"
depends-on = ["_clone-subproject"]
# --8<-- [end:project_tasks]
16 changes: 16 additions & 0 deletions docs/workspace/advanced_tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ pixi task add lint pylint
--8<-- "docs/source_files/pixi_tomls/pixi_task_alias.toml:not-all"
```

!!! tip "Hiding Tasks"
Tasks can be hidden from user facing commands by [naming them](#task-names) with an `_` prefix.

### Shorthand Syntax

Expand Down Expand Up @@ -268,6 +270,20 @@ You can also use filters to transform argument values:

For more information about available filters and template syntax, see the [MiniJinja documentation](https://docs.rs/minijinja/latest/minijinja/filters/index.html).

## Task Names

A task name follows these rules:

- **No spaces** are allowed in the name.
- Must **be unique** within the table.
- [`_`]("underscores") at the start of the name will **hide** the task from the `pixi task list` command.

Hiding tasks can be useful if your project defines many tasks but your users only need to use a subset of them.

```toml title="pixi.toml"
--8<-- "docs/source_files/pixi_tomls/task_visibility.toml:project_tasks"
```

## Caching

When you specify `inputs` and/or `outputs` to a task, Pixi will reuse the result of the task.
Expand Down
Loading