nayaverdier / dyntastic

A DynamoDB library on top of Pydantic and boto3.
MIT License
55 stars 12 forks source link

Dyntastic import error #14

Closed kvanopdorp closed 9 months ago

kvanopdorp commented 9 months ago

I just installed version 0.13.0 with pydantic v2 support. When importing the Dyntastic class, I get the below error:

I believe it's a matter of importing FieldInfo vs setting FieldInfo to pydantic.fields.Fiedlnfo. I opened a pull request with slight mods. Feel free to pull or mod as makes more sense to you.

from dyntastic import Dyntastic Traceback (most recent call last): File "", line 1, in File "/Users/kirk/python-test/.venv/lib/python3.9/site-packages/dyntastic/init.py", line 1, in from .attr import A, Attr File "/Users/kirk/python-test/.venv/lib/python3.9/site-packages/dyntastic/attr.py", line 10, in from . import pydantic_compat File "/Users/kirk/python-test/.venv/lib/python3.9/site-packages/dyntastic/pydantic_compat.py", line 90, in FieldInfo = pydantic.fields.FieldInfo File "/Users/kirk/python-test/.venv/lib/python3.9/site-packages/pydantic/init.py", line 363, in getattr return _getattr_migration(attr_name) File "/Users/kirk/python-test/.venv/lib/python3.9/site-packages/pydantic/_migration.py", line 306, in wrapper raise AttributeError(f'module {module!r} has no attribute {name!r}') AttributeError: module 'pydantic' has no attribute 'fields'

nayaverdier commented 9 months ago

Good catch, looks like this was introduced in pydantic 2.5.0. Thanks for the PR, will deploy shortly.