Skip to content

Commit 5d0a985

Browse files
authored
Update installation guide (#1296)
* Fix formatting errors. * Move switching branches to FAQ. * Fix some links.
1 parent 7094124 commit 5d0a985

2 files changed

Lines changed: 41 additions & 35 deletions

File tree

doc/development/Guide_CLIMADA_Development.ipynb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@
141141
"cell_type": "markdown",
142142
"metadata": {},
143143
"source": [
144+
"(dev-pre-commit-hooks)=\n",
145+
"\n",
144146
"### Pre-Commit Hooks\n",
145147
"\n",
146148
"Climada developer dependencies include pre-commit hooks to help ensure code linting and formatting.\n",

doc/getting-started/install.rst

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Depening on your level of expertise, we provide two different approaches:
7474
* If you have never worked with a command line, or if you just want to give CLIMADA a try, follow the :ref:`simple instructions <install-simple>`.
7575
* If you want to use the very latest development version of CLIMADA or even develop new CLIMADA code, follow the :ref:`advanced instructions <install-advanced>`.
7676

77-
Both approaches are not mutually exclusive.
77+
Both approaches are **not** mutually exclusive.
7878
After successful installation, you may switch your setup at any time.
7979

8080
.. _petals-notes:
@@ -146,9 +146,9 @@ These instructions will install the most recent stable version of CLIMADA withou
146146

147147
.. _install-pixi:
148148

149-
-------------------
149+
-------------------------------------------
150150
Simple Instructions with Pixi (Alternative)
151-
-------------------
151+
-------------------------------------------
152152

153153
As an alternative to mamba `Pixi`_ can be used to install climada from conda-forge.
154154
Pixi is a modern package manager, based on Conda, that offers much faster dependency resolution.
@@ -159,8 +159,6 @@ Pixi is a modern package manager, based on Conda, that offers much faster depend
159159
160160
pixi init climada_pixi
161161
162-
.. _install-simple:
163-
164162
#. Add CLIMADA from ``conda-forge``:
165163

166164
.. code-block:: shell
@@ -194,6 +192,7 @@ Advanced Instructions: Installing from source
194192
---------------------------------------------
195193

196194
For advanced Python users or developers of CLIMADA, cloning the CLIMADA repository and installing the package from source.
195+
Installing from source also allows you to :ref:`switch branches <switch-branch>`.
197196

198197
.. warning::
199198

@@ -283,24 +282,6 @@ For advanced Python users or developers of CLIMADA, cloning the CLIMADA reposito
283282
If this test passes, great!
284283
You are good to go.
285284

286-
.. _change-branch:
287-
288-
How to switch branch
289-
^^^^^^^^^^^^^^^^^^^^^^
290-
291-
Advanced users, or reviewers, may also want to check the feature of a specific branch other than develop.
292-
To do so, **assuming you did install CLIMADA in editable mode (`pip install` with the `-e` flag)**, you just have to:
293-
294-
```
295-
git fetch
296-
git checkout <branch>
297-
git pull
298-
```
299-
300-
This will work most of the time, except if the target branch defines new dependencies that you don't have already in your environment (as they will not get installed this way), in that case you can install these dependencies yourself, or create a new environment with the *new* requirements from the branch.
301-
302-
If you did not install CLIMADA in editable mode, you can also reinstall CLIMADA from its folder after switching the branch (`pip install [-e] ./`).
303-
304285
.. _devdeps:
305286

306287
Install Developer Dependencies (Optional)
@@ -311,8 +292,7 @@ They are also not needed for using CLIMADA.
311292
However, if you want to develop CLIMADA, we strongly recommend you install them.
312293

313294
With the ``climada_env`` activated, enter the workspace directory and then the CLIMADA repository as above.
314-
Then, add the ``test`` extra specification to the ``pip install`` command (**mind the quotation marks**,
315-
and see also `pip install examples <https://pip.pypa.io/en/stable/cli/pip_install/#examples>`_):
295+
Then, add the ``test`` extra specification to the ``pip install`` command (**mind the quotation marks**, and see also `pip install examples <https://pip.pypa.io/en/stable/cli/pip_install/#examples>`_):
316296

317297
.. code-block:: shell
318298
@@ -339,7 +319,7 @@ With the ``climada_env`` activated, execute
339319
340320
pre-commit install
341321
342-
Please refer to the `guide on pre-commit hooks <../development/Guide_CLIMADA_Development.html#pre-commit-hooks>`_ for information on how to use this tool.
322+
Please refer to the :ref:`guide on pre-commit hooks <dev-pre-commit-hooks>` for information on how to use this tool.
343323

344324
For executing the pre-defined test scripts in exactly the same way as they are executed by the automated CI pipeline, you will need ``make`` to be installed.
345325
On macOS and on Linux it is pre-installed. On Windows, it can easily be installed with Conda:
@@ -348,7 +328,7 @@ On macOS and on Linux it is pre-installed. On Windows, it can easily be installe
348328
349329
mamba install -n climada_env make
350330
351-
Instructions for running the test scripts can be found in the `Testing Guide <../development/Guide_Testing.html>`_.
331+
Instructions for running the test scripts can be found in the :doc:`Testing Guide </development/Guide_Testing>`.
352332

353333
Install CLIMADA Petals (Optional)
354334
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -382,9 +362,9 @@ To install CLIMADA Petals, we assume you have already installed CLIMADA Core wit
382362
python -m pip install -e ./
383363
384364
385-
---------------------------------------
365+
------------
386366
Code Editors
387-
---------------------------------------
367+
------------
388368

389369
JupyterLab
390370
^^^^^^^^^^
@@ -513,9 +493,9 @@ Therefore, we recommend installing Spyder in a *separate* environment, and then
513493
#. Set the Python interpreter used by Spyder to the one of ``climada_env``.
514494
Select *Preferences* > *Python Interpreter* > *Use the following interpreter* and paste the iterpreter path you copied from the ``climada_env``.
515495

516-
---------------------------------------
496+
-----------------------------
517497
Apps for working with CLIMADA
518-
---------------------------------------
498+
-----------------------------
519499

520500
To work with CLIMADA, you will need an application that supports Jupyter Notebooks.
521501
There are plugins available for nearly every code editor or IDE, but if you are unsure about which to choose, we recommend `JupyterLab <https://jupyterlab.readthedocs.io/en/stable/>`_, `Visual Studio Code <https://code.visualstudio.com/>`_ or `Spyder <https://www.spyder-ide.org/>`_.
@@ -571,8 +551,8 @@ Answers to frequently asked questions.
571551

572552
.. _update-climada:
573553

574-
Updating CLIMADA
575-
^^^^^^^^^^^^^^^^
554+
How to update CLIMADA?
555+
^^^^^^^^^^^^^^^^^^^^^^
576556

577557
We recommend keeping CLIMADA up-to-date.
578558
To update, follow the instructions based on your :ref:`installation type <install-choice>`:
@@ -600,6 +580,30 @@ To update, follow the instructions based on your :ref:`installation type <instal
600580
601581
The same instructions apply for CLIMADA Petals.
602582

583+
.. _switch-branch:
584+
585+
How to switch branches?
586+
^^^^^^^^^^^^^^^^^^^^^^^
587+
588+
This is only available for :ref:`advanced installations <install-advanced>` from source.
589+
590+
If you want to check out or review a specific feature, you may want to switch to a `Git branch <https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell>`_ other than ``develop``.
591+
To switch to a new branch, open a terminal and move to the CLIMADA repository.
592+
Then fetch the latest changes from the remote, switch to the target branch, and update your local version:
593+
594+
.. code-block:: shell
595+
596+
cd <path/to/workspace>/climada_python
597+
git fetch
598+
git checkout <branch>
599+
git pull
600+
601+
After switching, it is good practice to :ref:`update your environment <update-climada>`, as the dependency definitions might have been changed.
602+
In rare cases, updating the environment might fail after switching a branch because the dependency updates are incompatible.
603+
If this happens, create a new environment (see the :ref:`advanced instructions <install-advanced>`).
604+
605+
The above instructions also apply for CLIMADA Petals, but you have to ``cd`` into the ``climada_petals`` repository in the first step, of course.
606+
603607
.. _install-more-packages:
604608

605609
Installing More Packages
@@ -679,12 +683,12 @@ the level set to ``WARNING``.
679683

680684
If you prefer another logging configuration, e.g., for using Climada embedded in another application,
681685
you can opt out of the default pre-configuration by setting the config value for
682-
``logging.climada_style`` to ``false`` in the :doc:`configuration file <../development/Guide_Configuration>`
686+
``logging.climada_style`` to ``false`` in the :doc:`configuration file </development/Guide_Configuration>`
683687
``climada.conf``.
684688

685689
Changing the logging level can be done in multiple ways:
686690

687-
* Adjust the :doc:`configuration file <../development/Guide_Configuration>` ``climada.conf`` by setting a the value of the ``global.log_level`` property.
691+
* Adjust the :doc:`configuration file </development/Guide_Configuration>` ``climada.conf`` by setting a the value of the ``global.log_level`` property.
688692
This only has an effect if the ``logging.climada_style`` is set to ``true`` though.
689693

690694
* Set a global logging level in your Python script:

0 commit comments

Comments
 (0)