-
Couldn't load subscription status.
- Fork 2
Avoid depending on typing_extensions. #134
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 removes the dependency on typing_extensions by migrating from typing_extensions.Annotated and typing_extensions.get_args to their equivalent implementations in the standard typing module. Since django-enum requires Python 3.9 or higher, and both Annotated and get_args are available in the standard library from Python 3.9, this change eliminates an unnecessary external dependency.
Key changes:
- Replace
typing_extensions.Annotatedwithtyping.Annotated(using thet.alias) - Replace
typing_extensions.get_argswithtyping.get_args - Remove all
typing_extensionsimports across test files and source code
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/django_enum/utils.py | Updates import to use get_args from standard typing module instead of typing_extensions |
| tests/examples/models/text_choices.py | Replaces typing_extensions.Annotated with t.Annotated in enum property annotations |
| tests/examples/models/properties_choices.py | Replaces typing_extensions.Annotated with t.Annotated in enum property annotations |
| tests/examples/models/properties.py | Replaces typing_extensions.Annotated with t.Annotated in enum property annotations |
| tests/enum_prop/models.py | Replaces typing_extensions.Annotated with t.Annotated in enum property annotations |
| tests/enum_prop/enums.py | Replaces typing_extensions.Annotated with t.Annotated across multiple enum class property annotations |
| tests/edit_tests/edits/_*.py | Replaces typing_extensions.Annotated with t.Annotated in test migration files |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or 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.
Looks good! Thank you for your contribution!
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
5a71510
into
django-commons:main
While type hints utilize
typing_extensions, django-enum does not include typing_extensions as a dependency library. Even if installed, typing_extensions will not be automatically installed.The only elements from typing_extensions used are
get_argsandAnnotated, but in Python 3.9, both are available in thetypingmodule.Since django-enum requires Python 3.9 or higher, there seems to be no need to specifically use typing_extensions.