-
Notifications
You must be signed in to change notification settings - Fork 361
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
Python SDK: Support multiple pydantic versions #7672
Conversation
clients/python/scripts/pydantic.sh
Outdated
echo "... $line ..." | ||
modules=$(echo $line | awk -F 'from pydantic import ' '{print $2}') | ||
echo $line | ||
|
||
newline="try:\n from pydantic.v1 import $modules\nexcept ImportError:\n from pydantic import $modules" | ||
|
||
echo "$newline" | ||
|
||
echo "Replacing import statement" |
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 all the echo
s are great for debugging but kind of redundant, maybe just output the file
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.
This is not printed during the build process. It is used when running the script manually for testing
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.
Neat! Much value in few lines
- How was this tested?
- How can we test this on DataBricks?
Co-authored-by: Ariel Shaqed (Scolnicov) <ariels@treeverse.io>
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.
THANK YOU!
So, I thought about doing it in a separate PR but since you asked. I created a matrix for the wrapper unit tests workflow. |
…upport-multiple-pydantic-versions-6903
* Python SDK: Support multiple pydantic versions * Fix templates * Update clients/python/scripts/pydantic.sh Co-authored-by: Ariel Shaqed (Scolnicov) <ariels@treeverse.io> * Add unit test flavor with pydantic V1 * Fix script * Fix workflow --------- Co-authored-by: Ariel Shaqed (Scolnicov) <ariels@treeverse.io>
Closes #6903
Change Description
Background
Support pydantic v1/2 on python SDK and HL SDK.
New Feature
We use templates to untag the pydantic version together with a post processing script which changes all imports to try and use the pydantic.v1 compatible module (in pydantic v2) and fallback on pydantic v1 modules
Testing Details
Tested on HL SDK integration tests with pydantic v2 installed
Breaking Change?
No