-
Notifications
You must be signed in to change notification settings - Fork 71
feat: added a way to mark funcs as deprecated (compatible py 3.9-3.14) #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
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 introduces a deprecated decorator compatible with Python 3.9-3.14 to enable marking functions as deprecated without adding external dependencies. The implementation uses the standard library warnings.deprecated for Python 3.13+ and provides a custom fallback for earlier versions.
Changes:
- Added
language_tool_python/_deprecated.pymodule with conditional import logic for the deprecated decorator - Updated mypy configuration in
pyproject.tomlto ignore unused type:ignore comments
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| language_tool_python/_deprecated.py | New module providing deprecated decorator with fallback implementation for Python <3.13 |
| pyproject.toml | Added "unused-ignore" to mypy's disable_error_code list for cross-version type annotation compatibility |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
feat: added a way to mark funcs as deprecated (compatible py 3.9-3.14)
Why the pull request was made
In order to introduce new interfaces without bumping the MAJOR version of the library, there was a need for a way to mark functions as deprecated, compatible from Python version 3.9 to version 3.14.
A solution would be to use the
deprecateddecorator fromtyping_extensionslib, but doesn't wan't to add a dependancy.Summary of changes
deprecateddecorator (destinated for internal use).deprecateddecorator fromwarningslib.pyproject.toml(because the written decorator is typed, and thewarningsone isn't, so using atype: ignorewill trigger amypywarning with the first one, and not with the second one).Screenshots (if appropriate):
Not appropriate.
How has this been tested?
Tested by applying both on lib funcs.
Resources
https://docs.python.org/3/library/warnings.html#warnings.deprecated
Types of changes
Checklist