danielgtaylor / python-betterproto

Clean, modern, Python 3.6+ code generator & library for Protobuf 3 and async gRPC
MIT License
1.54k stars 216 forks source link

pydantic v2 support #530

Closed DeoLeung closed 3 months ago

DeoLeung commented 1 year ago

Hi,

Thanks for the great job. I'm just wondering whether pydantic v2 support is on the way, seems using root_validator is raising error in v2.

like langchain use a submodule import .

JoshuaLeivers commented 1 year ago

One of the commits in #531 limits Pydantic to v1 to fix this issue. I noticed that popping up more consistently during tests with the Tox fix - not entirely sure why it wasn't being flagged before.

bigluck commented 5 months ago

Hi all, is there any update on this? I would love to use betterproto, but I can not switch back to pydantic v1.

Thanks

jafaircl commented 5 months ago

Maybe I'm wrong but I don't think limiting pydantic to an outdated version is an ideal solution to this issue. Is this the only problem with using pydantic > 2? The error message I get indicates that you just need to specify skip_on_failure=True in the root_validator decorator (which should be replaced with model_validator either way). Would you accept a PR that makes that change?