|
2 | 2 | title: "Development and contribution" |
3 | 3 | teaching: 10 |
4 | 4 | exercises: 20 |
5 | | -compatibility: ESMValTool v2.14.0 |
| 5 | +compatibility: ESMValTool v2.15.0 |
6 | 6 |
|
7 | 7 | questions: |
8 | 8 | - "What is a development installation?" |
@@ -109,73 +109,46 @@ nothing to commit, working tree clean |
109 | 109 | ~~~ |
110 | 110 | {: .output} |
111 | 111 |
|
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 |
141 | 113 |
|
| 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: |
142 | 118 | ~~~bash |
143 | | -mamba env create --name a_new_name --file environment.yml |
| 119 | +curl -fsSL https://pixi.sh/install.sh | sh |
144 | 120 | ~~~ |
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: |
152 | 121 |
|
| 122 | +After installing pixi you run the following command to install all of the |
| 123 | +required dependencies for running and developing Python diagnostics: |
153 | 124 | ~~~bash |
154 | | -conda activate esmvaltool |
| 125 | +pixi shell --frozen |
155 | 126 | ~~~ |
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. |
162 | 130 |
|
| 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. |
163 | 134 | ~~~bash |
164 | | -pip install --no-deps --editable '.[develop]' |
| 135 | +pre-commit install |
165 | 136 | ~~~ |
166 | 137 |
|
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: |
170 | 139 |
|
171 | 140 | ~~~bash |
172 | 141 | esmvaltool --help |
173 | 142 | ~~~ |
174 | 143 |
|
175 | 144 | If the installation is successful, ESMValTool prints a help message to the console. |
176 | 145 |
|
| 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 | + |
177 | 150 |
|
178 | | -### 4 Updating ESMValTool |
| 151 | +### 3 Updating ESMValTool |
179 | 152 |
|
180 | 153 | The ``main`` branch has the latest features of ESMValTool. Please make sure |
181 | 154 | 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 |
249 | 222 | - [lintr](https://github.com/jimhester/lintr) for diagnostic scripts written in R |
250 | 223 | - [codespell](https://pypi.org/project/codespell/) to check grammar |
251 | 224 |
|
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. |
255 | 227 | To explore other tools, have a look at ESMValTool documentation on |
256 | 228 | [Code quality](https://docs.esmvaltool.org/en/latest/community/ |
257 | 229 | code_documentation.html#code-quality). |
|
0 commit comments