Skip to content

[pyupgrade] Ignore is_typeddict and TypedDict for deprecated-import (UP035)#15800

Merged
AlexWaygood merged 2 commits intoastral-sh:mainfrom
InSyncWithFoo:UP035
Jan 29, 2025
Merged

[pyupgrade] Ignore is_typeddict and TypedDict for deprecated-import (UP035)#15800
AlexWaygood merged 2 commits intoastral-sh:mainfrom
InSyncWithFoo:UP035

Conversation

@InSyncWithFoo
Copy link
Copy Markdown
Contributor

@InSyncWithFoo InSyncWithFoo commented Jan 29, 2025

Summary

Resolves #15780.

is_typeddict and TypedDict are now listed as known exceptions to the rule. The former will presumably stay until 3.9 reaches its end-of-life circa this October.

Test Plan

cargo nextest run and cargo insta test.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 29, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@AlexWaygood AlexWaygood self-assigned this Jan 29, 2025
Copy link
Copy Markdown
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Thanks! Could you also move "TypedDict" out of the TYPING_EXTENSIONS_TO_TYPING_313 list? Even on Python 3.13, typing_extensions.TypedDict is different to typing.TypedDict in the latest release of typing_extensions. (It provides an implementation of a version of PEP 728, which hasn't yet been accepted, and therefore hasn't yet been incorporated into typing.TypedDict)

@InSyncWithFoo InSyncWithFoo changed the title [pyupgrade] Ignore is_typeddict (UP035) [pyupgrade] Ignore is_typeddict and TypedDict (UP035) Jan 29, 2025
Copy link
Copy Markdown
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Thanks!

@AlexWaygood AlexWaygood changed the title [pyupgrade] Ignore is_typeddict and TypedDict (UP035) [pyupgrade] Ignore is_typeddict and TypedDict for deprecated-import (UP035) Jan 29, 2025
@AlexWaygood AlexWaygood merged commit d151ca8 into astral-sh:main Jan 29, 2025
@InSyncWithFoo InSyncWithFoo deleted the UP035 branch January 29, 2025 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UP035 recommends change that changes runtime behavior for is_typeddict

2 participants