Skip to content

Get the shared CI green - #219

Open
lispandfound wants to merge 1 commit into
meta-cifrom
ci-green
Open

Get the shared CI green#219
lispandfound wants to merge 1 commit into
meta-cifrom
ci-green

Conversation

@lispandfound

Copy link
Copy Markdown
Contributor

Stacked on #218. Second of three.

Takes the shared workflow from "adopted" to "passing", and adds a lefthook config so it stays that way without a round trip through Actions.

The lockfile was the big one

uv.lock pinned numba 0.53.1 (March 2021). Its llvmlite 0.36 refuses to build on anything past Python 3.9:

RuntimeError: Cannot install on Python version 3.13.15; only versions >=3.6,<3.10 are supported.
hint: `numba` (v0.53.1) was included because `im-calculation` depends on
      `qcore-utils` which depends on `numba`

uv sync therefore died in deptry, pytest and typecheck alike — all three Python-job failures on #217 were this one line. Relocked, and as asked the whole lock is upgraded alongside it, dev tooling included: ruff 0.16.1 → 0.16.7, ty 0.0.66 → 0.0.80, qcore-utils 2026.6.1 → 2026.8.2, numpy 2.5.1 → 2.5.3, plus hypothesis, coverage, dask, scipy and the transitive set behind them.

Everything else the workflow was failing

Check Fix
ruff format --check Two files had never been formatted — the old ruff.yml ran ruff check only.
cargo fmt --all --check Also never run. Edition 2024 sorts use groups lowercase-last and stopped indenting trailing comments to the previous expression.
deptry DEP002 dask. It is never imported: xarray dispatches to it when apply_ufunc(..., dask="parallelized") gets a dask-backed array, which is what the lazy extra exists for. Recorded as a per-rule ignore with that reasoning.
ty check The # ty: ignore[invalid-argument-type] on the invalid-shape test no longer suppresses anything, and ty reports the dead directive.
numpydoc lint Seven kernel helpers in IM/ims.py and one in IM/snr_calculation.py had a summary line and no Parameters/Returns. Written in the style _rotd_kernel and _components already use.

.python-version pins 3.13. The retired test.yml pinned it via setup-python; the shared workflow has no such step, so uv was picking whatever the runner happened to offer.

lefthook

Ported from ucgmsim/nzcvm, with three changes:

  • Split into pre-commit and pre-push. Upstream runs everything on pre-push against {staged_files} — but nothing is staged at push time. Verified against the real config: five of its seven commands print (skip) no files for inspection, and the two that do not reference the template (clippy, rustfmt) instead run over the whole crate on every push. Autofix now runs on pre-commit over {staged_files}, where stage_fixed can do something; the gates run on pre-push over {push_files}, lefthook's pre-push equivalent.
  • Added ruff-format, numpydoc and rustfmt. The shared workflow gates on all three; the nzcvm config predates it. Between them they cover most of what is fixed above.
  • Fixed the yaml glob. *.{yaml, yml} has a space inside the alternation, so the second branch only ever matched a file literally named * yml — the hook never fired on a .yml. Now *.{yaml,yml}. All three are worth carrying back to nzcvm.

Install with uvx lefthook install. This branch was pushed through its own pre-push hook.

The vale command from the nzcvm config is deliberately not here: it lands with the vale config itself in PR 3, rather than pointing at a .vale.ini that does not exist yet.

Two configs follow from that hook set:

  • .yamllint.yml — with the yaml glob fixed the hook now actually runs, and yamllint's defaults flag things Actions requires: no --- document start, on: read as the YAML 1.1 boolean, and long ${{ }} expressions.
  • .gitignore — had no entry for target/, *.egg-info/, .coverage, htmlcov/, __pycache__/ or any tool cache. With hooks working off staged files, git add -A hoovering those up is a live hazard.

Verified locally

On Python 3.13, every job the shared workflow runs: ruff check, ruff format --check, deptry ., ty check, numpydoc lint, cargo fmt --all --check, cargo clippy --all-targets -- -D warnings, cargo test, cargo test --doc, and pytest --cov=IM tests — 62 passed, 97% coverage against the 95% gate.

🤖 Generated with Claude Code

Every failure the shared workflow reports on the previous commit, plus the
four that `no_parallel` was already failing before any of this.

**uv.lock.** The lock pinned numba 0.53.1 (March 2021), whose llvmlite 0.36
refuses to build on anything past Python 3.9, so `uv sync` died in deptry,
pytest and typecheck alike. That was the whole of the three Python job
failures on #217. Relocked, and — as asked — the rest of the lock is
upgraded along with it, dev tooling included: ruff 0.16.1 to 0.16.7, ty
0.0.66 to 0.0.80, hypothesis, coverage, qcore-utils 2026.6.1 to 2026.8.2,
numpy 2.5.1 to 2.5.3, and the transitive set behind them.

**.python-version.** uv picked the interpreter off the runner before; the
retired test.yml had pinned 3.13 through setup-python, and the shared
workflow has no such step. Pinning it here keeps CI and a local checkout on
the same interpreter.

**ruff format.** The old ruff.yml ran `ruff check` only, so two files had
never been through the formatter.

**cargo fmt.** Likewise never run. Edition 2024 sorts `use` groups
lowercase-last and no longer indents trailing comments to the previous
expression.

**deptry.** dask is declared but never imported: xarray dispatches to it
when `apply_ufunc(..., dask="parallelized")` is handed a dask-backed array,
which is what the `lazy` extra is for. Recorded as a DEP002 ignore.

**ty.** The suppression on the invalid-shape test no longer matches any
diagnostic, and ty now reports the dead directive.

**numpydoc.** Seven kernel helpers in IM/ims.py and one in
IM/snr_calculation.py had a summary line and nothing else. Written out in
the style the neighbouring `_rotd_kernel` and `_components` already use.

**lefthook.yml**, adapted from ucgmsim/nzcvm, so none of the above has to be
found by CI again. Three changes to that config beyond porting it:

- Split into pre-commit and pre-push. Upstream runs everything on pre-push
  against {staged_files}, but nothing is staged at push time: those commands
  report "no files for inspection" and skip, while the two that do not
  reference the template (clippy, rustfmt) run over the whole crate on every
  push. Autofix now runs on pre-commit over {staged_files}, where
  stage_fixed can do something, and the gates run on pre-push over
  {push_files}.
- Added ruff-format, numpydoc and rustfmt. The shared workflow gates on all
  three and the nzcvm config predates that; between them they cover most of
  what is fixed above.
- Fixed the yaml glob. `*.{yaml, yml}` has a space inside the alternation, so
  the second branch only ever matched a file literally named `* yml` and the
  hook never fired on a .yml. Now `*.{yaml,yml}`.

The vale command from the nzcvm config is deliberately left out — it lands
with the vale config itself in the next PR, rather than pointing at a
.vale.ini that does not exist yet.

**.yamllint.yml**, because that yaml hook does now fire, and yamllint's
defaults flag things Actions requires: no `---` document start, `on:` as a
mapping key, and long `${{ }}` expressions.

**.gitignore**, which had no entry for target/, *.egg-info/, .coverage,
htmlcov/, __pycache__/ or any of the tool caches. With hooks operating on
staged files, `git add -A` picking those up is a live hazard.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant