From 4210ac4f59efaf811a96a2b1eaad7424e39010b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peider=20K=C3=B6nz?= Date: Thu, 9 Oct 2025 17:10:46 +0200 Subject: [PATCH] Update README.md: cut useless alternative procedure and its setup_env.sh file. --- README.md | 16 -------- tools/setup_env.sh | 95 ---------------------------------------------- 2 files changed, 111 deletions(-) delete mode 100755 tools/setup_env.sh diff --git a/README.md b/README.md index 41f5ba4..ce42b1d 100644 --- a/README.md +++ b/README.md @@ -40,22 +40,6 @@ We distinguish pinned installations based on exported (reproducible) environment saved in `requirements/environment.yml`, and free installations, where the installation is based on top-level dependencies listed in `requirements/requirements.txt`. -A pinned installation in an conda environment -with the default name `pytrajplot` is done with - - tools/setup_env.sh - -Add the option `-n ` to create an environment with a custom name. - -If you start developing a new version, you might want to do an unpinned installation with option `-u` and export the environment with option `-e`: - - tools/setup_env.sh -u -e - -*Note*: The flag `-m` can be used to use `mamba` as solver -instead of the built-in `conda` -solver. However since `conda` version 23, the mamba solver is the default solver -in conda an no speed up is achieved by this option, -thus we no longer recommend its use. ### Install Package diff --git a/tools/setup_env.sh b/tools/setup_env.sh deleted file mode 100755 index 1f09c3f..0000000 --- a/tools/setup_env.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash -# -# Create conda environment with pinned or unpinned requirements -# -# - 2022-08 (D. Regenass) Write original script -# - 2022-09 (S. Ruedisuehli) Refactor; add some options -# - -# Default env names -DEFAULT_ENV_NAME="pytrajplot" - -# Default options -ENV_NAME="${DEFAULT_ENV_NAME}" -PYVERSION=3.11.5 -PINNED=true -EXPORT=false -CONDA=conda -HELP=false - -# Environment file (pinned dependencies, used with 'conda env create', YAML format) -ENV_PINNED=requirements/environment.yml -# Requirement file (unpinned dependencies, used with 'conda create', plain text format) -# Note: Unlike the blueprint, a plain text file is used here for unpinned requirements -ENV_UNPINNED=requirements/requirements.txt - -help_msg="Usage: $(basename "${0}") [-n NAME] [-p VER] [-u] [-e] [-m] [-h] - -Options: - -n NAME Env name [default: ${DEFAULT_ENV_NAME} - -p VER Python version [default: ${PYVERSION}] - -u Use unpinned requirements (minimal version restrictions) - -e Export environment files (requires -u) - -m Use mamba instead of conda - -h Print this help message and exit -" - -# Eval command line options -while getopts n:p:defhimu flag; do - case ${flag} in - n) ENV_NAME=${OPTARG};; - p) PYVERSION=${OPTARG};; - e) EXPORT=true;; - h) HELP=true;; - m) CONDA=mamba;; - u) PINNED=false;; - ?) echo -e "\n${help_msg}" >&2; exit 1;; - esac -done - -if ${HELP}; then - echo "${help_msg}" - exit 0 -fi - -echo "Setting up environment for installation" -eval "$(conda shell.bash hook)" || exit # NOT ${CONDA} (doesn't work with mamba) -conda activate || exit # NOT ${CONDA} (doesn't work with mamba) - -# Create new env; pass -f to overwriting any existing one -echo "Creating ${CONDA} environment" -# Note: Unlike the blueprint, the environment is not created beforehand here, -# because this led to numerous conflicts when trying to update the -# environment with all dependencies in a second step -#${CONDA} create -n ${ENV_NAME} python=${PYVERSION} --yes || exit - -# Install requirements in new env -if ${PINNED}; then - echo "Pinned installation" - # Note: Unlike in the MeteoSwiss-APN/mch-python-blueprint, - # the environment is created with all dependencies - # at once (as recommended by conda) - # Note: From `conda env --help`: `--force` is deprecated and will be removed in 24.3. - # Use `--yes` instead. - ${CONDA} env create --yes --name ${ENV_NAME} --file $ENV_PINNED || exit -else - echo "Unpinned installation" - # Note: Unlike in the MeteoSwiss-APN/mch-python-blueprint, - # a plain text file is used for unpinned requirements, and - # the environment is created with all dependencies - # at once (as recommended by conda) - ${CONDA} create --force --name ${ENV_NAME} --file $ENV_UNPINNED --yes || exit - if ${EXPORT}; then - echo "Export pinned prod environment" - ${CONDA} env export --name ${ENV_NAME} --no-builds | \grep -v '^prefix:' > $ENV_PINNED || exit - fi -fi - -# Note: Unlike the blueprint, print out a message that environment has been created -echo Environment created, install package with: - -# Note: Unlike the blueprint, give instructions on how to install the package. -# If package installation should be done automatically, -# remove the leading 'echo' commands: -echo conda activate ${ENV_NAME} -echo python -m pip install --no-deps .