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
Support NotRequired
in TypedDict
when __future__.annotations
is enabled
#404
Comments
Thanks for opening this issue. You can work around this issue for now by doing as you've done above, or avoiding the In the long run I think we'll move to parsing the |
Ohh I see. I guess I'll go with my workaround for now. Thank you very much, and thanks for a great library :) |
No problem! I'm going to keep this open for now to remind me to update our logic to manually handle |
Yeah sure that's a good idea. |
NotRequired
in TypedDict
NotRequired
in TypedDict
when __future__.annotations
is enabled
Description
PEP 655 adds support for
NotRequired
andRequired
. Currently it seemsmsgspec
doesn't support it, but it does supporttotal=False
when defining aTypedDict
. Is this something that can be supported?I actually encountered this when I was trying to create a typed dictionary for specifying the values that can be updated in a specific table in Postgres. That is, whichever values are provided would be updated. Initially I had something like this:
This is what the body of the request from the client was going to be. I refactored this to make it work with msgpec by doing the following:
The text was updated successfully, but these errors were encountered: