Closed PierreGtch closed 4 months ago
Thank you for the proposal! Indeed the support for TypedDict
is missing and can be added.
This could also allow checking the elements in **kwargs: https://peps.python.org/pep-0692/
A small note about this. jsonargparse
already supports **kwargs
without the need of type hinting. It does this via source code introspection. See classes-methods-and-functions and ast-resolver.
Hi, Thanks for this great library! Extremely useful!!
🚀 Feature request
The idea here would be to support arguments with type
typing.TypedDict
.Motivation
This feature would be great when we want to get a dictionary instead of a namespace but still want to check the keys and types of its elements.
This could also allow checking the elements in
**kwargs
: https://peps.python.org/pep-0692/Pitch
For example, if a function calls another function, we could then pass arguments to the second one very easily:
Then we would be able to call:
Alternatives
Currently, the only alternative for such cases is to use the
dict
type, which prevents from checking the key names and types individually. In the above example, the current alternative is: