Skip to content

Conversation

yukikaoru
Copy link
Contributor

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 Copilot AI review requested due to automatic review settings September 18, 2025 03:18
Copy link

@Copilot 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

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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants