pixi task add
#
About#
Add a command to the workspace
Usage#
Arguments#
-
<NAME>
- Task name
required:true
-
<COMMAND>
- One or more commands to actually execute
May be provided more than once.
required:true
Options#
-
--depends-on <DEPENDS_ON>
- Depends on these other commands
May be provided more than once.
-
--platform (-p) <PLATFORM>
- The platform for which the task should be added
-
--feature (-f) <FEATURE>
- The feature for which the task should be added
-
--cwd <CWD>
- The working directory relative to the root of the workspace
-
--env <ENV>
- The environment variable to set, use --env key=value multiple times for more than one variable
May be provided more than once.
-
--description <DESCRIPTION>
- A description of the task to be added
-
--clean-env
- Isolate the task from the shell environment, and only use the pixi environment to run the task
Examples#
pixi task add cow cowpy "Hello User"
pixi task add tls ls --cwd tests
pixi task add test cargo t --depends-on build
pixi task add build-osx "METAL=1 cargo build" --platform osx-64
pixi task add train python train.py --feature cuda
pixi task add publish-pypi "hatch publish --yes --repo main" --feature build --env HATCH_CONFIG=config/hatch.toml --description "Publish the package to pypi"
This adds the following to the manifest file:
[tasks]
cow = "cowpy \"Hello User\""
tls = { cmd = "ls", cwd = "tests" }
test = { cmd = "cargo t", depends-on = ["build"] }
[target.osx-64.tasks]
build-osx = "METAL=1 cargo build"
[feature.cuda.tasks]
train = "python train.py"
[feature.build.tasks]
publish-pypi = { cmd = "hatch publish --yes --repo main", env = { HATCH_CONFIG = "config/hatch.toml" }, description = "Publish the package to pypi" }
Which you can then run with the run
command: