-
Notifications
You must be signed in to change notification settings - Fork 27
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
⬆️ WIP: Upgrade libraries (pydantic v2) #6366
base: pydantic_v2_migration
Are you sure you want to change the base?
⬆️ WIP: Upgrade libraries (pydantic v2) #6366
Conversation
Since Pydantic v2, ByteSize are validated and must be >= 0.
# dsn is computed from the other fields | ||
assert "dsn" not in settings.dict() | ||
|
||
# causes cached property to be computed and stored on the instance |
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.
In Pydantic v2, it is possible to annotate @computed_field
. It must be specified in advance if we want to include it in the model serialization. By default @computed_field(repr=True)
for public fields, @computed_field(repr=False)
for private ones.
) | ||
|
||
# test cached-property | ||
assert settings.log_level == logging.DEBUG | ||
# log_level is cached-property (notice that is lower-case!), and gets added after first use |
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.
In Pydantic v2, it is possible to annotate @computed_field
. It must be specified in advance if we want to include it in the model serialization. By default @computed_field(repr=True)
for public fields, @computed_field(repr=False)
for private ones.
Quality Gate failedFailed conditions |
What do these changes do?
Upgrade libraries (inside
packages
folder) to Pydantic v2.Note: the
models-library
has a dedicated PR (see #6333)Related issue/s
How to test
Dev-ops checklist