Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Upgrade Pydantic to v2 #31
base: main
Are you sure you want to change the base?
Upgrade Pydantic to v2 #31
Changes from 33 commits
42696e4
ccedeb0
05ce65b
a822d3c
59f3f55
8ee7a24
3b51749
2df560f
5213981
ff3b55f
1999477
45f12ba
efd1737
ca99729
caf94a2
beb567e
07870e7
36bc368
0b31287
2247265
712e0ed
ee6b10c
81fa915
0fb6858
04354f2
a5f2d5a
21196e5
20974fd
995b9af
3acfe90
0bac230
6d95b50
7aa2207
aa7d13b
fc29ccd
65e69c1
a9dd2a3
36d1d1c
de14431
3283e4a
cbada4b
bf6624f
680e224
4f7d5b3
c4f78e8
10b45d5
e6ac8ec
8ae9252
883d76b
d25d81a
ba068d6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
(And please don't just remove python 3.6 from the CI like this!)
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 change might seem a bit weird but it came up because Pydantic now treats Pydantic dataclasses and BaseModels the same way during serialization.
In Pydantic v1, calling
model.dict()
with an instance of adataclass
would not JSON serialize that dataclass, it would just return that dataclass.This allowed for our Optimizer README example to work and resolve that dataclass instance.
e.g. with pydantic v1 this worked still:
However, when swapped to pydantic v2, the final line here was resolving the
optimzer
to a dict.This has actually always been a bug, because previously we could not make
MyCoolOptimizer
into a Pydantic model, it had to be adataclass
(or any other class that wasn't a Pydantic model).With this code above, we could make
MyCoolOptimzer
into a Pydantic model and we'd get a Pydantic model back.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 case can occur from the above change to pass through resolved pydantic models