Remove unnecessary future annotation imports #2
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/future-annotations-audit"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #1
What changed
Audited where
from __future__ import annotationsis actually required. It is load-bearing in four files and dead weight in the other seven.Removing it from all eleven broke fifteen tests, which is the finding worth recording: pluggy calls
inspect.signature()on hookspecs and hookimpls, and under PEP 649 that resolves the annotations at runtime. ATYPE_CHECKING-only import in a module pluggy inspects therefore raisesNameErrorat registration.api/_hooks.py,api/timestamps.py,sources.py,tests/test_plugins.pyAlso deselects the ruff
FArule, which would otherwise demand the import everywhere, and addstest_hookspecs_resolve_at_runtimeas a guard.Documents in CLAUDE.md that every change goes on a branch and every PR waits for review.
Filename effect
None. No naming logic changed.
Constraints
Verification
The guard test was verified to fail with
NameErrorwhen the import is stripped from_hooks.py, so it cannot regress silently.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.