-
Notifications
You must be signed in to change notification settings - Fork 320
feat(typing): Add types for PhoneNumberField #567
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@francoisfreitag please, take a look! |
francoisfreitag
added a commit
to francoisfreitag/django-phonenumber-field
that referenced
this pull request
Aug 7, 2025
This reverts commit c3a31bb. Mypy itself crashes on the tip of the branch, and it provides little value in its current state. stefanfoulis#567 was offered to improve the type checking, but that PR introduces convoluted workarounds to runtime code, for type checking usage. We can reconsider when Django officially supports typing or when the typing ecosystem can be used to better document and verify the code, without requiring complex workarounds. https://github.com/stefanfoulis/django-phonenumber-field/pull/567/files#diff-82109bfd2869a9307c952d21292dc118e522d7fb07ca87d1e607ff9b192c666fR51-R60
francoisfreitag
added a commit
to francoisfreitag/django-phonenumber-field
that referenced
this pull request
Aug 7, 2025
This reverts commit c3a31bb. Mypy itself crashes on the tip of the branch, and it provides little value in its current state. ``` $ mypy tests --no-check-untyped-defs /home/runner/work/django-phonenumber-field/django-phonenumber-field/.tox/mypy/lib/python3.13/site-packages/django-stubs/contrib/auth/forms.pyi:82: error: INTERNAL ERROR -- Please try using mypy master on GitHub: https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build If this issue continues with mypy master, please report a bug at https://github.com/python/mypy/issues version: 1.17.1 ``` stefanfoulis#567 was offered to improve the type checking, but that PR introduces convoluted workarounds to runtime code, for type checking usage. We can reconsider when Django officially supports typing or when the typing ecosystem can be used to better document and verify the code, without requiring complex workarounds. https://github.com/stefanfoulis/django-phonenumber-field/pull/567/files#diff-82109bfd2869a9307c952d21292dc118e522d7fb07ca87d1e607ff9b192c666fR51-R60
I’m closing this PR per #637. I am thankful for your work, but it looks like the tooling requires pretty complex workarounds to support typing in this library. I would rather stick to code that’s easy to read and maintain. |
francoisfreitag
added a commit
that referenced
this pull request
Aug 22, 2025
This reverts commit c3a31bb. Mypy itself crashes on the tip of the branch, and it provides little value in its current state. ``` $ mypy tests --no-check-untyped-defs /home/runner/work/django-phonenumber-field/django-phonenumber-field/.tox/mypy/lib/python3.13/site-packages/django-stubs/contrib/auth/forms.pyi:82: error: INTERNAL ERROR -- Please try using mypy master on GitHub: https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build If this issue continues with mypy master, please report a bug at https://github.com/python/mypy/issues version: 1.17.1 ``` #567 was offered to improve the type checking, but that PR introduces convoluted workarounds to runtime code, for type checking usage. We can reconsider when Django officially supports typing or when the typing ecosystem can be used to better document and verify the code, without requiring complex workarounds. https://github.com/stefanfoulis/django-phonenumber-field/pull/567/files#diff-82109bfd2869a9307c952d21292dc118e522d7fb07ca87d1e607ff9b192c666fR51-R60
francoisfreitag
added a commit
to bblanchon/django-phonenumber-field
that referenced
this pull request
Aug 22, 2025
This reverts commit c3a31bb. Mypy itself crashes on the tip of the branch, and it provides little value in its current state. ``` $ mypy tests --no-check-untyped-defs /home/runner/work/django-phonenumber-field/django-phonenumber-field/.tox/mypy/lib/python3.13/site-packages/django-stubs/contrib/auth/forms.pyi:82: error: INTERNAL ERROR -- Please try using mypy master on GitHub: https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build If this issue continues with mypy master, please report a bug at https://github.com/python/mypy/issues version: 1.17.1 ``` stefanfoulis#567 was offered to improve the type checking, but that PR introduces convoluted workarounds to runtime code, for type checking usage. We can reconsider when Django officially supports typing or when the typing ecosystem can be used to better document and verify the code, without requiring complex workarounds. https://github.com/stefanfoulis/django-phonenumber-field/pull/567/files#diff-82109bfd2869a9307c952d21292dc118e522d7fb07ca87d1e607ff9b192c666fR51-R60
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refs #562