chore(deps): add typing_extensions for py<3.13 to have a fallback for "deprecated"#177
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the project’s deprecation decorator implementation to use warnings.deprecated on Python ≥ 3.13 and typing_extensions.deprecated on earlier Python versions, resolving mypy issues and allowing removal of several type: ignore suppressions.
Changes:
- Add
typing_extensionsas a conditional dependency for Python < 3.13. - Simplify
language_tool_python._deprecatedto selectdeprecatedfromwarnings(≥3.13) ortyping_extensions(<3.13). - Remove now-unnecessary mypy suppression comments around
@deprecatedusage in library code and tests.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
pyproject.toml |
Adds conditional runtime dependency on typing_extensions for Python < 3.13. |
uv.lock |
Locks the new conditional dependency in the uv lockfile metadata. |
language_tool_python/_deprecated.py |
Switches to version-based import between warnings.deprecated and typing_extensions.deprecated. |
language_tool_python/utils.py |
Removes type: ignore comments from @deprecated usage now that the decorator is typed. |
language_tool_python/match.py |
Removes type: ignore comments from @deprecated usage. |
language_tool_python/download_lt.py |
Removes type: ignore comments from @deprecated usage. |
tests/test_deprecated.py |
Removes type: ignore comments in tests now that the decorator is typed. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9cab1c8 to
4c58e75
Compare
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.
chore(deps): add typing_extensions for py<3.13 to have a fallback for "deprecated"
Why the pull request was made
Because our trick to replace
warnings.deprecatedin py<3.13 was triggering some mypy errors, and simply usingtyping_extensions.deprecatedis a better solution.Summary of changes
typing_extensionsas a dependency for py<3.13.language_tool_python._deprecated.py, importwarnings.deprecatedfor py>= 3.13, importtyping_extensions.deprecatedelse.Screenshots (if appropriate):
Not appropriate.
How has this been tested?
Applied local tests.
Resources
Not appropriate.
Types of changes
Checklist