Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A set of Python applications run by a Cylc suite using a shared environment in tasks. This script installs the environment in the suite.
# This script is used by a Python project that is also a Cylc suite.
# An initial task in the suite runs this script to build and install the Python
# project and its environment in a self-contained Conda environment under
# `~/cylc-run/SUITE/share/condaenv/`.
# Subsequent tasks activates this environnment using:
# set +u
# conda activate "${SUITE_CONDA_ENV}"
# set -u
# ------------------------------------------------------------------------------
# Note: "conda" does not work with "set -u"
set -eo pipefail
# Gain access to the "conda" command.
. "${USER_CONDA_PROFILE:-${HOME}/miniconda3/etc/profile.d/}"
# Create or update Conda environment. Activate it.
if conda activate "${SUITE_CONDA_ENV}"; then
conda env update \
--prune \
-f "${CYLC_SUITE_RUN_DIR}/environment.yml"
pip uninstall -y 'stf' || true
conda env create \
--force \
-f "${CYLC_SUITE_RUN_DIR}/environment.yml"
conda activate "${SUITE_CONDA_ENV}"
# Install project to Conda environment
set -u
python3 "./" 'install'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.