Skip to content

fix: pin ruff <0.16, and actually run it in CI - #9

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/ruff-pin-and-lint-ci
Aug 2, 2026
Merged

fix: pin ruff <0.16, and actually run it in CI#9
scttfrdmn merged 1 commit into
mainfrom
fix/ruff-pin-and-lint-ci

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

ruff was declared in the dev extra but no workflow ever invoked it, so it
enforced nothing. Found while auditing the Python repos after ruff 0.16 broke
miniwdl-spawn and had left cwl-spawn's main red for six days
(spore-host/cwl-spawn#5).

Pinning alone would have been the tidy-looking fix and would have left the real
gap in place, so this does both.

1. Pin ruff>=0.5,<0.16

ruff 0.16 moved a large set of opinionated rules into its default rule set.
Unpinned here:

findings
ruff 0.16.1 (unpinned) 76
ruff 0.15.22 (pinned) 3

The 73-finding delta is almost entirely annotation-style suggestions — 36 UP045,
13 UP037, 7 UP006 — that no other repo in the suite enforces. Same cap as
airflow-spawn, cwl-spawn, miniwdl-spawn and
snakemake-executor-plugin-spawn.

2. Add a lint job

ruff check . on 3.12 only — lint results don't vary across the test matrix, so
fanning it out over 3.9–3.12 would just be four times the work for the same answer.

3. Fix the 3 real findings

All in examples/, none in the shipped spore package:

  • marimo_example.py built a state_color map from the instance state and then
    never used it (F841) — so the status table rendered **{inst.state}**
    uncolored. The dead variable was the tell that the colorization was written but
    never wired up; now applied, which is what the example meant to demonstrate.
  • script_example.py — f-string with no placeholders (F541).
  • jupyter_example.ipynbE402 (import not at top of cell) is inherent to
    notebooks, where each cell is its own top level. Excluded per-file rather than
    contorting the example. Verified the notebook is still linted for everything
    else
    ; E402 is the only ignore.

Verification

  • ruff --version → 0.15.22; ruff check . → All checks passed
  • pytest tests/ → 19 passed
  • Both edited examples parse (ast.parse)
  • Confirmed the per-file ignore doesn't silence anything beyond E402

Related: spore-host#518 (the CI outage that started this audit).

`ruff` was declared in the dev extra but no workflow ever invoked it, so it
enforced nothing. Two problems fixed together:

1. Pin `ruff>=0.5,<0.16`. ruff 0.16 moved a large set of opinionated rules
   into its DEFAULT set; unpinned it reported 76 findings here, 73 of them
   annotation-style suggestions (UP045/UP037/UP006) the rest of the suite
   doesn't enforce. Same cap as the four workflow adapters.

2. Add a `lint` job running `ruff check .`, so the pin guards a check that
   runs. Single Python version — lint results don't vary across the matrix.

The 3 real findings under the pin were all in examples/ and are fixed:
- marimo_example.py computed `state_color` then never used it, so the status
  table rendered the state uncolored; now applied as intended.
- script_example.py had an f-string with no placeholders.
- jupyter_example.ipynb E402 is inherent to notebooks (each cell is its own
  top level) → excluded per-file, not worked around in the example.

Verified: ruff resolves to 0.15.22, `ruff check .` passes, 19 tests pass,
both edited examples parse, and the notebook is still linted for everything
except E402.

No change to the shipped `spore` package.
@scttfrdmn
scttfrdmn merged commit 167e06b into main Aug 2, 2026
6 checks passed
@scttfrdmn
scttfrdmn deleted the fix/ruff-pin-and-lint-ci branch August 2, 2026 02:57
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