GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat: hybrid pydantic support for both v1 and v2 by samsja · Pull Request #1652 · docarray/docarray
This repository was archived by the owner on Sep 9, 2026. It is now read-only.
Conversation
|
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Okay first pass done, I have few questions and will probably make a more thorough pass tomorrow!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| from pydantic.validators import bytes_validator | ||
|
|
||
| else: | ||
| from pydantic.v1.validators import bytes_validator |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Am I understanding correctly that we are falling back to the bytes validator of v1 even if pydantic v2 is used? What is the reason behind this?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if is_pydantic_v2: | ||
| raise NotImplementedError( | ||
| 'This method is not supported in Pydantic 2.0. Please use Pydantic 1.8.2 or lower.' | ||
| ) | ||
|
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why is this?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
the method we used has been removed from pydantic v2, will have to find a fix later
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
|
||
| if is_pydantic_v2: | ||
|
|
||
| IncEx: typing_extensions.TypeAlias = ( |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
What does IncEx stand for?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
this is the named used in pydantic function signature. Not even sure what this means
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
okay
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| json_encoders = {AbstractTensor: lambda x: x} | ||
| if is_pydantic_v2: | ||
|
|
||
| class Config: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Should we still have this Config inner class, it is not recommended anymore in v2, right?
Also, where did the orjson stuff and the extra protobuf setting go?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
good question,
basically now in pydantic v2 this way is "deprecated". But at the same time, it is still working. Therefore if we keep it as a class it means we don't have to repeat the config for pydantic v2. Might be easier to maintain ...
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Also, where did the orjson stuff and the extra protobuf setting go?
This is handle differently with pydantic v2 and therefore not needed
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
hmm, using deprecated stuff is not great. Does it raise a warning?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
it does indeed raise a warning ...
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Co-authored-by: Johannes Messner <[email protected]> Signed-off-by: samsja <[email protected]>
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
the only thing that feels icky to me is using the deprecated Config inner class
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I will go with @JohannesMessner proposal and switch to ConfigDict instead of class |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
12a1dc6 to
d7a7a49
Compare
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
📝 Docs are deployed on https://ft-feat-full-pydantic-v2-support--jina-docs.netlify.app 🎉 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.