iterative / gto

🏷️ Git Tag Ops. Turn your Git repository into Artifact Registry or Model Registry.
https://dvc.org/doc/gto
Apache License 2.0
140 stars 16 forks source link

support pydantic v2 #413

Closed skshetry closed 1 year ago

skshetry commented 1 year ago

Also supports pydantic v1.

pydantic v2 provides v1 api through pydantic.v1 import, so we can support both versions by trying to import from pydantic.v1 and fallback to old behaviour.

See https://docs.pydantic.dev/latest/migration/#continue-using-pydantic-v1-features.

pydantic == 2.0.0 does not work due to https://github.com/pydantic/pydantic/issues/6361, so we need to blacklist that specific version.

shcheklein commented 1 year ago

@skshetry is there a reason to support both?

skshetry commented 1 year ago

@skshetry is there a reason to support both?

Studio still relies on MLEM and therefore on Pydantic v1. Also I did not want to block any DVC users that are using pydantic v2 (or, pydantic v1 even).

Also, using pydantic v2 APIs means changing code, whereas if we use v1 APIs for now, we can support both and is working perfectly fine.

shcheklein commented 1 year ago

sounds good. can we run tests with both then?

skshetry commented 1 year ago

I consider pydantic v1 support as best effort from now on. I don’t think we need to test both.

shcheklein commented 1 year ago

sound good, I think Studio has enough tests to detect failure if there is a regression in pydantic v1