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

Migrate to pydantic v2 #2178

Merged
merged 3 commits into from
Jul 1, 2024
Merged

Migrate to pydantic v2 #2178

merged 3 commits into from
Jul 1, 2024

Conversation

AdeelH
Copy link
Collaborator

@AdeelH AdeelH commented Jun 27, 2024

Overview

This PR migrates the code from using pydantic v1 to v2 and updates the version requirement to >=2.

The main changes are:

Checklist

  • Added unit tests, if applicable
  • Updated documentation, if applicable
  • Added needs-backport label if the change should be back-ported to the previous release
  • PR has a name that won't get you publicly shamed for vagueness

Notes

N/A

Testing Instructions

See updated unit tests.

Closes #2034

@AdeelH AdeelH force-pushed the pydantic2 branch 3 times, most recently from 2ceabe0 to 5e4eb6f Compare June 28, 2024 01:27
Note: default serialization behavior has changed in pydantic v2. See https://docs.pydantic.dev/latest/concepts/serialization/#serializing-with-duck-typing. We use model_dump(serialize_as_any=True) to get the old behavior.
- v1's validator and root_validator have been changed to field_validator and model_validator respectively
- move some type definitions to core.utils.types
- update some type hints to newer syntax
@AdeelH AdeelH added the needs-backport This PR needs to be backported to release branches label Jul 1, 2024
Copy link

codecov bot commented Jul 1, 2024

Codecov Report

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

Project coverage is 90.15%. Comparing base (b74e30e) to head (be455b9).

Files Patch % Lines
...ner/rastervision/pytorch_learner/learner_config.py 86.56% 9 Missing ⚠️
..._pipeline/rastervision/pipeline/pipeline_config.py 66.66% 4 Missing ⚠️
...tervision_pipeline/rastervision/pipeline/config.py 89.47% 2 Missing ⚠️
...n/core/rv_pipeline/semantic_segmentation_config.py 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2178      +/-   ##
==========================================
+ Coverage   90.10%   90.15%   +0.04%     
==========================================
  Files         197      198       +1     
  Lines        9874     9879       +5     
==========================================
+ Hits         8897     8906       +9     
+ Misses        977      973       -4     

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

@AdeelH AdeelH removed the needs-backport This PR needs to be backported to release branches label Jul 1, 2024
@AdeelH AdeelH marked this pull request as ready for review July 1, 2024 17:02
@AdeelH AdeelH merged commit adac1a2 into azavea:master Jul 1, 2024
2 checks passed
@AdeelH AdeelH deleted the pydantic2 branch July 1, 2024 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate to pydantic v2
1 participant