Skip to content

chore(deps): add typing_extensions for py<3.13 to have a fallback for "deprecated"#177

Merged
mdevolde merged 1 commit into
jxmorris12:masterfrom
mdevolde:chore/typing_extensions
Jun 10, 2026
Merged

chore(deps): add typing_extensions for py<3.13 to have a fallback for "deprecated"#177
mdevolde merged 1 commit into
jxmorris12:masterfrom
mdevolde:chore/typing_extensions

Conversation

@mdevolde

Copy link
Copy Markdown
Collaborator

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.deprecated in py<3.13 was triggering some mypy errors, and simply using typing_extensions.deprecated is a better solution.

Summary of changes

  • Add typing_extensions as a dependency for py<3.13.
  • In language_tool_python._deprecated.py, import warnings.deprecated for py>= 3.13, import typing_extensions.deprecated else.
  • Remove unused "type: ignore" comments when using deprecated decorator in the lib.

Screenshots (if appropriate):

Not appropriate.

How has this been tested?

Applied local tests.

Resources

Not appropriate.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (changes to documentation only)
  • Refactor / code style update (non-breaking change that improves code structure or readability)
  • Tests / CI improvement (adding or updating tests or CI configuration only)
  • Other (please describe): chore update (new dependency)

Checklist

  • Followed the project's contributing guidelines.
  • Updated any relevant tests.
  • Updated any relevant documentation.
  • Added comments to your code where necessary.
  • Formatted your code, run the linters, checked types and tests.

Copilot AI 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.

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_extensions as a conditional dependency for Python < 3.13.
  • Simplify language_tool_python._deprecated to select deprecated from warnings (≥3.13) or typing_extensions (<3.13).
  • Remove now-unnecessary mypy suppression comments around @deprecated usage 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.

Comment thread language_tool_python/_deprecated.py
@mdevolde mdevolde force-pushed the chore/typing_extensions branch from 9cab1c8 to 4c58e75 Compare June 10, 2026 12:34
@mdevolde mdevolde merged commit cab2dfc into jxmorris12:master Jun 10, 2026
10 checks passed
@mdevolde mdevolde deleted the chore/typing_extensions branch June 10, 2026 12:35
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.

2 participants