Closed jvstme closed 1 month ago
To Reproduce
Annotated
from pydantic_duality import DualBaseModel, Field from typing import Annotated
class M(DualBaseModel): a: Annotated[str, Field(description="a")]
print(M)
2. Run the script under Python 3.13 ```shell $ python3.13 main.py Traceback (most recent call last): File "/tmp/main.py", line 4, in <module> class M(DualBaseModel): a: Annotated[str, Field(description="a")] File "/usr/local/lib/python3.13/site-packages/pydantic_duality/__init__.py", line 138, in __new__ new_class._generate_alternative_classes( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ name, bases, attrs, request_suffix, response_suffix, patch_request_suffix, kwargs ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/local/lib/python3.13/site-packages/pydantic_duality/__init__.py", line 171, in _generate_alternative_classes _alter_attrs(attrs, name + request_suffix, REQUEST_ATTR), ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/pydantic_duality/__init__.py", line 73, in _alter_attrs annotations[key] = _resolve_annotation(val, attr) ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/pydantic_duality/__init__.py", line 41, in _resolve_annotation return Annotated.__class_getitem__( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/typing.py", line 548, in __getattr__ raise AttributeError(item) AttributeError: __class_getitem__
Expected behavior Defining models with Annotated works normally as it did under Python 3.12.
$ python3.12 main.py <class '__main__.M'>
Works in 1.2.2. Please, check. Thanks for your issue!
To Reproduce
Annotated
.class M(DualBaseModel): a: Annotated[str, Field(description="a")]
print(M)
Expected behavior Defining models with
Annotated
works normally as it did under Python 3.12.