Skip to content

Fix Ruff type-only imports in finite ring checks - #43038

Merged
vbraun merged 1 commit into
sagemath:developfrom
dimpase:fix/finite-ring-type-imports
Oct 28, 2026
Merged

vbraun merged 1 commit into
sagemath:developfrom
dimpase:fix/finite-ring-type-imports

Conversation

@dimpase

@dimpase dimpase commented Oct 23, 2026

Copy link
Copy Markdown
Member

Fix the two Ruff TC001 errors in finite_ring_returns.py reported by the lint job on #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; #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

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • 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.

@github-actions

Copy link
Copy Markdown

Documentation preview for this PR (built with commit fb76233; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@fchapoton fchapoton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thanks

vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 23, 2026
Release Manager
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
@dcoudert

Copy link
Copy Markdown
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
it it normal ?

@dimpase

dimpase commented Oct 26, 2026

Copy link
Copy Markdown
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
Release Manager
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
@vbraun
vbraun merged commit d25914b into sagemath:develop Oct 28, 2026
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p: CI fix merged before running CI tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants