Skip to content
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

Pydantic 2 migration #119

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Pydantic 2 migration #119

wants to merge 7 commits into from

Conversation

alvarolopez
Copy link
Member

Description

Move Pydantic models to V2.

@codecov
Copy link

codecov bot commented Jun 7, 2023

Codecov Report

Attention: Patch coverage is 87.87879% with 16 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (master@e40e883). Click here to learn what that means.

Files Patch % Lines
caso/record.py 91.26% 7 Missing and 4 partials ⚠️
caso/extract/openstack/cinder.py 20.00% 4 Missing ⚠️
caso/extract/openstack/nova.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master     #119   +/-   ##
=========================================
  Coverage          ?   53.76%           
=========================================
  Files             ?       23           
  Lines             ?     1129           
  Branches          ?      115           
=========================================
  Hits              ?      607           
  Misses            ?      510           
  Partials          ?       12           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Pydantic 2 has breaking API changes, the most important for us is the
usage of compute_fields.

The accounting system expects datetime fields to be returned as integers
(i.e. epoch). We can use computed_fields for that, using properties.
This way we can internally store datetime objects, and just conver them
to integers when they are accessed. In order to do so, we define _epoch
properties.
@thebe14
Copy link

thebe14 commented Sep 22, 2023

@alvarolopez any idea when this will be merged? I am waiting on this one since months.

@alvarolopez
Copy link
Member Author

@thebe14 Pydantic 2 was released only at the end of June (https://docs.pydantic.dev/2.0/blog/pydantic-v2-final/). We need to double check that everything works as expected.

@alvarolopez
Copy link
Member Author

@aidaph can you check everything is working as expected? LGTM.

@aidaph aidaph marked this pull request as ready for review May 9, 2024 09:40
Copy link

@aidaph aidaph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few changes are added to make the extract of records works. LGTM now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove workaround for computed fields Block storage reported in GBytes instead of Bytes
3 participants