nitypes: Delete _typing submodule and use typing_extensions directly #21
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.
What does this Pull Request accomplish?
Add a dependency on the
typing-extensions
package and import symbols directly fromtyping_extensions
.Why should this Pull Request be merged?
Single-sourcing
typing_extensions
imports in a private_typing
submodule is not working well. I'm starting to think that avoidingtyping_extensions
at run time is not worth it. It is lightweight and has no external dependencies.With a private
_typing
submodule, sphinx-autoapi renders type aliases asnitypes._typing.TypeAlias
. If we usetyping.TypeAlias
directly, it renders them as a PEP 695type
statement showing what they are aliased to. I have proposed updating sphinx-autoapi to do the same fortyping_extensions.TypeAlias
: readthedocs/sphinx-autoapi#521This pattern works for sphinx-autoapi, but not for mypy, due to python/mypy#14220
What testing has been done?
Ran nps, mypy, pytest.
Generated docs with readthedocs/sphinx-autoapi#521 and verified that type aliases are rendered properly.