-
Notifications
You must be signed in to change notification settings - Fork 427
Open
Labels
Description
Manifest
[workspace]
channels = ["https://prefix.dev/conda-forge"]
platforms = ["osx-arm64"]
[tasks.subroutine]
cmd = "echo $FOOBAR"
env.FOOBAR = "{{ input }}"
args = ["input"]
[tasks.foo]
depends-on = [{ task = "subroutine", args = ["foo"] }]
[tasks.bar]
depends-on = [{ task = "subroutine", args = ["bar"] }]Expected behaviour
foo task outputs foo, bar task outputs bar.
Actual behaviour
~/sandbox/template-env via 🧚 v0.63.2
❯ pixi run foo
✨ Pixi task (subroutine): echo $FOOBAR
{{ input }}
~/sandbox/template-env via 🧚 v0.63.2
❯ pixi run bar
✨ Pixi task (subroutine): echo $FOOBAR
{{ input }}Motivation
This example is trivially solved via templating in cmd instead, but I believe there is a real use-case for this not covered by that:
[feature.xp-tests.tasks._xp-tests]
cmd = "..."
env.SPARSE_BACKEND = "{{ SPARSE_BACKEND }}"
args = [{ arg = "SPARSE_BACKEND", default = "Numba" }]
[feature.xp-tests.tasks.xp-tests-numba]
depends-on = [{ task = "_xp-tests", args = [{ "SPARSE_BACKEND" = "Numba" }] }]
[feature.xp-tests.tasks.xp-tests-finch]
depends-on = [
"_precompile_finch",
{ task = "_xp-tests", args = [{ "SPARSE_BACKEND" = "Finch" }]},
]where SPARSE_BACKEND has runtime effects on the _xp-tests command.
Implementation
I think
pixi/crates/pixi_manifest/src/task.rs
Line 360 in 2ea837e
| pub env: Option<IndexMap<String, String>>, |
String.Reactions are currently unavailable