Replies: 3 comments 1 reply
-
You can add a script to the activation that exports these variables.
[tool.pixi.activation]
scripts = ["activate.sh"] The environment isn't persisted over the tasks using the |
Beta Was this translation helpful? Give feedback.
-
An alternative to permanently set env vars for an environment is if you have conda binary
This places simple file "state" in your pixi/env/conda-meta directory:
This file can be placed manually, in the absence of conda binary. Essentially this is the same solution as when using micromamba test:
The benefit here is those env vars are present for both tasks and any env commands
|
Beta Was this translation helpful? Give feedback.
-
An update to my previous comment[1]: [tasks.general-task]
cmd = "base_command {{ input }} --arg1 {{ arg1 }} --arg2 {{ arg2 }}"
env = {
ENV_FOO = "xxxxxxxxxxxx",
ENV_BAR = "xxxxxxxxxxxx",
...
}
args = [
{ "arg" = "input" }, # path to input file like raw data or a Python script
{ "arg" = "arg1", "default" = "default1" }, # first argument with default
{ "arg" = "arg2", "default" = "default2" }, # second argument with default
]
[tasks.install-dependencies]
cmd = "echo Installing dependencies." # an NOP command or necessary clean-up procedures (can be left out in the latest version)
depends-on = [
{ "task" = "general-task", "args" = ["input_file1"] }, # with default value
{ "task" = "general-task", "args" = ["input_file2", "foo", "bar"] }, # arguments are positional
# more tasks to be included here
] A template task can be referred to multiple times in the dependency list. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I'd like to be able to set environment variables from a file within pixi tasks, e.g.
But when I do this, the files are not exported to the shell running train, so I'm having to do
Is there any other workaround? Each of my many tasks will need credentials so don't want to have to copy paste that portion if it can be avoided.
Beta Was this translation helpful? Give feedback.
All reactions