Open mwoods-familiaris opened 3 months ago
Just to add...possibly relates to this:
Note PEP 585 generic types such as list["SomeClass"] will not be implicitly transformed into list[ForwardRef("SomeClass")] and thus will not automatically resolve to list[SomeClass].
Ref: https://docs.python.org/3.9/library/typing.html#typing.ForwardRef
Describe the bug Collections and forward references seem to work in isolation, or when used together providing the typing.List style collection type annotation is used. When using python 3.9 style collections, dacite fails to resolve type mapping.
To Reproduce Taking the example from the docs and amending it to use a python 3.9 style list type annotation, with a forward reference to "A":
results in:
Expected behavior To successfully resolve
list["A"]
, in the same manner as with the following alternatives (e.g. all these other combinations of annotations work as expected, where typing.List is used, or forward references are avoided):typing.List with no forward reference:
typing.List with forward reference:
python 3.9+ list with no forward reference:
Environment
dacite
version: 1.8.1Additional context Explicitly passing in the forward references with
config=Config(forward_references={"A": A})
has no impact.