Skip to content

Bound ruff and mypy so an upgrade is a decision - #36

Merged
oscarvalenzuelab merged 1 commit into
mainfrom
chore/pin-the-linters
Sep 1, 2026
Merged

oscarvalenzuelab merged 1 commit into
mainfrom
chore/pin-the-linters

Conversation

@oscarvalenzuelab

Copy link
Copy Markdown
Contributor

Closes #11.

CI runs both linters with no configuration of its own — no [tool.ruff]
section, no ruff.toml anywhere in the tree, and ci.yml runs a bare
ruff check .. So the rules in force are whatever the installed version happens
to default to, and those defaults are not stable across releases. When they
grow, CI goes red on a pull request that changed nothing related to the new
rule.

-dev = ["pytest", "ruff", "mypy", "types-PyYAML", "lxml-stubs", "ospac>=1.4.3"]
+dev = [
+    "pytest",
+    "ruff>=0.16,<0.17",
+    "mypy>=2,<3",
+    "types-PyYAML",
+    "lxml-stubs",
+    "ospac>=1.4.3",
+]

One deviation from the issue

The issue suggested mypy>=1.11,<2. That bound would move CI backwards.
mypy 2.0 shipped 2026-05-06, three months before the issue was filed, and CI has
been installing 2.x on every run since. mypy 2.3.1 passes this codebase clean
today:

$ mypy            # unpinned, i.e. what CI installs right now
mypy 2.3.1 (compiled: yes)
Success: no issues found in 27 source files

Pinning <2 would have silently dropped CI to a two-major-versions-older
checker. The bound is >=2,<3, which keeps what is already running and guards
the next major.

ruff is pre-1.0, so its minor is the equivalent boundary and stays <0.17.

Not an explicit select list

Deliberately, per the issue. The broad defaults are doing real work: during #10
they caught an unparenthesized implicit string concatenation in a parametrize
list — the shape a missing comma takes, which silently turns a 2-tuple into one
string — and a datetime() built without tzinfo. A hand-written list would
risk losing that and leaves something to maintain.

Verified

Against the three commands CI actually runs, with the bounds in place:

resolved: ruff 0.16.5, mypy 2.3.1
ruff check .   ->  All checks passed!
mypy           ->  Success: no issues found in 27 source files
pytest         ->  1106 passed

Development tooling only; the published package is unaffected and this needs no
release of its own.

CI runs both with no configuration of its own: pyproject has no [tool.ruff]
section, there is no ruff.toml anywhere in the tree, and ci.yml runs a bare
ruff check. So the rules in force are whatever the installed version happens to
default to, and those defaults are not stable across releases. When they grow,
CI goes red on a pull request that changed nothing related to the new rule, and
whoever opened it has to fix unrelated findings to land their work.

Bounded, that becomes a deliberate pull request whose subject is the new
findings.

Not an explicit select list. The broad defaults are doing real work: during #10
they caught an unparenthesized implicit string concatenation in a parametrize
list, which is the shape a missing comma takes and silently turns a 2-tuple into
one string, and a datetime() built without tzinfo. Freezing a hand-written list
would risk losing that and leaves something to maintain.

The issue suggested mypy>=1.11,<2. That bound would move CI backwards: mypy 2.0
shipped in May, CI has been installing 2.x since, and 2.3.1 passes this
codebase clean today. The bound is >=2,<3, which keeps what is already running
and guards the next major. ruff is pre-1.0, so its minor is the equivalent
boundary and stays <0.17.

Verified against the three commands CI runs: ruff check . passes, mypy reports
no issues in 27 source files, and 1106 tests pass, with ruff 0.16.5 and mypy
2.3.1 resolved inside the bounds.

Closes #11
@cla-bot cla-bot Bot added the cla-signed label Sep 1, 2026
@oscarvalenzuelab
oscarvalenzuelab merged commit 48850b5 into main Sep 1, 2026
8 checks passed
@oscarvalenzuelab
oscarvalenzuelab deleted the chore/pin-the-linters branch September 1, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pin the ruff and mypy versions so CI cannot break on an unrelated PR

1 participant