Skip to content

Commit 527faa2

Browse files
authored
Merge pull request #435 from ESMValGroup/updates_for_pixi
Necessary updates for using pixi
2 parents 9154564 + e428881 commit 527faa2

1 file changed

Lines changed: 25 additions & 53 deletions

File tree

_episodes/07-development-setup.md

Lines changed: 25 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Development and contribution"
33
teaching: 10
44
exercises: 20
5-
compatibility: ESMValTool v2.14.0
5+
compatibility: ESMValTool v2.15.0
66

77
questions:
88
- "What is a development installation?"
@@ -109,73 +109,46 @@ nothing to commit, working tree clean
109109
~~~
110110
{: .output}
111111

112-
### 2 ESMValTool dependencies
113-
114-
Please don’t forget if an esmvaltool environment is already created
115-
following the lesson
116-
[Installation]({{ page.root }}{% link _episodes/02-installation.md %}),
117-
we should choose another name for the new environment in this lesson.
118-
119-
ESMValTool uses `mamba` for the recommended installation.
120-
For a minimal mamba installation, see section **Install Mamba** in lesson
121-
[Installation]({{ page.root }}{% link _episodes/02-installation.md %}).
122-
123-
It is good practice to update the version of mamba on your machine before
124-
setting up ESMValTool. This can be done as follows:
125-
126-
~~~bash
127-
mamba update --name base mamba conda
128-
~~~
129-
130-
To simplify the installation process, an environment file ``environment.yml`` is
131-
provided in the ESMValTool directory. We create an environment by running:
132-
133-
~~~bash
134-
mamba env create --name esmvaltool --file environment.yml
135-
~~~
136-
137-
The environment is called ``esmvaltool`` by default.
138-
If an ``esmvaltool`` environment is already created following the lesson
139-
[Installation]({{ page.root }}{% link _episodes/02-installation.md %}),
140-
we should choose another name for the new environment in this lesson by:
112+
### 2 ESMValTool installation
141113

114+
It is recommended to use [pixi](https://pixi.prefix.dev/) to manage ESMValTool
115+
dependencies. There are different ways to install pixi which you can find on the
116+
[pixi installation instructions](https://pixi.prefix.dev/latest/installation/)
117+
website. One way to install pixi is for example:
142118
~~~bash
143-
mamba env create --name a_new_name --file environment.yml
119+
curl -fsSL https://pixi.sh/install.sh | sh
144120
~~~
145-
This will create a new conda environment and install ESMValTool (with all
146-
dependencies that are needed for development purposes) into it with a single command.
147-
148-
For more information see
149-
[Mamba User Guide](https://mamba.readthedocs.io/en/latest/user_guide/mamba.html).
150-
151-
Now, we should activate the environment:
152121

122+
After installing pixi you run the following command to install all of the
123+
required dependencies for running and developing Python diagnostics:
153124
~~~bash
154-
conda activate esmvaltool
125+
pixi shell --frozen
155126
~~~
156-
where ``esmvaltool`` is the name of the environment (replace by ``a_new_name``
157-
in case another environment name was used).
158-
159-
### 3 ESMValTool installation
160-
161-
ESMValTool can be installed in a ``develop`` mode by running:
127+
Using the '--frozen' flag instructs pixi to use the versions of the packages
128+
listed in the ``pixi.lock`` file. Using this option makes all pixi
129+
commands run faster and makes your analyses more reproducible.
162130

131+
As we want to add new code later in the epsiode, we want to install ``pre-commit``.
132+
This will make sure that our changes will be formatted correctly when we commit
133+
them.
163134
~~~bash
164-
pip install --no-deps --editable '.[develop]'
135+
pre-commit install
165136
~~~
166137

167-
This will add the ``esmvaltool`` directory to the Python path in editable mode and
168-
install the development dependencies. We should check if the installation
169-
works properly. To do this, run the tool with:
138+
To check if the installation of pixi works properly, we run ESMValTool with:
170139

171140
~~~bash
172141
esmvaltool --help
173142
~~~
174143

175144
If the installation is successful, ESMValTool prints a help message to the console.
176145

146+
Further information and instructions using pixi can be found in the [ESMValTool
147+
documentation](https://docs.esmvaltool.org/en/latest/quickstart/installation.html#install-from-source).
148+
And if you need to exit the pixi environment, run ``exit`` or ``Ctrl+D``.
149+
177150

178-
### 4 Updating ESMValTool
151+
### 3 Updating ESMValTool
179152

180153
The ``main`` branch has the latest features of ESMValTool. Please make sure
181154
that the source code on your machine is up-to-date. If you obtain the source
@@ -249,9 +222,8 @@ no syntax errors in our recipes and config files
249222
- [lintr](https://github.com/jimhester/lintr) for diagnostic scripts written in R
250223
- [codespell](https://pypi.org/project/codespell/) to check grammar
251224

252-
The good news is that ``pre-commit`` has been already installed
253-
when we chose development installation.
254-
``pre-commit`` is a command line and runs all of those tools. It also fixes some of those errors.
225+
The good news is that ``pre-commit`` which we already installed earlier is a command line
226+
and runs all of those tools. It also fixes some of those errors.
255227
To explore other tools, have a look at ESMValTool documentation on
256228
[Code quality](https://docs.esmvaltool.org/en/latest/community/
257229
code_documentation.html#code-quality).

0 commit comments

Comments
 (0)