-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Move TypedDict from mypy_extensions to typing_extensions #5288
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
Comments
I think we agreed at PyCon that there will be no new things in PEP 484 (clarifying existing things is OK though). So I think it should be a separate one, also it may be not so small if we carefully specify all the aspects:
def f(x: int, y: int) -> None: ...
c: TypedDict(x=int, y=str)
f(**c) # Error, because of 'y', IIRC not yet implemented
class Style(TypedDict):
fmt: str
alpha: float
color: Union[Color, str]
marker: Union[Marker, str]
<dozen others skipped>
def plot(x: Array, y: Array, **kwds: Style) -> List[Line2D]: ... # currently does not what expected
|
I think that this is a significant enough feature to have a new PEP. Here are couple of things we might want to consider before writing a PEP:
|
OK, it's decided we are writing a new PEP. Can we still move it to typing_extensions and make mypy (perhaps silently) start supporting it from all three locations? Presumably mypy can expect it in |
Yes, but we will need to add |
This was done a while ago. |
@ilevkivskyi Hi! I'm tracking this issue and I wonder how exactly it was done? The import command still returns error for python3.7 and python3.8:
|
Built-in typing stuff is in |
It still needs a PEP (or a PEP 484 patch?) but we're definitely not going to withdraw it, and I think it'll be easy enough to keep it mostly backwards compatible.
We should also move it to typing.py, but we should at least support it in typing_extensions so it can be used with Python versions whose stdlib typing.py is hard to update (3.5, 3.6 and 3.7.0).
Changes to mypy itself would be to allow it being imported from either mypy_extensions, typing_extensions, or typing. We can then copy the runtime support into the typing repo (both into typing.py and into typing_extensions.py, which also lives in that repo), and add stubs providing it to typeshed (probably it should be defined in typing.pyi, and imported from there into the other two stubs, for both Py2 and Py3).
The text was updated successfully, but these errors were encountered: