-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[WIP] Adding support for generic TypedDicts #1390
Conversation
Generic TypedDict is not supported by PEP 589, nor is it supported at runtime by Python. If you want this to be supported, you'd need to go through the typing-sig or PEP drafting process. We are not interested in adding support to Pyright unless/until it becomes part of the Python type standard. |
That said, I'm impressed that you were able to add this functionality! |
Oh that is sad. I can take a look at how to suggest it on typing-sig mailing list. Should I close this PR until something is certain?
It was a fun exercise :) |
Yeah, please close this PR for now. If it is added to the Python 3.10 runtime, we can revive this PR. |
Sounds good. Thanks for the quick response. |
RE: typing-sig, if you haven't done it before, easiest is to just sign up on mail.python.org and send emails there to the typing-sig asking about the feature; I'd expect that either the PEP can be revised to be less lax, or that it will end up needing a new PEP thanks to the aforementioned runtime type changes (thanks to needing the square brackets to work at runtime, etc). |
Got it. Thank you for the information. |
I sent out the email to typing-sig mailing list (awaiting moderator approval at the moment). Fingers crossed hoping there's a way to move forward with the runtime support. |
Hi, what do you think about supporting generic TypedDicts?
In this pull request I tried to add this functionality hopefully without mangling too many other things.
The basis of the implementation is by enhancing the
getTypedDictMembersForClass
andgetTypedDictMembersForClassRecursive
.There is also a mypy issue on adding support for generic TypedDicts.
In the following code you can see this PR in action, but there are still a few actions TODO items. I just wanted to get some feedback before moving forward.
TODO