Skip to content

[pyupgrade] Suggest typing.TypeForm on Python 3.15 (UP035) - #29084

Merged
ntBre merged 2 commits into
astral-sh:mainfrom
hugehoo:hugehoo/fix-29069-typeform-import
Oct 5, 2026
Merged

ntBre merged 2 commits into
astral-sh:mainfrom
hugehoo:hugehoo/fix-29069-typeform-import

Conversation

@hugehoo

@hugehoo hugehoo commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Summary

UP035 currently overlooks typing_extensions.TypeForm when targeting Python 3.15, where typing.TypeForm is available. Add TypeForm to the Python 3.15 replacement list so Ruff reports the import and offers an autofix. Python 3.14 behavior remains unchanged.

Closes #29069.

Test Plan

  • Added regression tests for Python 3.14 and 3.15, covering plain, aliased, and mixed imports and the resulting fixes.
  • cargo test -p ruff_linter --lib rules::pyupgrade (166 passed)
  • cargo clippy -p ruff_linter --all-targets --all-features -- -D warnings
  • cargo dev generate-all
  • prek on both changed files

@astral-sh-bot
astral-sh-bot Bot requested a review from ntBre October 2, 2026 23:43
@ntBre ntBre added the rule Implementing or modifying a lint rule label Oct 5, 2026

@ntBre ntBre 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.

Thanks, the code changes looked good to me. I just pushed a commit moving to mdtests.

@ntBre ntBre changed the title fix: suggest typing.TypeForm for Python 3.15 [pyupgrade] Suggest typing.TypeForm on Python 3.15 (UP035) Oct 5, 2026
@ntBre
ntBre enabled auto-merge (squash) October 5, 2026 17:38
@astral-sh-bot

astral-sh-bot Bot commented Oct 5, 2026

Copy link
Copy Markdown

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre
ntBre merged commit ca53cef into astral-sh:main Oct 5, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deprecated-import - should suggest typing.TypeForm instead of typing_extensions.TypeForm on python 3.15

2 participants