From 12c31902f4476c7cd765c403e48884b4883e7dee Mon Sep 17 00:00:00 2001 From: Lukas Riedel <34276446+peanutfun@users.noreply.github.com> Date: Wed, 4 Oct 2023 11:22:34 +0200 Subject: [PATCH] Remove python version pin from conda specs (#786) * Remove Python version restriction from conda env specs * Remove Python version from env_climada.yml * Update installation guide * Add instructions for choosing Python version. * Fix update instructions: No env_developer.yml for Petals anymore. * Add setup instructions to VSCode for Petals. * jenkins: adapt environment/installation script * Update doc/guide/install.rst Co-authored-by: Emanuel Schmid <51439563+emanuel-schmid@users.noreply.github.com> --------- Co-authored-by: emanuel-schmid Co-authored-by: Emanuel Schmid <51439563+emanuel-schmid@users.noreply.github.com> --- doc/guide/install.rst | 37 +++++++++++++++++++++++++++-------- requirements/env_climada.yml | 1 - script/jenkins/install_env.sh | 3 ++- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/doc/guide/install.rst b/doc/guide/install.rst index 617aab4d9..7c5c0021b 100644 --- a/doc/guide/install.rst +++ b/doc/guide/install.rst @@ -143,13 +143,31 @@ For advanced Python users or developers of CLIMADA, we recommed cloning the CLIM cd climada_python git checkout develop -#. Create an Anaconda environment called ``climada_env`` for installing CLIMADA. - Use the default environment specs in ``env_climada.yml`` to create it. +#. Create an Anaconda environment called ``climada_env`` for installing CLIMADA: + + .. code-block:: shell + + conda create -n climada_env python=3.9 + + .. note:: + + CLIMADA can be installed for different Python versions. + If you want to use a different version, replace the version specification in the command above with another allowed version. + + .. list-table:: + :width: 60% + + * - **Supported Version** + - ``3.9`` + * - Allowed Versions + - ``3.9``, ``3.10``, ``3.11`` + +#. Use the default environment specs in ``env_climada.yml`` to install all dependencies. Then activate the environment: .. code-block:: shell - conda env create -n climada_env -f requirements/env_climada.yml + conda env update -n climada_env -f requirements/env_climada.yml conda activate climada_env #. Install the local CLIMADA source files as Python package using ``pip``: @@ -237,7 +255,6 @@ To install CLIMADA Petals, we assume you have already installed CLIMADA Core wit .. code-block:: shell conda env update -n climada_env -f requirements/env_climada.yml - conda env update -n climada_env -f requirements/env_developer.yml conda activate climada_env #. Install the CLIMADA Petals package: @@ -288,15 +305,20 @@ Basic Setup See the VSCode docs on `Python `_ and `Jupyter Notebooks `_ for further information. +.. hint:: + + Both of the following setup instructions work analogously for Core and Petals. + The specific instructions for Petals are shown in square brackets: [] + Workspace Setup """"""""""""""" Setting up a workspace for the CLIMADA source code is only available for :ref:`advanced installations `. #. Open a new VSCode window. - Below *Start*, click *Open...*, select the ``climada_python`` repository folder in your workspace directory, and click on *Open* on the bottom right. + Below *Start*, click *Open...*, select the ``climada_python`` [``climada_petals``] repository folder in your workspace directory, and click on *Open* on the bottom right. -#. Click *File* > *Save Workspace As...* and store the workspace settings file next to (**not** in!) the ``climada_python`` folder. +#. Click *File* > *Save Workspace As...* and store the workspace settings file next to (**not** in!) the ``climada_python`` [``climada_petals``] folder. This will enable you to load the workspace and all its specific settings in one go. #. Open the Command Palette by clicking *View* > *Command Palette* or by using the shortcut keys ``Ctrl+Shift+P`` (Windows, Linux) / ``Cmd+Shift+P`` (macOS). @@ -315,7 +337,7 @@ After you set up a workspace, you might want to configure the test explorer for #. In the left sidebar, select the "Testing" symbol, and click on *Configure Python Tests*. -#. Select "pytest" as test framework and then select ``climada`` as the directory containing the test files. +#. Select "pytest" as test framework and then select ``climada`` [``climada_petals``] as the directory containing the test files. #. Select "Testing" in the Activity Bar on the left or through *View* > *Testing*. The "Test Explorer" in the left sidebar will display the tree structure of modules, files, test classes and individual tests. @@ -407,7 +429,6 @@ To update, follow the instructions based on your :ref:`installation type =22.3 - pyepsg>=0.4 - pytables>=3.7 - - python=3.9 - pyxlsb>=1.0 - rasterio>=1.3 - requests>=2.31 diff --git a/script/jenkins/install_env.sh b/script/jenkins/install_env.sh index c3ab7f150..a06da8286 100644 --- a/script/jenkins/install_env.sh +++ b/script/jenkins/install_env.sh @@ -1,7 +1,8 @@ #!/bin/bash -e mamba remove --name climada_env --all -mamba env create -f requirements/env_climada.yml --name climada_env +mamba create -n climada_env python=3.9 +mamba env update -n climada_env -f requirements/env_climada.yml source activate climada_env python -m pip install -e "./[test]"