Skip to content

Chore/update linting tools#87

Merged
EddyCMWF merged 8 commits intomainfrom
chore/update-linting-tools
Mar 18, 2026
Merged

Chore/update linting tools#87
EddyCMWF merged 8 commits intomainfrom
chore/update-linting-tools

Conversation

@mcocdawc
Copy link
Copy Markdown
Contributor

@mcocdawc mcocdawc commented Mar 16, 2026

Description

Updated and unified the pre-commit hooks in all earthkit packages.
Some of them were failing the test suite just because of the pre-commit hooks.
Fixing this it was a good opportunity to unify settings.

Uses now ruff for formatting (former black), linting, and import sort (former isort)

The following PRs do the same changes in all the earthkit packages:

Contributor Declaration

By opening this pull request, I affirm the following:

  • All authors agree to the Contributor License Agreement.
  • The code follows the project's coding standards.
  • I have performed self-review and added comments where needed.
  • I have added or updated tests to verify that my changes are effective and functional.
  • I have run all existing tests and confirmed they pass.

mcocdawc and others added 8 commits March 16, 2026 12:04
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates and standardizes linting/formatting across the repository by moving to ruff for formatting, linting, and import sorting, and aligning the pre-commit configuration so code quality checks don’t spuriously fail CI.

Changes:

  • Switch/align pre-commit hooks to run ruff for linting (ruff-check) and formatting (ruff-format).
  • Update Ruff configuration in pyproject.toml (line length and lint rule selection/ignores).
  • Apply automated formatting changes across tests, library modules, and documentation notebooks.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
.pre-commit-config.yaml Updates pre-commit to use Ruff hooks and configured arguments.
pyproject.toml Centralizes Ruff configuration (line length, lint selects/ignores).
src/earthkit/transforms/temporal/_rates.py Formatting-only changes to attribute/history string construction.
src/earthkit/transforms/temporal/_aggregate.py Formatting-only changes to list comprehensions/array creation.
src/earthkit/transforms/spatial/_aggregate.py Formatting-only changes to return call and list comprehension layout.
src/earthkit/transforms/climatology/_aggregate.py Formatting-only changes to relative anomaly expression and return call.
src/earthkit/transforms/_tools.py Formatting-only changes to raised error strings and list comprehension layout.
tests/test_30_temporal_rates.py Formatting-only changes to calls/expressions for Ruff formatting compliance.
tests/test_30_temporal_aggregate.py Formatting-only changes to an all(...) assertion.
tests/test_30_spatial.py Formatting-only changes to DataArray creation and function calls.
tests/test_20_aggregate.py Formatting-only changes to a helper call.
tests/test_10_tools.py Formatting-only changes to DataArray/Dataset literals and calls.
tests/legacy-api/test_legacy_30_temporal.py Mirrors formatting changes in legacy API tests.
tests/legacy-api/test_legacy_10_tools.py Mirrors formatting changes in legacy API tests.
docs/notebooks/temporal/05-accumulation-to-rate-examples.ipynb Notebook cell formatting updates consistent with Ruff formatting.
docs/notebooks/temporal/03-seas5-daily-statistics.ipynb Notebook cell formatting updates.
docs/notebooks/temporal/02-era5-daily-monthly-statistics.ipynb Notebook cell formatting updates.
docs/notebooks/spatial/02-era5-reduce-data-over-geometries.ipynb Notebook cell formatting updates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mcocdawc mcocdawc requested a review from EddyCMWF March 17, 2026 15:05
@EddyCMWF EddyCMWF merged commit e112115 into main Mar 18, 2026
137 checks passed
@EddyCMWF EddyCMWF deleted the chore/update-linting-tools branch March 18, 2026 10:14
@EddyCMWF
Copy link
Copy Markdown
Collaborator

Hi Oskar,
Approved and merged, however in preparation for version 1.0.0 I have been working on a release candidate branch, and I have a feeling this may lead to conflicts. I will see what I can merge.
Thanks,
Eddy

@mcocdawc
Copy link
Copy Markdown
Contributor Author

Great, thank you very much.

mcocdawc added a commit to ecmwf/earthkit-plots that referenced this pull request Mar 23, 2026
Updated and unified the pre-commit hooks in all earthkit packages. 
Some of them were failing the test suite just because of the pre-commit hooks. 
Fixing this it was a good opportunity to unify settings.

Uses now `ruff` for formatting (former `black`), linting, and import sort (former `isort`)

The following PRs do the same changes in all the earthkit packages:

- ecmwf/earthkit-climate#43
- ecmwf/earthkit-data#927
- ecmwf/earthkit-geo#39
- ecmwf/earthkit-hydro#178
- ecmwf/earthkit-meteo#125
- #176
- ecmwf/earthkit-time#14
- ecmwf/earthkit-transforms#87
- ecmwf/earthkit-workflows#173

In `earthkit-plots` in particular, it prevents now directly pushing to `develop` and checks the pre-commit hooks as part of the CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants