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
feat: Support Pydantic 1 and 2 within the same application #2487
Conversation
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
…refactored) (#2489) 'Refactored by Sourcery' Co-authored-by: Sourcery AI <>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
6e544e4
to
507f055
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't gone through all of it yet.
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
0c7589c
to
a4b5c56
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huge effort! LGTM.
My only concern is we aren't actually testing anywhere with actual v1.10 installed and v2 not installed. What do you think about making another acceptance test that tests a light pydantic v1 only application alongside our minimal app test in the publish CI? Just to trap any major stuff like import errors before a release?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good, but it's probably best if someone else took a look this as well just to make sure we don't miss anything.
Co-authored-by: Peter Schutt <peter.github@proton.me>
Co-authored-by: Peter Schutt <peter.github@proton.me>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
Signed-off-by: Janek Nouvertné <25355197+provinzkraut@users.noreply.github.com>
This PR will bring down coverage a bit, as a lot of previously uncovered code will now be included in the coverage report. This should be addressed, but I didn't want to blow up this PR even more. |
SonarCloud Quality Gate failed. 1 Bug 93.9% Coverage Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/2487 |
Description
Support Pydantic 1 and 2 by making use of its backwards compatibility layer; Pydantic 2 ships with version 1 in the
pydantic.v1
namespace. This allows us to support either both 1 & 2 if version 2 is installed or just version 1 if version 1 is installed.In addition, this also simplifies our testing setup somewhat, as we can test for both Pydantic 1 & 2 without having to re-install dependencies.
Closes
Closes #2419