Skip to content

Chore/update linting tools#14

Open
mcocdawc wants to merge 16 commits intodevelopfrom
chore/update-linting-tools
Open

Chore/update linting tools#14
mcocdawc wants to merge 16 commits intodevelopfrom
chore/update-linting-tools

Conversation

@mcocdawc
Copy link
Copy Markdown

@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:

Fixes the testsuite.
Before it failed when doing

pip install .
pytest

only an editable install, i.e.

pip install -e .
pytest

worked.

For this also changed to absolute over relative imports.

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 9 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>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.57%. Comparing base (ee199f1) to head (3486b11).

Additional details and impacted files
@@             Coverage Diff              @@
##           develop      #14       +/-   ##
============================================
+ Coverage    61.33%   99.57%   +38.23%     
============================================
  Files           24       11       -13     
  Lines         1239      467      -772     
============================================
- Hits           760      465      -295     
+ Misses         479        2      -477     

☔ 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
Copy Markdown

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 the linting and formatting toolchain for earthkit-time, replacing black and isort with ruff, and converting relative imports to absolute imports to fix non-editable installs. This is part of a coordinated effort across all earthkit packages.

Changes:

  • Replaced black/isort with ruff for formatting, linting, and import sorting; added .pre-commit-config.yaml and QA workflow
  • Converted all relative imports to absolute imports (e.g., from .calendarfrom earthkit.time.calendar) to fix pip install . (non-editable) installs
  • Reformatted code to comply with 120-character line length and ruff's formatting style

Reviewed changes

Copilot reviewed 24 out of 28 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.pre-commit-config.yaml New pre-commit config with ruff, mdformat, yaml/toml formatters, gitleaks
.github/workflows/qa.yml New QA workflow for pre-commit and pytest
.github/workflows/ci.yml Removed python_qa: true, YAML formatting fixes
.github/workflows/cd.yml YAML formatting fix
.github/workflows/cd-test-pypi.yml New test-cd workflow for test PyPI
pyproject.toml Added ruff config, removed isort/black config, removed "src" from testpaths
src/earthkit/time/sequence.py Absolute imports, docstring periods, ruff reformatting
src/earthkit/time/climatology.py Absolute imports, docstring periods, ruff reformatting
src/earthkit/time/calendar.py Docstring periods
src/earthkit/time/data/__init__.py Ruff reformatting, docstring periods
src/earthkit/time/cli/*.py Absolute imports, ruff reformatting
tests/*.py Ruff reformatting (line length changes)
CHANGELOG.md Changed * to - for list items
README.md Minor formatting fixes
.readthedocs.yaml YAML indentation fix
docs/api/sequence.rst Trailing whitespace removal
src/earthkit/time/data/sequences/*.yaml Trailing whitespace fixes

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

to_weekday,
)

from .data import load_yaml
testpaths = [
"src",
"tests",
"tests"
pyproject.toml Outdated
[tool.ruff.lint]
ignore = [
"D1", # pydocstyle: Missing Docstrings
"D107", # pydocstyle: numpy convention
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