Skip to content

Chore/update linting tools#176

Merged
mcocdawc merged 26 commits intodevelopfrom
chore/update-linting-tools
Mar 23, 2026
Merged

Chore/update linting tools#176
mcocdawc merged 26 commits intodevelopfrom
chore/update-linting-tools

Conversation

@mcocdawc
Copy link
Contributor

@mcocdawc mcocdawc commented Mar 16, 2026

  • manually fix the remaining linting errors; requires discussion with reviewers/maintainers.

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:

In earthkit-plots in particular, it prevents now directly pushing to develop and checks the pre-commit hooks as part of the CI.


Add the mpl references for tests and remove the directory from the .gitignore.

The only remaining failing tests are:

FAILED tests/images/test_healpix.py::test_healpix_interpolated - ImportError: Regridding not available. Please install the earthkit-regrid package.
FAILED tests/images/test_healpix.py::test_healpix_pixels - ImportError: The healpix plotting backend requires the healpy package.
FAILED tests/images/test_octahedral.py::test_octahedral_interpolated - ImportError: Regridding not available. Please install the earthkit-regrid package.

As the earthkit-regrid package is deprecated AFAIK, I don't know if the 1st and 3rd test should be fixed or simply removed.
Re the 2nd test. Either healpy should be added as a strict dependency, or the test should only be executed if healpy is installed. That's a call one of the maintainers has to make.

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 10 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>
@mcocdawc
Copy link
Contributor Author

mcocdawc commented Mar 17, 2026

@JamesVarndell The remaining failing tests already fail in develop as well. Fixing in #177

Copy link

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 standardizes linting/formatting across the project by migrating pre-commit hooks and code style tooling to Ruff, and applies the resulting formatting changes across source, tests, and documentation notebooks.

Changes:

  • Replaced Black/isort-driven formatting with Ruff (ruff-check + ruff-format) and added Ruff configuration to pyproject.toml.
  • Updated .pre-commit-config.yaml to run Ruff linting/fixes and Ruff formatting.
  • Applied formatting-only updates across Python sources, tests, and many Jupyter notebooks to match the new style.

Reviewed changes

Copilot reviewed 111 out of 113 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/utils/test_string_utils.py Ruff formatting updates in tests.
tests/test_schemas.py Ruff formatting updates in tests.
tests/test_identifiers.py Ruff formatting updates in tests.
tests/styles/test_style_features.py Ruff formatting updates in tests.
tests/sources/test_xarray.py Ruff formatting updates in tests.
tests/sources/test_numpy.py Ruff formatting updates in tests.
tests/metadata/test_formatters.py Ruff formatting updates in tests.
tests/interactive/test_polar.py Ruff formatting updates in tests.
tests/images/test_mulitple_layers.py Ruff formatting updates in image tests.
tests/images/test_anemoi_use_case.py Ruff formatting updates in image tests.
tests/geo/test_natural_earth.py Ruff formatting updates in geo tests.
tests/geo/test_grids.py Ruff formatting updates in geo tests.
tests/geo/test_geometry.py Ruff formatting updates in geo tests.
tests/geo/test_domains.py Ruff formatting updates in geo tests.
tests/components/test_figures.py Minor docstring casing/formatting updates in tests.
src/earthkit/plots/styles/levels.py Ruff formatting updates in style levels.
src/earthkit/plots/styles/legends.py Ruff formatting updates in legends helpers.
src/earthkit/plots/styles/colors/init.py Docstring punctuation tweak.
src/earthkit/plots/styles/init.py Ruff formatting updates in core Style implementation.
src/earthkit/plots/sources/extractors/xarray.py Ruff formatting updates in xarray extractor.
src/earthkit/plots/sources/extractors/numpy.py Ruff formatting updates in numpy extractor.
src/earthkit/plots/sources/extractors/earthkit.py Ruff formatting updates in earthkit extractor.
src/earthkit/plots/sources/init.py Ruff formatting updates in Source/dimension handling.
src/earthkit/plots/shortcuts.py Ruff formatting updates to shortcuts helpers.
src/earthkit/plots/schemas.py Ruff formatting updates in schema utilities.
src/earthkit/plots/resample.py Ruff formatting updates in resampling utilities.
src/earthkit/plots/quickplot.py Formatting changes + docstring line wrapping.
src/earthkit/plots/quickmap.py Formatting changes + docstring punctuation.
src/earthkit/plots/plottypes/statistics.py Docstring punctuation + formatting updates.
src/earthkit/plots/metadata/labels.py Ruff formatting updates in label helpers.
src/earthkit/plots/metadata/formatters.py Ruff formatting updates in metadata formatters.
src/earthkit/plots/interactive/polar.py Ruff formatting updates in polar plotting.
src/earthkit/plots/interactive/inputs.py Ruff formatting updates in interactive inputs utilities.
src/earthkit/plots/interactive/heat.py Ruff formatting updates in interactive heatmap.
src/earthkit/plots/interactive/charts.py Ruff formatting updates in interactive chart class.
src/earthkit/plots/interactive/box.py Ruff formatting updates in interactive box plot.
src/earthkit/plots/identifiers.py Ruff formatting updates in identifier helpers.
src/earthkit/plots/geo/regrid.py Ruff formatting updates in regridding helpers.
src/earthkit/plots/geo/optimisers.py Docstring + formatting updates.
src/earthkit/plots/geo/octahedral.py Formatting + docstring section header normalization.
src/earthkit/plots/geo/natural_earth.py Ruff formatting updates in Natural Earth helpers.
src/earthkit/plots/geo/healpix.py Formatting + minor docstring punctuation.
src/earthkit/plots/geo/grids.py Ruff formatting updates in grids helpers.
src/earthkit/plots/geo/gisco.py Ruff formatting updates in GISCO helpers.
src/earthkit/plots/geo/geometry.py Ruff formatting updates in geometry helpers.
src/earthkit/plots/geo/domains.py Ruff formatting updates in Domain helpers.
src/earthkit/plots/geo/coordinate_reference_systems.py Ruff formatting updates in CRS helpers.
src/earthkit/plots/geo/bounds.py Ruff formatting updates in bounds helpers.
src/earthkit/plots/components/ticks.py Formatting/docstring wrapping updates.
src/earthkit/plots/components/subplots.py Formatting/docstring wrapping updates.
src/earthkit/plots/components/maps.py Formatting/docstring wrapping updates.
src/earthkit/plots/components/layouts.py Formatting cleanup.
src/earthkit/plots/components/layers.py Formatting/docstring compacting updates.
src/earthkit/plots/components/figures.py Formatting/docstring wrapping updates.
src/earthkit/plots/components/extractors.py Formatting updates in plotting extractors.
src/earthkit/plots/cli/parsers.py Formatting updates in YAML CLI parser.
src/earthkit/plots/ancillary.py Formatting updates in ancillary loader errors.
pyproject.toml Remove isort config; add Ruff configuration (line length, lint selects/ignores).
docs/examples/sandbox.ipynb Notebook formatting (quotes/whitespace).
docs/examples/reduced_gg.ipynb Notebook formatting (expressions/whitespace).
docs/examples/guide/figures-and-subplots.ipynb Notebook formatting (imports/quotes).
docs/examples/guide/06-reusable-code.ipynb Notebook whitespace formatting.
docs/examples/guide/04-styles.ipynb Notebook whitespace formatting.
docs/examples/guide/03-components.ipynb Notebook whitespace + expression formatting.
docs/examples/gallery/vector-data/vector-styles.ipynb Notebook formatting (string concatenation).
docs/examples/gallery/vector-data/Untitled.ipynb Notebook formatting/cleanup.
docs/examples/gallery/time-series/timeseries.ipynb Notebook formatting (trailing commas).
docs/examples/gallery/time-series/simple-line.ipynb Notebook import ordering/spacing.
docs/examples/gallery/time-series/global-average-temperature.ipynb Notebook formatting (imports + long lines).
docs/examples/gallery/time-series/era5-precip.ipynb Notebook formatting (trailing commas + spacing).
docs/examples/gallery/time-series/cmip6.ipynb Notebook formatting (quotes + line wrapping).
docs/examples/gallery/tiles/tiles.ipynb Notebook content changed (cells emptied).
docs/examples/gallery/point-data/usa-temperature-obs.ipynb Notebook formatting (long call collapsed).
docs/examples/gallery/point-data/satellite-level2-co2.ipynb Notebook formatting (kwargs spacing).
docs/examples/gallery/interactive/meteogram.ipynb Notebook formatting (import order + quotes).
docs/examples/gallery/hovmoeller/hovmoeller.ipynb Notebook formatting (import ordering + call wrapping).
docs/examples/gallery/gridded-data/weather-forecast-steps.ipynb Notebook formatting (imports + long call wrapping).
docs/examples/gallery/gridded-data/vorticity-over-andes.ipynb Notebook formatting (list layout + expressions).
docs/examples/gallery/gridded-data/unstructured-grids.ipynb Notebook formatting (imports/spacing).
docs/examples/gallery/gridded-data/true-color-satellite.ipynb Notebook formatting (imports + dict quoting).
docs/examples/gallery/gridded-data/time-zones.ipynb Notebook formatting (quotes/spacing).
docs/examples/gallery/gridded-data/temperature-and-pressure.ipynb Notebook formatting (imports/spacing).
docs/examples/gallery/gridded-data/numpy-arrays.ipynb Notebook formatting (imports/spacing).
docs/examples/gallery/gridded-data/model-orography.ipynb Notebook formatting (expression spacing).
docs/examples/gallery/gridded-data/hatched-shading.ipynb Notebook formatting (string repetition spacing).
docs/examples/gallery/gridded-data/globe.ipynb Notebook formatting (imports + dict quoting).
docs/examples/gallery/gridded-data/el-nino.ipynb Notebook formatting (call wrapping).
docs/examples/gallery/gridded-data/efas.ipynb Notebook formatting (imports/spacing).
docs/examples/gallery/gridded-data/categorical-data.ipynb Notebook formatting (imports/spacing).
docs/examples/gallery/grid-types/reduced-gg-point-cloud.ipynb Notebook formatting (imports/spacing).
docs/examples/gallery/grid-types/reduced-gg-interpolated.ipynb Notebook formatting (imports/spacing).
docs/examples/gallery/grid-types/reduced-gg-grid-cells.ipynb Notebook formatting (imports/spacing).
docs/examples/gallery/grid-types/octahedral-cells.ipynb Notebook formatting (escape handling).
docs/examples/gallery/grid-types/healpix-point-cloud.ipynb Notebook formatting (imports/spacing).
docs/examples/gallery/grid-types/healpix-pixels.ipynb Notebook formatting (imports/spacing).
docs/examples/gallery/grid-types/healpix-interpolated.ipynb Notebook formatting (imports/spacing).
docs/examples/gallery/domains/domain-union.ipynb Notebook formatting (quotes/spacing).
docs/examples/gallery/domains/cartopy-crs.ipynb Notebook formatting (import order/spacing).
docs/examples/gallery/animation.ipynb Notebook formatting (imports + quotes).
docs/examples/examples/vectors-styles.ipynb Notebook formatting (string concatenation).
docs/examples/examples/unstructured-data.ipynb Notebook formatting (spacing + trailing commas).
docs/examples/examples/string-formatting-units.ipynb Notebook whitespace + string concatenation formatting.
docs/examples/examples/string-formatting-time.ipynb Notebook formatting (string concatenation).
docs/examples/examples/plotting-and-styling-vector-data.ipynb Notebook import ordering formatting.
docs/examples/examples/plotting-and-styling-isolines.ipynb Notebook formatting (trailing commas + call layout).
docs/examples/examples/isolines-basics.ipynb Notebook comment spacing formatting.
docs/examples/examples/interactive-windrose-plot.ipynb Notebook formatting (imports, quotes, long calls).
docs/examples/examples/interactive-line-plot.ipynb Notebook formatting (quotes + long lines).
docs/examples/examples/interactive-heatmap-plot.ipynb Notebook formatting (quotes + wrapping).
docs/examples/examples/interactive-bar-plot.ipynb Notebook formatting (spacing + dict layout).
docs/examples/ads.ipynb Notebook formatting (quotes + call layout).
docs/Untitled.ipynb Notebook formatting (trailing commas).
.pre-commit-config.yaml Replace Black/isort hooks with Ruff check/format hooks; update other hook revisions.

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

@mcocdawc mcocdawc mentioned this pull request Mar 17, 2026
@mcocdawc mcocdawc merged commit 823c908 into develop Mar 23, 2026
133 checks passed
@mcocdawc mcocdawc deleted the chore/update-linting-tools branch March 23, 2026 21:25
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.

4 participants