Repository navigation
Fix Ruff type-only imports in finite ring checks - #43038
Merged
Merged
Conversation
|
Documentation preview for this PR (built with commit fb76233; changes) is ready! 🎉 |
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Oct 23, 2026
sagemathgh-43038: Fix Ruff type-only imports in finite ring checks Fix the two Ruff `TC001` errors in `finite_ring_returns.py` reported by the [lint job on sagemath#43029](https://github.com/sagemath/sage/actions/runs/3 9876216589/job/120162341524?pr=43029). `FinitePolyExtElement` and `IntegerMod_abstract` are used only in variable annotations. Postpone annotation evaluation and import these names under `TYPE_CHECKING`, while keeping the types used by `assert_type` available at runtime. The failing file came from current `develop`; sagemath#43029 changes only `.github/workflows/ci.yml`, so this is an independent fix. Validation on current `develop`: - Full repository Ruff check with Sage's CI config, both `--no-preview` and `--preview`: passed. - Python compile check for the changed file: passed. - `git diff --check`: passed. ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies None. URL: sagemath#43038 Reported by: Dima Pasechnik Reviewer(s): Frédéric Chapoton
Collaborator
|
This PR is tagged "p:CI fix" but the lint error continues to appear, for instance in #43053: https://github.com/sagemath/sage/actions/runs/40327178328/job/121586769649?pr=43053 |
Member
Author
|
@dcoudert I have re-run that job, and it has passed, I guess it just was stale, tried before this fix |
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Oct 27, 2026
sagemathgh-43038: Fix Ruff type-only imports in finite ring checks Fix the two Ruff `TC001` errors in `finite_ring_returns.py` reported by the [lint job on sagemath#43029](https://github.com/sagemath/sage/actions/runs/3 9876216589/job/120162341524?pr=43029). `FinitePolyExtElement` and `IntegerMod_abstract` are used only in variable annotations. Postpone annotation evaluation and import these names under `TYPE_CHECKING`, while keeping the types used by `assert_type` available at runtime. The failing file came from current `develop`; sagemath#43029 changes only `.github/workflows/ci.yml`, so this is an independent fix. Validation on current `develop`: - Full repository Ruff check with Sage's CI config, both `--no-preview` and `--preview`: passed. - Python compile check for the changed file: passed. - `git diff --check`: passed. ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies None. URL: sagemath#43038 Reported by: Dima Pasechnik Reviewer(s): Frédéric Chapoton
2 of 5 tasks
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.
Fix the two Ruff
TC001errors infinite_ring_returns.pyreported by the lint job on #43029.FinitePolyExtElementandIntegerMod_abstractare used only in variable annotations. Postpone annotation evaluation and import these names underTYPE_CHECKING, while keeping the types used byassert_typeavailable at runtime. The failing file came from currentdevelop; #43029 changes only.github/workflows/ci.yml, so this is an independent fix.Validation on current
develop:--no-previewand--preview: passed.git diff --check: passed.📝 Checklist
⌛ Dependencies
None.