-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Begin supporting Pydantic 2 (without dropping support for Pydantic 1) #238
Conversation
We are going to need to support pydantic 1 for some time. We think currently that we'll have to support it for atleast another year. However, we also need to begin supporting pydantic 2. Thus we need this shim to have the flexibility of supporting both. I have also run `hatch build` and ensured that this shim _does_ get included in the resulting tarball. In the upcoming commits, we'll switch over direct pydantic imports to instead use this shim, and then loosen the version in the pyproject config.
@esciara & @bernardcooke53 can you both confirm you are okay with me including y'all as authors in the changie log? ❤️ |
@QMalcolm absolutely! 🚀 |
This is necessary because the typing for v1 stuff breaks when using Pydantic 2. We can stop doing this once we actually migrate off of Pydantic 1 implementations.
cf601fc
to
1e6245a
Compare
Also because we aren't dropping support for Pydantic 1 in this work, I think we can backport this to 0.4.latest. Which would then allow for people using dbt-core and Pydantic 2 to upgrade |
Sure is! |
I can see that you ensure compatibility by keeping the code as is and importing the package So I guess that when you drop support for Pydantic v1, my PR #217 might become useful. I leave you do decide how to handle it (close it, keep it open, add a comment to it, other...). |
Great improvement! Does anyone have an estimate on when this pull request will be merged? |
@RoelantDL With review approval this morning, it'll be merged today. It's worth noting that merging it won't make it immediately available in dbt-core. Core 1.7.x runs on dbt-semantic-interfaces 0.4.x, thus we need to backport this to 0.4.latest and then release an 0.4.3 of dbt-semantic-interfaces. At that point, you'll have refresh your environment to pull in the new version of dbt-semantic-interfaces. |
[BACKPORT] #238 to 0.4.latest (Pydantic 2 Support)
Resolves #134
Description
After community and internal discussions we decided the best path forward was to support both Pydantic 1 and Pydantic 2 for the time being as we can't drop Pydantic 1 yet, but we also need to allow for Pydantic 2. We decided the tidiest way to do this would be via shimming. This PR adds the shim, directs pydantic imports to it, loosens the pydantic requirement to allow for pydantic 2, and ensure our testing checks both moving forward.
Also, I want shout out other PRs that worked to address this issue #217 and #227 as well as the people who worked on them (@esciara and @bernardcooke53 respectively). Their work was fundamental to making the changes that this PR contains, and they should be considered contributors on this effort.
Checklist
changie new
to create a changelog entry