Skip to content

How to use [activation] with [tasks]? #1323

Answered by ruben-arts
matthewfeickert asked this question in Q&A
Discussion options

You must be logged in to vote

Currently this is not possible. The latest release does support setting environment variables per task:

[tasks]
run = { cmd="python run.py $ARGUMENT", env={ ARGUMENT="value" }}

But that might only marginally help.

The other solution would be to run a shell in the pixi task e.g.:

[tasks]
hello = "bash -c 'source env.sh && echo $HELLO'"
# env.sh file
export HELLO="Hello, World!"

This can obviously go wrong, but you could make these tasks per target to make them a little more safe.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@matthewfeickert
Comment options

@ruben-arts
Comment options

Answer selected by matthewfeickert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants