Skip to content

Chore/update linting tools#125

Closed
mcocdawc wants to merge 15 commits intodevelopfrom
chore/update-linting-tools
Closed

Chore/update linting tools#125
mcocdawc wants to merge 15 commits intodevelopfrom
chore/update-linting-tools

Conversation

@mcocdawc
Copy link

@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 12 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>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@codecov-commenter
Copy link

codecov-commenter commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.23%. Comparing base (688d7f2) to head (f0bb739).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #125      +/-   ##
===========================================
- Coverage    99.24%   99.23%   -0.01%     
===========================================
  Files           27       27              
  Lines         2384     2363      -21     
  Branches        44       44              
===========================================
- Hits          2366     2345      -21     
  Misses           9        9              
  Partials         9        9              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
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

This PR updates and standardizes linting/formatting across the repository by migrating to ruff (including formatting and import sorting) and reformatting affected code, tests, and documentation accordingly.

Changes:

  • Replace black/isort pre-commit hooks with ruff (check + format) and add/adjust ruff configuration in pyproject.toml.
  • Apply repository-wide formatting updates to Python sources/tests and documentation examples/notebooks.
  • Normalize docstrings, imports, and minor style issues to satisfy the unified linting rules.

Reviewed changes

Copilot reviewed 48 out of 48 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/wind/test_wind.py Formatting updates to comply with new lint/format rules.
tests/vertical/test_xr_theta.py Formatting updates to comply with new lint/format rules.
tests/vertical/test_xr_monotonic.py Import formatting consolidation and minor docstring punctuation.
tests/vertical/test_array_vertical.py Formatting of parametrization and assertions.
tests/vertical/test_array_interpolate.py Docstring punctuation and formatting updates.
tests/thermo/test_thermo.py Docstring punctuation and parametrization formatting updates.
tests/stats/test_stats.py Formatting update for assertion call.
tests/solar/test_solar.py Formatting update for function signature/call.
tests/score/xarray/test_ensemble.py Import consolidation and minor whitespace cleanup.
tests/score/xarray/test_deterministic.py Reformatted multi-import to grouped import style.
tests/score/array/test_score.py Docstring punctuation and import consolidation.
tests/regimes/test_patterns.py Whitespace cleanup in test classes.
tests/regimes/test_index_xarray.py Import consolidation and whitespace cleanup.
tests/regimes/test_index_array.py Formatting updates for calls and whitespace cleanup.
src/earthkit/meteo/wind/array/init.py Module docstring normalized.
src/earthkit/meteo/vertical/interpolation.py Typing import consolidation and error message formatting.
src/earthkit/meteo/vertical/array/vertical.py Typing import consolidation; docstring section header normalization; formatting.
src/earthkit/meteo/vertical/array/monotonic.py Error message wrapping and formatting for readability/line length.
src/earthkit/meteo/vertical/array/hybrid.py Typing import consolidation; docstring header normalization; error formatting.
src/earthkit/meteo/vertical/array/init.py Module docstring normalized.
src/earthkit/meteo/vertical/init.py Whitespace cleanup.
src/earthkit/meteo/utils/testing.py Docstring punctuation normalized.
src/earthkit/meteo/thermo/array/thermo.py Formatting of expressions and docstring punctuation.
src/earthkit/meteo/thermo/array/init.py Module docstring normalized.
src/earthkit/meteo/thermo/init.py Whitespace cleanup.
src/earthkit/meteo/stats/array/quantiles.py Typing import consolidation; docstring punctuation; whitespace cleanup.
src/earthkit/meteo/stats/array/init.py Module docstring normalized.
src/earthkit/meteo/solar/array/init.py Module docstring normalized.
src/earthkit/meteo/score/xarray/ensemble.py Typing import consolidation; docstring line wrapping; minor formatting.
src/earthkit/meteo/score/xarray/deterministic.py Typing import consolidation; docstring wrapping; formatting.
src/earthkit/meteo/score/array/deterministic.py Docstring punctuation normalized.
src/earthkit/meteo/regimes/patterns.py Formatting of dict comprehensions/construction.
src/earthkit/meteo/regimes/array/index.py Error message formatting.
src/earthkit/meteo/regimes/init.py Import consolidation.
src/earthkit/meteo/extreme/array/sot.py Docstring punctuation and exception formatting.
src/earthkit/meteo/extreme/array/efi.py Docstring punctuation and whitespace cleanup.
src/earthkit/meteo/extreme/array/cpf.py Docstring punctuation normalized.
src/earthkit/meteo/extreme/array/init.py Module docstring normalized.
pyproject.toml Add ruff config; reformat TOML; reorganize project metadata.
docs/release_notes/include/migrated_hybrid_pressure_at_height_levels.py Formatting update for example call.
docs/examples/seven_weather_regimes.ipynb Notebook formatting changes (imports, commas, whitespace).
docs/examples/return_period.ipynb Notebook formatting changes (imports, list formatting, floats).
docs/examples/interpolate_pl_to_pl.ipynb Notebook formatting changes (comments, calls).
docs/examples/interpolate_pl_to_hl.ipynb Notebook formatting changes (calls, floats, whitespace).
docs/examples/interpolate_hybrid_to_pl.ipynb Notebook formatting changes (calls, floats, whitespace).
docs/examples/interpolate_hybrid_to_hl.ipynb Notebook formatting/pretty-print of JSON and code cells.
docs/examples/hybrid_levels.ipynb Notebook formatting changes (comments, calls, whitespace).
.pre-commit-config.yaml Switch pre-commit lint/format hooks to ruff and add TOML formatting hook.

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

@mcocdawc mcocdawc requested a review from Oisin-M March 17, 2026 13:04
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.
@mcocdawc
Copy link
Author

Close in favour of #130 due to amount of merge conflicts

@mcocdawc mcocdawc closed this Mar 27, 2026
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