zmievsa / pydantic-duality

Automatically and lazily generate three versions of your pydantic models: one with Extra.forbid, one with Extra.ignore, and one with all fields optional
https://ovsyanka83.github.io/pydantic-duality/
MIT License
31 stars 1 forks source link

Incompatible with Pydantic 2 #14

Closed prescod closed 2 weeks ago

prescod commented 5 months ago

Any attempt to import DualBaseModel into application code results in:

     testpd.py", line 3, in <module>
    from pydantic_duality import DualBaseModel
  File "site-packages/pydantic_duality/__init__.py", line 22, in <module>
    from pydantic.main import ModelMetaclass
ImportError: cannot import name 'ModelMetaclass' from 'pydantic.main' 

Using:

pydantic                                 2.7.4
pydantic_core                            2.18.4
pydantic-duality                         1.2.0
pydantic-settings                        2.3.2
zmievsa commented 5 months ago

Yup! I'm adding the compatibility soon but it's not there yet.

zmievsa commented 2 weeks ago

Released in pydantic-duality==2.0.0. Please, have a look