Skip to content

Conversation

@ilevkivskyi
Copy link
Member

This updates a bunch of places to work with both mypy_extensions.TypedDict and typing_extensions.TypedDict. There is one place where we create a fallback, there I prefer the latter if available.

See PR python/typing#628 for corresponding runtime change.

Copy link
Member

@gvanrossum gvanrossum 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!

@msullivan
Copy link
Collaborator

Would it work to instead make mypy_extensions.TypedDict just be a reexport of typing_extensions.TypedDict in typeshed, and then just update things to be typing_extensions.TypedDict instead of handling both?

@ilevkivskyi
Copy link
Member Author

Would it work to instead make mypy_extensions.TypedDict just be a reexport of typing_extensions.TypedDict in typeshed, and then just update things to be typing_extensions.TypedDict instead of handling both?

It would definitely work, but this makes the transition smoother, we don't need to worry about the order of the PRs, and people who have wrong version of typeshed will not see weird errors. Moreover, the next transition when it will be moved to typing will be just updating couple constants, instead of same sized PRs here and in typeshed. Finally, I like a single constant more than same hardcoded string everywhere.

@ilevkivskyi ilevkivskyi merged commit 571b076 into python:master May 7, 2019
@ilevkivskyi ilevkivskyi deleted the typed-dict-typing-extensions branch May 7, 2019 02:11
ilevkivskyi added a commit to python/typeshed that referenced this pull request May 7, 2019
Since there is a PEP for `TypedDict` (PEP 589), it is being added to `typing_extension`, see python/typing#628. This PR essentially copies the definition from `mypy_extensions`.

Corresponding mypy PR python/mypy#6744 can be merged independently of this PR.
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.

3 participants