-
-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
bpo-38834: enable runtime inspection of TypeDict classes #17214
Conversation
This patch enables downstream projects inspecting a TypedDict subclass at runtime to tell which keys are optional. This is essential for generating test data with Hypothesis or validating inputs with typeguard or pydantic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! All looks good.
@gvanrossum What do you think, can we include this in 3.8.1? Or should it just go to master (3.9) and |
I'd put in 3.9 (master) and in typing_extensions. |
OK, @Zac-HD could you please make a PR to https://github.com/python/typing adding this to |
Backport of python/cpython#17214 (BPO-38834)
This patch enables downstream projects inspecting a TypedDict subclass at runtime to tell which keys are optional. This is essential for generating test data with Hypothesis or validating inputs with typeguard or pydantic.
This patch enables downstream projects inspecting a TypedDict subclass at runtime to tell which keys are optional. This is essential for generating test data with Hypothesis or validating inputs with typeguard or pydantic.
@Zac-HD I don't think this was intended:
|
The bug is not really your fault though; It happens because |
Created https://bugs.python.org/issue42059. |
Backport of python/cpython#17214 (BPO-38834)
Backport of python/cpython#17214 (BPO-38834)
This patch enables downstream projects inspecting a TypedDict subclass at runtime to tell which keys are optional, which is essential for generating test data with Hypothesis or validating inputs with typeguard or pydantic.
More background on the typing-sig mailing list (cc @ilevkivskyi).
https://bugs.python.org/issue38834