-
Notifications
You must be signed in to change notification settings - Fork 301
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
Support pydantic plugin in 2.xx version #2217
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2217 +/- ##
==========================================
- Coverage 83.52% 82.00% -1.53%
==========================================
Files 296 306 +10
Lines 23244 23894 +650
Branches 3481 3481
==========================================
+ Hits 19415 19594 +179
- Misses 3207 3672 +465
- Partials 622 628 +6 ☔ View full report in Codecov by Sentry. |
fc14d4b
to
61e5ed6
Compare
from flytekit.core import type_engine | ||
from flytekit.models import literals, types | ||
|
||
from . import deserialization, serialization | ||
|
||
pydantic = lazy_module("pydantic") | ||
# pydantic plugin is not suitable for lazy module. |
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.
# pydantic plugin is not suitable for lazy module. |
plugins/flytekit-pydantic/flytekitplugins/pydantic/basemodel_transformer.py
Outdated
Show resolved
Hide resolved
plugins/flytekit-pydantic/flytekitplugins/pydantic/deserialization.py
Outdated
Show resolved
Hide resolved
plugins/flytekit-pydantic/flytekitplugins/pydantic/serialization.py
Outdated
Show resolved
Hide resolved
98011b1
to
7e5aa08
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.
LGTM, thanks
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Co-authored-by: Kevin Su <[email protected]> Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
a7e3e8e
to
4614074
Compare
* support pydantic when 2.xx version Signed-off-by: Future-Outlier <[email protected]> * update import Signed-off-by: Future-Outlier <[email protected]> * update Signed-off-by: Future-Outlier <[email protected]> * Revert Dev Dependencies Signed-off-by: Future-Outlier <[email protected]> * lint Signed-off-by: Future-Outlier <[email protected]> * pydantic Signed-off-by: Future-Outlier <[email protected]> * fix-plugin-ci Signed-off-by: Future-Outlier <[email protected]> * as pydantic, remove lazy load Signed-off-by: Future-Outlier <[email protected]> * lint Signed-off-by: Future-Outlier <[email protected]> * warning messages Signed-off-by: Future-Outlier <[email protected]> * lint Signed-off-by: Future-Outlier <[email protected]> * update pydantic version Signed-off-by: Future-Outlier <[email protected]> * fix build plugins CI Signed-off-by: Future-Outlier <[email protected]> * fix version problem Signed-off-by: Future-Outlier <[email protected]> * Update pingsu's advice Co-authored-by: Kevin Su <[email protected]> Signed-off-by: Future-Outlier <[email protected]> * update supported types Signed-off-by: Future-Outlier <[email protected]> * update pingsu's advice Signed-off-by: Future-Outlier <[email protected]> * remove tests Signed-off-by: Future-Outlier <[email protected]> --------- Signed-off-by: Future-Outlier <[email protected]> Co-authored-by: Kevin Su <[email protected]>
* support pydantic when 2.xx version Signed-off-by: Future-Outlier <[email protected]> * update import Signed-off-by: Future-Outlier <[email protected]> * update Signed-off-by: Future-Outlier <[email protected]> * Revert Dev Dependencies Signed-off-by: Future-Outlier <[email protected]> * lint Signed-off-by: Future-Outlier <[email protected]> * pydantic Signed-off-by: Future-Outlier <[email protected]> * fix-plugin-ci Signed-off-by: Future-Outlier <[email protected]> * as pydantic, remove lazy load Signed-off-by: Future-Outlier <[email protected]> * lint Signed-off-by: Future-Outlier <[email protected]> * warning messages Signed-off-by: Future-Outlier <[email protected]> * lint Signed-off-by: Future-Outlier <[email protected]> * update pydantic version Signed-off-by: Future-Outlier <[email protected]> * fix build plugins CI Signed-off-by: Future-Outlier <[email protected]> * fix version problem Signed-off-by: Future-Outlier <[email protected]> * Update pingsu's advice Co-authored-by: Kevin Su <[email protected]> Signed-off-by: Future-Outlier <[email protected]> * update supported types Signed-off-by: Future-Outlier <[email protected]> * update pingsu's advice Signed-off-by: Future-Outlier <[email protected]> * remove tests Signed-off-by: Future-Outlier <[email protected]> --------- Signed-off-by: Future-Outlier <[email protected]> Co-authored-by: Kevin Su <[email protected]> Signed-off-by: Jan Fiedler <[email protected]>
Tracking Issues
https://flyte-org.slack.com/archives/CP2HDHKE1/p1708960554466059
Why are the changes needed?
When pydantic version >= 2, this current plugin will not work.
What changes were proposed in this pull request?
as pydantic
to support 2 cases ,pydantic version < 2
andpydantic version >= 2
lazy_load
to support 2 cases ,pydantic version < 2
andpydantic version >= 2
How was this patch tested?
We test it in 2 scenarios,
pydantic version < 2
andpydantic version >= 2
.We need to use
from pydantic import BaseModel
whenpydantic version < 2
from pydantic.v1 import BaseModel
whenpydantic version >= 2
Setup process
Screenshots
when pydantic version < 2
when pydantic version >= 2
remote execution
warning message
Check all the applicable boxes
Related PRs
Docs link