Skip to content

Commit 9dedc72

Browse files
authored
Merge pull request ESMValGroup#1162 from ESMValGroup/version2_development
Release v2.0.0b0
2 parents 773ee61 + 74d95ab commit 9dedc72

File tree

527 files changed

+4639
-121182
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

527 files changed

+4639
-121182
lines changed

.circleci/config.yml

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
version: 2
33
jobs:
4-
python3_test:
4+
test:
55
# Run Python 3 tests
6-
working_directory: /python3_test
6+
working_directory: /test
77
docker:
88
- image: continuumio/miniconda3
99
steps:
@@ -14,7 +14,7 @@ jobs:
1414
date --rfc-3339 date > cache_key.txt
1515
cat environment.yml >> cache_key.txt
1616
- restore_cache:
17-
key: deps3-{{ .Branch }}-{{ checksum "cache_key.txt" }}
17+
key: test-{{ .Branch }}-{{ checksum "cache_key.txt" }}
1818
- run:
1919
# Update/Create Conda environment and run tests
2020
command: |
@@ -25,7 +25,7 @@ jobs:
2525
conda install -yS r-lintr
2626
python setup.py test
2727
- save_cache:
28-
key: deps3-{{ .Branch }}-{{ checksum "cache_key.txt" }}
28+
key: test-{{ .Branch }}-{{ checksum "cache_key.txt" }}
2929
paths:
3030
- "/opt/conda/envs/esmvaltool"
3131
- ".eggs"
@@ -34,15 +34,15 @@ jobs:
3434
- store_artifacts:
3535
path: test-reports/
3636

37-
python3_install:
37+
test_installation:
3838
# Test Python 3 installation
39-
working_directory: /python3_install
39+
working_directory: /test_installation
4040
docker:
4141
- image: continuumio/miniconda3
4242
steps:
4343
- checkout
4444
- restore_cache:
45-
key: python3-install-{{ .Branch }}
45+
key: test-install-{{ .Branch }}
4646
- run:
4747
command: |
4848
. /opt/conda/etc/profile.d/conda.sh
@@ -72,7 +72,7 @@ jobs:
7272
ncdump tmp.nc | ncgen -k hdf5 -o tmp.nc
7373
cdo -f nc copy tmp.nc tmp2.nc
7474
- save_cache:
75-
key: python3-install-{{ .Branch }}
75+
key: test-install-{{ .Branch }}
7676
paths:
7777
- "/opt/conda/pkgs"
7878
- ".eggs"
@@ -86,7 +86,7 @@ jobs:
8686
when: always
8787
command: |
8888
pip install codacy-coverage
89-
python-codacy-coverage -r test-reports/python3/coverage.xml
89+
python-codacy-coverage -r test-reports/coverage.xml
9090
9191
develop:
9292
# Test development installation
@@ -122,29 +122,30 @@ jobs:
122122
- store_artifacts:
123123
path: /logs
124124

125-
doc:
125+
documentation:
126126
# Test building documentation
127127
working_directory: /doc
128128
docker:
129129
- image: continuumio/miniconda3
130130
steps:
131131
- checkout
132+
- restore_cache:
133+
key: documentation-{{ .Branch }}
132134
- run:
133135
command: |
134-
. /opt/conda/etc/profile.d/conda.sh
135-
set -x
136136
mkdir /logs
137137
# Install
138-
conda update -y conda > /logs/conda.txt 2>&1
139-
conda env update >> /logs/conda.txt 2>&1
140-
set +x; conda activate esmvaltool; set -x
141-
pip install -e .[develop] > /logs/install.txt 2>&1
138+
pip install -r doc/sphinx/source/requirements.txt > /logs/install.txt 2>&1
139+
pip install sphinx sphinx_rtd_theme >> /logs/install.txt 2>&1
142140
# Log versions
143141
dpkg -l > /logs/versions.txt
144-
conda env export > /logs/environment.yml
145142
pip freeze > /logs/requirements.txt
146143
# Test building documentation
147-
python setup.py build_sphinx
144+
MPLBACKEND=Agg python setup.py build_sphinx --warning-is-error
145+
- save_cache:
146+
key: documentation-{{ .Branch }}
147+
paths:
148+
- ".eggs"
148149
- store_artifacts:
149150
path: /logs
150151

