Require the future-annotations import with ruff - #41
Open
imnasnainaec wants to merge 2 commits into
Open
Conversation
Every module under src/ carries `from __future__ import annotations` except _extras, which needs nothing from it and so went unnoticed. Ruff's isort required-imports enforces what was being eyeballed, and adds the import there. The rule is scoped to the package: tests and scripts mostly do without it, and that is their own convention rather than a lapse in this one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
imnasnainaec
added a commit
that referenced
this pull request
Aug 26, 2026
Whether the package's `from __future__ import annotations` convention is worth enforcing with a linter is a preference, settled by argument rather than by any test, and it shares nothing with the duplicated implementations the rest of this branch retires — no other commit here touches pyproject.toml or _extras. It is proposed on its own in #41 instead, where accepting or rejecting it costs nothing else. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
imnasnainaec
marked this pull request as ready for review
August 26, 2026 19:09
The two ignore lines say what they do, and why those trees are exempt belongs to the history of the rule rather than sitting beside it in the config. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every module under
src/opens withfrom __future__ import annotationsexcept
_extras.py,which needs nothing from it, so its absence was invisible. Ruff's isort
required-importsenforces what was being eyeballed, and supplies the missingimport.
The rule is scoped to the package. Tests and scripts mostly do without the
import, and that is their own convention rather than a lapse in this one, so
both are exempted from
I002rather than gaining 15 no-op imports.What is actually being decided
Whether the convention is worth a linter at all. That is a preference, settled
by argument rather than by any test, which is why a change this small is worth
its own review.
Nothing behavioural turns on it either way. The added import is a no-op in
_extras.py—requires-pythonis already>=3.11, where every annotation inthat module evaluates fine without it — so what is on offer is the guarantee
that the next module cannot quietly omit it, against a cost of one config
block.
ruff check,ruff format --checkandmypyare green.🤖 Generated with Claude Code
This change is