chore(weave): enforce top-level Python imports - #7647
Open
gtarpenning wants to merge 3 commits into
Open
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
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.
Summary
Enable Ruff's
PLC0415(import-outside-top-level) check without changing intentional lazy, optional, circular, or test-isolation import behavior.Before this change, the rule was selected through the
PLCfamily but globally ignored, so the AGENTS.md import rule relied entirely on self-enforcement.Audit
A fresh
masterscan found 556 violations across 141 files:This PR:
# noqa: PLC0415suppressions to the remaining 525 baseline occurrencesPLC0415from the global Ruff ignore listLine-level suppressions are deliberate: unlike generated per-file ignores, they keep Ruff enforcement active everywhere in each affected file, so any new function-level import fails lint immediately.
Behavior
An AST comparison against
masterfound semantic changes in only six test files. Those changes are exactly the 31 redundant import removals; all production Python ASTs are unchanged.Four apparent duplicate imports remain intentionally local because they are part of traced function bodies, import-patching coverage, or isolated subprocess execution.
Validation
uvx ruff@0.15.5 check .uvx ruff@0.15.5 format --check .uvx ruff@0.15.5 check --select PLC0415 .One additional OpenAI realtime assertion failed locally and was reproduced unchanged on the exact base commit; it is unrelated to this diff.