Skip to content

Commit

Permalink
Merge branch 'main' into plop_str_io
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriupredoi committed Sep 27, 2024
2 parents e5c4d01 + 4b0dd41 commit 4e18994
Show file tree
Hide file tree
Showing 538 changed files with 26,966 additions and 22,604 deletions.
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ commands:
mkdir -p test-reports
. /opt/conda/etc/profile.d/conda.sh
conda activate esmvaltool
flake8 -j 4
pytest -n 4 --junitxml=test-reports/report.xml
esmvaltool version
- store_test_results:
Expand Down
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ indent_size = 2

[*.{md,Rmd}]
trim_trailing_whitespace = false

2 changes: 0 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
esmvalcore/cmor @jvegasbsc
.github/workflows @valeriupredoi

2 changes: 0 additions & 2 deletions .github/workflows/create-condalock-file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ jobs:
run: |
esmvaltool --help
esmvaltool version
- name: Run flake8
run: flake8
- name: Run pytests
run: pytest -n 2 -m "not installation"
# Automated PR
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/install-from-condalock-file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ jobs:
- run: pip install -e .[develop]
- run: esmvaltool --help
- run: esmvaltool version 2>&1 | tee source_install_linux_artifacts_python_${{ matrix.python-version }}/version.txt
- run: flake8
- run: pytest -n 2 -m "not installation"
- name: Upload artifacts
if: ${{ always() }} # upload artifacts even if fail
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ jobs:
- run: conda list
- run: pip install -e .[develop] 2>&1 | tee test_linux_artifacts_python_${{ matrix.python-version }}/install.txt
- run: conda list
- run: flake8
- run: |
pre-commit install
pre-commit run -a
- run: pytest -n 2 -m "not installation" 2>&1 | tee test_linux_artifacts_python_${{ matrix.python-version }}/test_report.txt
- name: Upload artifacts
if: ${{ always() }} # upload artifacts even if fail
Expand Down Expand Up @@ -97,7 +99,9 @@ jobs:
- run: conda list
- run: pip install -e .[develop] 2>&1 | tee test_osx_artifacts_python_${{ matrix.python-version }}/install.txt
- run: conda list
- run: flake8
- run: |
pre-commit install
pre-commit run -a
- run: pytest -n 2 -m "not installation" 2>&1 | tee test_osx_artifacts_python_${{ matrix.python-version }}/test_report.txt
- name: Upload artifacts
if: ${{ always() }} # upload artifacts even if fail
Expand Down
35 changes: 13 additions & 22 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ exclude: |
(?x)
^doc/conf.py|
^esmvalcore/cmor/tables/|
^esmvalcore/preprocessor/ne_masks/
^esmvalcore/preprocessor/ne_masks/|
^esmvalcore/preprocessor/shapefiles/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-ast
Expand All @@ -22,33 +24,22 @@ repos:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- repo: https://github.com/adrienverge/yamllint
rev: 'v1.31.0'
rev: 'v1.35.1'
hooks:
- id: yamllint
- repo: https://github.com/codespell-project/codespell
rev: 'v2.2.4'
rev: 'v2.3.0'
hooks:
- id: codespell
- repo: https://github.com/PyCQA/isort
rev: '5.12.0'
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-yapf
rev: 'v0.32.0'
hooks:
- id: yapf
additional_dependencies:
- 'toml'
- repo: https://github.com/myint/docformatter
rev: 'v1.6.5'
hooks:
- id: docformatter
- repo: https://github.com/pycqa/flake8
rev: '6.0.0'
additional_dependencies: [tomli] # required for Python 3.10
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.6.8"
hooks:
- id: flake8
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.2.0'
rev: 'v1.11.2'
hooks:
- id: mypy
additional_dependencies:
Expand Down
17 changes: 11 additions & 6 deletions .prospector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,21 @@ test-warnings: true
member-warnings: false

pyroma:
run: true
run: true

pep8:
full: true
full: true
# ignore rules that conflict with ruff formatter
# E203: https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#slices
# E501: https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
# W503: https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
disable: ['E203', 'E501', 'W503']

mypy:
run: true

pep257:
# disable rules that are allowed by the numpy convention
# see https://github.com/PyCQA/pydocstyle/blob/master/src/pydocstyle/violations.py
# and http://pydocstyle.readthedocs.io/en/latest/error_codes.html
disable: ['D107', 'D203', 'D212', 'D213', 'D402', 'D413', 'D416']
# disable rules that are allowed by the numpy convention
# see https://github.com/PyCQA/pydocstyle/blob/master/src/pydocstyle/violations.py
# and http://pydocstyle.readthedocs.io/en/latest/error_codes.html
disable: ['D107', 'D203', 'D212', 'D213', 'D402', 'D413', 'D416']
9 changes: 9 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---

extends: default

rules:
line-length:
level: warning
max: 120
octal-values: enable
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ authors:
affiliation: "DLR, Germany"
family-names: Cammarano
given-names: Diego
-
-
affiliation: "ACCESS-NRI, Australia"
family-names: Yousong
given-names: Zeng
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
level of experience, education, socioeconomic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards
Expand Down
2 changes: 0 additions & 2 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,3 @@ In addition to using the Software, we encourage the community to join the Softwa
To join the ESMValTool Development Team, please contact Dr. Birgit Hassler ([email protected]) and Dr. Axel Lauer ([email protected]).

==========================================


2 changes: 1 addition & 1 deletion doc/api/esmvalcore.dataset.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Dataset
=======
========

.. automodule:: esmvalcore.dataset
:no-show-inheritance:
2 changes: 1 addition & 1 deletion doc/api/esmvalcore.experimental.recipe.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _api_recipe:

Recipes
=======
========

This section describes the :py:mod:`~esmvalcore.experimental.recipe` submodule of the API (:py:mod:`esmvalcore.experimental`).

Expand Down
2 changes: 1 addition & 1 deletion doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ Highlights
~~~~~~~~~~

- ESMValCore now has the ability to automatically download missing data from ESGF. For details, see :ref:`Data Retrieval<data-retrieval>`.
- ESMValCore now also can resume an earlier run. This is useful to re-use expensive preprocessor results. For details, see :ref:`Running<running>`.
- ESMValCore now also can resume an earlier run. This is useful to reuse expensive preprocessor results. For details, see :ref:`Running<running>`.

This release includes

Expand Down
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
templates_path = ['_templates']

# The suffix of source filenames.
source_suffix = '.rst'
source_suffix = {'.rst': 'restructuredtext'}

# The encoding of source files.
# source_encoding = 'utf-8-sig'
Expand Down
82 changes: 38 additions & 44 deletions doc/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Please keep the following considerations in mind when programming:
code.
- If you find yourself copy-pasting a piece of code and making minor changes
to every copy, instead put the repeated bit of code in a function that you can
re-use, and provide the changed bits as function arguments.
reuse, and provide the changed bits as function arguments.
- Be careful when changing existing unit tests to make your new feature work.
You might be breaking existing features if you have to change existing tests.

Expand Down Expand Up @@ -210,6 +210,14 @@ This includes checks for invalid syntax and formatting errors.
automatically just before you commit your code.
It knows knows which tool to run for each filetype, and therefore provides
a convenient way to check your code.
Install the pre-commit hooks by running

.. code-block:: bash
pre-commit install
to make sure your code is formatted correctly and does not contain mistakes
whenever you commit some changes.

Python
~~~~~~
Expand All @@ -229,20 +237,22 @@ the repository is cloned, e.g. ``cd ESMValCore``, and run `prospector <http://pr

prospector esmvalcore/preprocessor/_regrid.py

In addition to prospector, we use `flake8 <https://flake8.pycqa.org/en/latest/>`_
to automatically check for bugs and formatting mistakes and
In addition to prospector, we use `ruff <https://docs.astral.sh/ruff/>`_
to automatically format the code and to check for certain bugs and
`mypy <https://mypy.readthedocs.io>`_ for checking that
`type hints <https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html>`_ are
correct.
Note that `type hints`_ are completely optional, but if you do choose to add
them, they should be correct.
Both `ruff`_ and `mypy`_ are automatically run by pre-commit.

When you make a pull request, adherence to the Python development best practices
is checked in two ways:

#. As part of the unit tests, flake8_ and mypy_ are run by
`CircleCI <https://app.circleci.com/pipelines/github/ESMValGroup/ESMValCore>`_,
see the section on Tests_ for more information.
#. A check that the code is formatted using the pre-commit hooks and does
not contain any mistakes that can be found by analyzing the code without
running it, is performed by
`pre-commit.ci <https://results.pre-commit.ci/latest/github/ESMValGroup/ESMValCore/main>`_.
#. `Codacy <https://app.codacy.com/gh/ESMValGroup/ESMValCore/pullRequests>`_
is a service that runs prospector (and other code quality tools) on changed
files and reports the results.
Expand All @@ -259,42 +269,25 @@ If you suspect prospector or Codacy may be wrong, please ask the
Note that running prospector locally will give you quicker and sometimes more
accurate results than waiting for Codacy.

Most formatting issues in Python code can be fixed automatically by
running the commands
Formatting issues in Python code can be fixed automatically by running the
command

::

isort some_file.py

to sort the imports in `the standard way <https://www.python.org/dev/peps/pep-0008/#imports>`__
using `isort <https://pycqa.github.io/isort/>`__ and

::

yapf -i some_file.py

to add/remove whitespace as required by the standard using `yapf <https://github.com/google/yapf>`__,

::

docformatter -i some_file.py

to run `docformatter <https://github.com/myint/docformatter>`__ which helps
formatting the docstrings (such as line length, spaces).
pre-commit run --all

YAML
~~~~

Please use `yamllint <https://yamllint.readthedocs.io>`_ to check that your
YAML files do not contain mistakes.
``yamllint`` checks for valid syntax, common mistakes like key repetition and
cosmetic problems such as line length, trailing spaces, wrong indentation, etc.
We use `yamllint <https://yamllint.readthedocs.io>`_ to check that YAML files
do not contain mistakes. This is automatically run by pre-commit.

Any text file
~~~~~~~~~~~~~

A generic tool to check for common spelling mistakes is
`codespell <https://pypi.org/project/codespell/>`__.
This is automatically run by pre-commit.

.. _documentation:

Expand Down Expand Up @@ -379,21 +372,22 @@ the individual checks.
To build the documentation on your own computer, go to the directory where the
repository was cloned and run

::
.. code-block:: bash
sphinx-build doc doc/build
or

::
.. code-block:: bash
sphinx-build -Ea doc doc/build
to build it from scratch.

Make sure that your newly added documentation builds without warnings or
errors and looks correctly formatted.
CircleCI_ will build the documentation with the command:
`CircleCI <https://app.circleci.com/pipelines/github/ESMValGroup/ESMValCore>`_
will build the documentation with the command:

.. code-block:: bash
Expand Down Expand Up @@ -720,7 +714,7 @@ If the Codacy check keeps failing, please run prospector locally.
If necessary, ask the pull request author to do the same and to address the
reported issues.
See the section on code_quality_ for more information.
Never merge a pull request with failing CircleCI or readthedocs checks.
Never merge a pull request with failing pre-commit, CircleCI, or readthedocs checks.


.. _how-to-make-a-release:
Expand All @@ -743,15 +737,15 @@ Perform the steps listed below with two persons, to reduce the risk of error.
`PyPI <https://pypi.org/project/ESMValCore/>`__, and
`readthedocs <https://readthedocs.org/dashboard/esmvalcore/users/>`__.

The release of ESMValCore is tied to the release of ESMValTool.
The release of ESMValCore is tied to the release of ESMValTool.
The detailed steps can be found in the ESMValTool
:ref:`documentation <esmvaltool:release_steps>`.
To start the procedure, ESMValCore gets released as a
To start the procedure, ESMValCore gets released as a
release candidate to test the recipes in ESMValTool. If bugs are found
during the testing phase of the release candidate, make as many release
candidates for ESMValCore as needed in order to fix them.
during the testing phase of the release candidate, make as many release
candidates for ESMValCore as needed in order to fix them.

To make a new release of the package, be it a release candidate or the final release,
To make a new release of the package, be it a release candidate or the final release,
follow these steps:

1. Check that all tests and builds work
Expand Down Expand Up @@ -795,13 +789,13 @@ Use the script
to create create a draft of the release notes.
This script uses the titles and labels of merged pull requests since the
previous release.
Open a discussion to allow members of the development team to nominate pull
requests as highlights. Add the most voted pull requests as highlights at the
beginning of changelog. After the highlights section, list any backward
incompatible changes that the release may include. The
Open a discussion to allow members of the development team to nominate pull
requests as highlights. Add the most voted pull requests as highlights at the
beginning of changelog. After the highlights section, list any backward
incompatible changes that the release may include. The
:ref:`backward compatibility policy<esmvaltool:backward-compatibility-policy>`.
lists the information that should be provided by the developer of any backward
incompatible change. Make sure to also list any deprecations that the release
lists the information that should be provided by the developer of any backward
incompatible change. Make sure to also list any deprecations that the release
may include, as well as a brief description on how to upgrade a deprecated feature.
Review the results, and if anything needs changing, change it on GitHub and
re-run the script until the changelog looks acceptable.
Expand Down
2 changes: 1 addition & 1 deletion doc/gensidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _toctree():
def _endl():
lines.append("")

def _write(project, desc, link, mapping=conf['intersphinx_mapping']):
def _write(project, desc, link, mapping=conf["intersphinx_mapping"]):
if project != conf_api:
if do_gen:
args = desc, mapping[project][0], link
Expand Down
Loading

0 comments on commit 4e18994

Please sign in to comment.