@@ -170,11 +171,11 @@ jobs:
170171
dpkg -l > /logs/versions.txt
171172
conda env export -n base > /logs/build_environment.yml
172173
# Build conda package
173-
conda build . -c conda-forge -c birdhouse > /logs/build_log.txt
174+
conda build . -c conda-forge -c esmvalgroup > /logs/build_log.txt
174175
# Install Python 3 conda package
175176
conda create -y --name esmvaltool3 > /logs/conda_esmvaltool3.txt 2>&1
176177
set +x; conda activate esmvaltool3; set -x
177-
conda install -y esmvaltool --use-local -c conda-forge -c birdhouse
178+
conda install -y esmvaltool --use-local -c conda-forge -c esmvalgroup
178179
conda env export > /logs/test_environment3.yml
179180
esmvaltool -h
180181
- store_artifacts:
@@ -200,7 +201,7 @@ jobs:
200201
conda create -y --name esmvaltool
201202
set +x; conda activate esmvaltool; set -x
202203
# Install
203-
conda install -y esmvaltool -c esmvalgroup -c conda-forge -c birdhouse
204+
conda install -y esmvaltool -c conda-forge -c esmvalgroup
204205
# Log versions
205206
conda env export > /logs/environment.yml
206207
# Test installation
@@ -238,8 +239,9 @@ workflows:
238239
version: 2
239240
commit:
240241
jobs:
241-
- python3_test
242-
- python3_install
242+
- test
243+
- test_installation
244+
- documentation
243245
nightly:
244246
triggers:
245247
- schedule:
@@ -250,10 +252,10 @@ workflows:
250252
- version2_development
251253
- version2_master
252254
jobs:
253-
- python3_test
254-
- python3_install
255+
- test
256+
- test_installation
255257
- develop
256-
- doc
258+
- documentation
257259
- conda_build
258260
- conda_install
259261
- ncl_cdo_test

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,8 @@ test-reports/
8383
/python_test_out.txt
8484

8585
# Build folder
86-
doc/sphinx/source/diag_scripts/**
87-
doc/sphinx/source/plot_scripts/**
8886
doc/sphinx/build
87+
doc/sphinx/source/gallery.rst
8988

9089
# Data files
9190
*.nc

CONTRIBUTING.md

Lines changed: 51 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,87 +7,100 @@ If you have a bug to report, please do so using the [issues tab on the ESMValToo
77
To get started developing, follow the instructions below. More detailed instructions can be found in the [manual](https://esmvaltool.readthedocs.io) under Developer's Guide.
88

99
## Getting started
10+
1011
To install in development mode, follow these instructions.
11-
- [Download and install conda](https://conda.io/projects/conda/en/latest/user-guide/install/linux.html) (this should be done even if the system in use already has a preinstalled version of conda, as problems have been reported with NCL when using such a version)
12-
- To make the `conda` command availble, add `source <prefix>/etc/profile.d/conda.sh` to your `.bashrc` file and restart your shell. If using (t)csh shell, add `source <prefix>/etc/profile.d/conda.csh` to your `.cshrc`/`.tcshrc` file instead.
13-
- Update conda: `conda update -y conda`
14-
- Clone the ESMValTool public github repository: `git clone git@github.com:ESMValGroup/ESMValTool.git`, or one of the private github repositories (e.g. `git clone git@github.com:ESMValGroup/ESMValTool-private.git`)
15-
- Go to the esmvaltool directory: `cd ESMValTool`
16-
- Create the esmvaltool conda environment `conda env create --name esmvaltool --file environment.yml`
17-
- Activate the esmvaltool environment: `conda activate esmvaltool`
18-
- Install in development mode: `pip install -e '.[develop]'`. If you are installing behind a proxy that does not trust the usual pip-urls you can declare them with the option `--trusted-host`, e.g. `pip install --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org -e .[develop]`
19-
- If you want to use R diagnostics, run `Rscript esmvaltool/install/R/setup.R` to install the R dependences.
20-
- If you want to use Julia diagnostics, run `julia esmvaltool/install/Julia/setup.jl` to install the Julia dependences.
21-
- Test that your installation was succesful by running `esmvaltool -h`.
22-
- If you log into a cluster or other device via `ssh` and your origin machine sends the `locale` environment via the `ssh` connection, make sure the environment is set correctly, specifically `LANG` and `LC_ALL` are set correctly (for GB English UTF-8 encoding these variables must be set to `en_GB.UTF-8`; you can set them by adding `export LANG=en_GB.UTF-8` and `export LC_ALL=en_GB.UTF-8` in your origin or login machines' `.profile`)
12+
13+
- [Download and install conda](https://conda.io/projects/conda/en/latest/user-guide/install/linux.html) (this should be done even if the system in use already has a preinstalled version of conda, as problems have been reported with NCL when using such a version)
14+
- To make the `conda` command availble, add `source <prefix>/etc/profile.d/conda.sh` to your `.bashrc` file and restart your shell. If using (t)csh shell, add `source <prefix>/etc/profile.d/conda.csh` to your `.cshrc`/`.tcshrc` file instead.
15+
- Update conda: `conda update -y conda`
16+
- Clone the ESMValTool public github repository: `git clone git@github.com:ESMValGroup/ESMValTool`, or one of the private github repositories (e.g. `git clone git@github.com:ESMValGroup/ESMValTool-private`)
17+
- Go to the esmvaltool directory: `cd ESMValTool`
18+
- Create the esmvaltool conda environment `conda env create --name esmvaltool --file environment.yml`
19+
- Activate the esmvaltool environment: `conda activate esmvaltool`
20+
- Install in development mode: `pip install -e '.[develop]'`. If you are installing behind a proxy that does not trust the usual pip-urls you can declare them with the option `--trusted-host`, e.g. `pip install --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org -e .[develop]`
21+
- If you want to use R diagnostics, run `Rscript esmvaltool/install/R/setup.R` to install the R dependences.
22+
- If you want to use Julia diagnostics, run `julia esmvaltool/install/Julia/setup.jl` to install the Julia dependences.
23+
- Test that your installation was succesful by running `esmvaltool -h`.
24+
- If you log into a cluster or other device via `ssh` and your origin machine sends the `locale` environment via the `ssh` connection, make sure the environment is set correctly, specifically `LANG` and `LC_ALL` are set correctly (for GB English UTF-8 encoding these variables must be set to `en_GB.UTF-8`; you can set them by adding `export LANG=en_GB.UTF-8` and `export LC_ALL=en_GB.UTF-8` in your origin or login machines' `.profile`)
25+
26+
## Using the development version of the ESMValTool Core package
27+
28+
If you need the latest developments of the ESMValTool Core package,
29+
you can install that into the same conda environment:
30+
31+
- Clone the ESMValTool Core github repository: `git clone git@github.com:ESMValGroup/ESMValCore`)
32+
- Go to the esmvalcore directory: `cd ESMValCore`
33+
- Update the esmvaltool conda environment `conda env update --name esmvaltool --file environment.yml`
34+
- Activate the esmvaltool environment: `conda activate esmvaltool`
35+
- Install `esmvalcore` in development mode: `pip install -e '.[develop]'`.
2336

2437
## Running tests
38+
2539
Go to the directory where the repository is cloned and run `python setup.py test --installation`. Tests will also be run automatically by [CircleCI](https://circleci.com/gh/ESMValGroup/ESMValTool).
2640

2741
## Code style
42+
2843
To increase the readability and maintainability or the ESMValTool source code, we aim to adhere to best practices and coding standards. All pull requests are reviewed and tested by one or more members of the core development team. For code in all languages, it is highly recommended that you split your code up in functions that are short enough to view without scrolling.
2944

3045
### Python
46+
3147
The standard document on best practices for Python code is [PEP8](https://www.python.org/dev/peps/pep-0008/) and there is [PEP257](https://www.python.org/dev/peps/pep-0257/) for documentation. We make use of [numpy style docstrings](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html) to document Python functions that are visible on [readthedocs](https://esmvaltool.readthedocs.io).
3248

3349
Most formatting issues in Python code can be fixed automatically by running the commands
34-
```
35-
isort some_file.py
36-
```
50+
51+
isort some_file.py
52+
3753
to sort the imports in the standard way and
38-
```
39-
yapf -i some_file.py
40-
```
54+
55+
yapf -i some_file.py
56+
4157
to add/remove whitespace as required by the standard.
4258

4359
To check if your code adheres to the standard, go to the directory where the repository is cloned, e.g. `cd ESMValTool`.
4460
and run
45-
```
46-
prospector esmvaltool/diag_scripts/your_diagnostic/your_script.py
47-
```
61+
62+
prospector esmvaltool/diag_scripts/your_diagnostic/your_script.py
63+
4864
Run
49-
```
50-
python setup.py lint
51-
```
65+
66+
python setup.py lint
67+
5268
to see the warnings about the code style of the entire project.
5369

5470
We use `pycodestyle` on CircleCI to automatically check that there are no formatting mistakes and Codacy for monitoring (Python) code quality. Running prospector locally will give you quicker and sometimes more accurate results.
5571

5672
### NCL
73+
5774
Because there is no standard best practices document for NCL, we use [PEP8](https://www.python.org/dev/peps/pep-0008/) for NCL code as well, with some minor adjustments to accomodate for differences in the languages. The most important difference is that for NCL code the indentation should be 2 spaces instead of 4.
5875

5976
### R
77+
6078
A document on best practices for R is [Hadley Wickham's R Style Guide](http://r-pkgs.had.co.nz/style.html). We partially check adherence to this style guide by using [lintr](https://cran.r-project.org/web/packages/lintr/index.html) on CircleCI. In the future we would also like to make use of [goodpractice](https://cran.r-project.org/web/packages/goodpractice/index.html) to assess the quality of R code.
6179

6280
### YAML
81+
6382
Please use `yamllint` to check that your YAML files do not contain mistakes.
6483

6584
## Documentation
6685

6786
### What should be documented
6887

69-
Any code documentation that is visible on [readthedocs](https://esmvaltool.readthedocs.io) should be well written and adhere to the standards for documentation for the respective language. Recipes should have a page in the *Recipes* section on readthedocs. This is also the place to document recipe options for the diagnostic scripts used in those recipes. Note that there is no need to write extensive documentation for functions that are not visible on readthedocs. However, adding a one line docstring describing what a function does is always a good idea.
88+
Any code documentation that is visible on [readthedocs](https://esmvaltool.readthedocs.io) should be well written and adhere to the standards for documentation for the respective language. Recipes should have a page in the _Recipes_ section on readthedocs. This is also the place to document recipe options for the diagnostic scripts used in those recipes. Note that there is no need to write extensive documentation for functions that are not visible on readthedocs. However, adding a one line docstring describing what a function does is always a good idea.
7089

7190
### How to build the documentation locally
91+
7292
Go to the directory where the repository is cloned and run
73-
```
74-
python setup.py build_sphinx -Ea
75-
```
93+
94+
python setup.py build_sphinx -Ea
95+
7696
Make sure that your newly added documentation builds without warnings or errors.
7797

7898
## Pull requests and code review
79-
New development should preferably be done in a new git branch in the main ESMValTool github repository. However, for scientists requiring confidentiality, private repositories are available. It is recommended that you open a pull request early, as this will cause CircleCI to run the unit tests and Codacy to analyse your code. It's also easier to get help from other developers if your code is visible in a pull request.
99+
100+
New development should preferably be done in a new git branch in the main ESMValTool github repository. However, for scientists requiring confidentiality, private repositories are available. It is recommended that you open a pull request early (in draft mode), as this will cause CircleCI to run the unit tests and Codacy to analyse your code. It's also easier to get help from other developers if your code is visible in a pull request.
80101

81102
You can view the results of the automatic checks below your pull request. If one of the tests shows a red cross instead of a green approval sign, please click the link and try to solve the issue. Note that this kind of automated checks make it easier to review code, but they are not flawless, so occasionally Codacy will report false positives.
82103

83104
### Diagnostic script contributions
84-
A pull request with diagnostic code should preferably not introduce new Codacy issues. However, we understand that there is a limit to how much time can be spend on polishing code, so up to 10 new (non-trivial) issues is still an acceptable amount.
85105

86-
Never make changes to the esmvaltool core, e.g. a new preprocessor function, in diagnostic script pull requests. If you need to make this kind of change, create a separate pull request for it in the public repository.
87-
88-
### Contributing to the core of ESMValTool
89-
Contributions to the core of ESMValTool should
90-
- Go into the public repository.
91-
- Preferably be covered by unit tests. Unit tests are mandatory for new preprocessor functions or modifications to existing functions. If you do not know how to start with writing unit tests, let us know in a comment on the pull request and a core development team member will try to help you get started.
92-
- Be accompanied by appropriate documentation.
93-
- Introduce no new issues on Codacy (but note that style issues reported in unit test code are not worth the effort of fixing).
106+
A pull request with diagnostic code should preferably not introduce new Codacy issues. However, we understand that there is a limit to how much time can be spend on polishing code, so up to 10 new (non-trivial) issues is still an acceptable amount.

0 commit comments

Comments
 (0)