From d9c502f5d5d824479589eb81fb1804bfa6c591dd Mon Sep 17 00:00:00 2001 From: Danny Rorabaugh Date: Wed, 26 Aug 2026 13:33:12 -0400 Subject: [PATCH 1/3] Let ruff require the future-annotations import the package already uses 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) --- pyproject.toml | 8 ++++++++ src/sil_lift/_extras.py | 2 ++ 2 files changed, 10 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index eb51c41..fece24d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,6 +81,14 @@ src = ["scripts", "src", "tests"] [tool.ruff.lint] select = ["B", "C4", "E", "F", "I", "RUF", "SIM", "UP", "W"] +[tool.ruff.lint.isort] +required-imports = ["from __future__ import annotations"] + +[tool.ruff.lint.per-file-ignores] +# These do without it by their own convention, not by oversight. +"scripts/**" = ["I002"] +"tests/**" = ["I002"] + [tool.mypy] strict = true python_version = "3.11" diff --git a/src/sil_lift/_extras.py b/src/sil_lift/_extras.py index f17c6e7..5636cd9 100644 --- a/src/sil_lift/_extras.py +++ b/src/sil_lift/_extras.py @@ -16,6 +16,8 @@ — so the internal representation stays swappable and no lxml type ever leaks. """ +from __future__ import annotations + from dataclasses import dataclass, field __all__ = ["Extras"] From 680a5fd6f24acbed54ba9ecf6c394c90a78a113d Mon Sep 17 00:00:00 2001 From: Danny Rorabaugh Date: Wed, 26 Aug 2026 15:10:25 -0400 Subject: [PATCH 2/3] Drop the comment beside the I002 exemption 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) --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index fece24d..e01bd50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -85,7 +85,6 @@ select = ["B", "C4", "E", "F", "I", "RUF", "SIM", "UP", "W"] required-imports = ["from __future__ import annotations"] [tool.ruff.lint.per-file-ignores] -# These do without it by their own convention, not by oversight. "scripts/**" = ["I002"] "tests/**" = ["I002"] From 0dd272dd8572a61856d64c8b42c8b0b04c54c669 Mon Sep 17 00:00:00 2001 From: Danny Rorabaugh Date: Wed, 2 Sep 2026 12:29:09 -0400 Subject: [PATCH 3/3] Add review-suggested comment --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index e01bd50..5c283ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -85,6 +85,8 @@ select = ["B", "C4", "E", "F", "I", "RUF", "SIM", "UP", "W"] required-imports = ["from __future__ import annotations"] [tool.ruff.lint.per-file-ignores] +# Only the package needs it: its public signatures annotate TYPE_CHECKING-only +# imports, which resolve at runtime solely because annotations are strings. "scripts/**" = ["I002"] "tests/**" = ["I002"]