Better support for typing_extensions
module
#2413
Labels
enhancement
it's not broken, but we want it to be better
typing_extensions
module
#2413
The
typing_extensions
module "contains both backports of new types added to the typing module, as well as experimental types that will eventually be added to the typing module".What makes this relevant to us is that we have a bunch of internal code that looks for these types specifically in the
typing
module, e.g.:hypothesis/hypothesis-python/src/hypothesis/strategies/_internal/types.py
Lines 84 to 88 in cd9d7b3
So if you're using
typing.Literal
in Python 3.8, that works. But if you're usingtyping_extensions.Literal
in Python 3.7 - or 3.8 for compatibility - you're out of luck.Going through and inserting checks to handle
typing_extensions
would improve our inference support for projects likeLibCST
- I found this while working on an extension to Zac-HD/hypothesmith#2, but obviously it's a generally useful feature.The main cost will be setting up tests for another optional integration to check that our non-typing_extensions-specific features work whether it's installed or not, that they work when installed, and ideally that we don't import it if it's not already in use.
The text was updated successfully, but these errors were encountered: