Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
bckohan merged 1 commit into django-commons:main from yukikaoru:main
Sep 19, 2025
Merged

Conversation

@yukikaoru
Copy link
Contributor

@yukikaoru yukikaoru commented Sep 18, 2025

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_args and Annotated, but in Python 3.9, both are available in the typing module.
Since django-enum requires Python 3.9 or higher, there seems to be no need to specifically use typing_extensions.

Copilot AI review requested due to automatic review settings September 18, 2025 03:18
Copy link

Copilot AI left a 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.Annotated with typing.Annotated (using the t. alias)
  • Replace typing_extensions.get_args with typing.get_args
  • Remove all typing_extensions imports 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.

@bckohan bckohan self-assigned this Sep 18, 2025
Copy link
Member

@bckohan bckohan left a 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!

Copy link

codecov bot commented Sep 19, 2025
edited
Loading

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/django_enum/utils.py 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bckohan bckohan merged commit 5a71510 into django-commons:main Sep 19, 2025
105 of 106 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot Copilot left review comments

@bckohan bckohan bckohan approved these changes

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /