conda-pack-template

The conda-pack-template is a set of tools for generation and packaging of custom conda environments. Docker and conda are used to generate conda environments. The packaging is done with the conda-pack tool available from PyPI and conda-forge.

The conda environments are specified by a configuration YAML file, e.g. config-py39.yml from https://github.com/nsls2-conda-envs/testenv/tree/main/configs:

docker_image: "nsls2/linux-anvil-cos7-x86_64:latest"
env_name: "py39"
conda_env_file: "env-py39.yml"
conda_binary: "mamba"
python_version: "3.9"
pkg_name: ""
pkg_version: ""
extra_packages: "mamba"
channels: "-c conda-forge"

where the required parameters are:

  • docker_image is the image to use for building in a containerized environment

  • env_name is the name of the environment to be created

  • python_version is the Python version to use (not used when the environment file is used)

  • channels lists the conda channels

and the optional parameters are:

  • conda_env_file is the conda environment file

  • conda_binary is the conda binary — conda (default) or mamba (for faster execution)

  • pkg_name is the conda package to install (can be an empty string)

  • pkg_version is the version of the pkg_name

  • extra_packages lists the extra conda packages to install along with pkg_name

  • extra_cmd_before_install (not listed in the above example) is used to specify the command to run in Docker before conda environment installation

  • extra_cmd_after_install (not listed in the above example) is used to specify the command to run in Docker after conda environment installation

Here are examples of extra_cmd_before_install and extra_cmd_after_install:

extra_cmd_before_install: "yum install mesa-libGL -y"
extra_cmd_after_install: "conda remove perl --force -y"

Note

The repository is not structured to be a pip-installable package (yet). However, its code will be used to process individual conda environment configurations managed via separate repositories (one repo per environment).