How to use [activation] with [tasks]? #1323
-
A colleague of mine has a (org internal repo, sorry) [project]
name = "Run3ModelGen"
version = "0.1.1"
description = "Add a short description here"
authors = ["My colleague <their email>"]
channels = ["conda-forge"]
platforms = ["linux-64", "osx-64", "osx-arm64"]
[tasks]
build = """
cmake -S source -B build && \
cmake \
--build build \
--clean-first \
--parallel 4
"""
genModels = """
. build/setup.sh && \
mkdir run && \
cd run && \
genModels.py
"""
[target.linux-64.tasks]
# Use nproc as available
build = """
cmake -S source -B build && \
cmake \
--build build \
--clean-first \
--parallel "$(nproc --ignore=1)"
"""
[dependencies]
python = "3.11.*"
gfortran = ">=13.2.0,<13.3"
cmake = ">=3.29.2,<3.30"
numpy = ">=1.26.4,<1.27"
pyyaml = ">=6.0.1,<6.1"
make = ">=4.3,<5"
which = ">=2.21,<3"
[target.linux-64.dependencies]
gcc = ">=13.2.0,<13.3"
cxx-compiler = ">=1.0.0,<1.1"
[pypi-dependencies]
pyslha = ">=3.2.6"
uproot = ">=5.3.3" However, after running $ pixi run build to build the unpackaged C++ dependencies acquired via Git,
as the shell that
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
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 [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. |
Beta Was this translation helpful? Give feedback.
Currently this is not possible. The latest release does support setting environment variables per task:
But that might only marginally help.
The other solution would be to run a shell in the
pixi task
e.g.:This can obviously go wrong, but you could make these tasks per target to make them a little more safe.