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 #192

Merged
merged 14 commits into from
Feb 23, 2024
Merged

Conversation

CasperWA
Copy link
Contributor

@CasperWA CasperWA commented Oct 23, 2023

Description:

Closes #187

Update to use pydantic v2:

  • Upgrade dependencies accordingly.
    • oteapi-core >=0.6.0
    • otelib >=0.4.0
  • Use new pydantic v2 model methods throughout.
  • Use typing.Annotated throughout as this is recommended.
  • Upgrade to use Python 3.9+ format typing throughout (this can also be achieved by running pyupgrade --py39-plus.
  • Update tests accordingly.
  • Ensure all pydantic v2 warnings are taken care of.
  • Ensure tests succeed for all environments in the CI.

Type of change:

  • Bug fix.
  • New feature.
  • Documentation update.

Checklist for the reviewer:

This checklist should be used as a help for the reviewer.

  • Is the change limited to one issue?
  • Does this PR close the issue?
  • Is the code easy to read and understand, including clearly named variables?
  • Do all new feature have an accompanying new test?
  • Has the documentation been updated as necessary?

@CasperWA CasperWA requested a review from jesper-friis October 23, 2023 14:23
@CasperWA CasperWA marked this pull request as draft October 23, 2023 14:27
Remove minimum expected version (this is already handled by the
requirements and version specifiers there).

Remove filterwarnings.
Remove showing the 10 slowest tests when running pytest, and update to
show the missing lines in the code coverage overview as well as the
coverage.
@codecov-commenter
Copy link

codecov-commenter commented Oct 25, 2023

Codecov Report

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

Project coverage is 89.80%. Comparing base (329a873) to head (6dab541).

Files Patch % Lines
oteapi_dlite/strategies/parse_excel.py 94.11% 1 Missing ⚠️
oteapi_dlite/strategies/parse_image.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #192      +/-   ##
==========================================
+ Coverage   88.67%   89.80%   +1.12%     
==========================================
  Files          15       15              
  Lines         459      451       -8     
==========================================
- Hits          407      405       -2     
+ Misses         52       46       -6     
Flag Coverage Δ
linux 89.80% <97.59%> (+1.12%) ⬆️
windows 89.80% <97.59%> (+1.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@CasperWA CasperWA marked this pull request as ready for review October 25, 2023 09:19
@CasperWA CasperWA requested a review from francescalb October 25, 2023 13:04
@jesper-friis jesper-friis removed their request for review October 28, 2023 10:18
@CasperWA
Copy link
Contributor Author

CasperWA commented Nov 20, 2023

This is momentarily put on hold/delayed until its impact on current project deliverables depending on this plugin have been determined and cleared.

@CasperWA
Copy link
Contributor Author

So I've tested this branch with the TEM demo and found that no changes were really necessary, other than ensuring all dependencies support Pydantic v2. In conclusion, I think there is no issue with merging this PR, other than letting any users know that they should ensure they have the following minimum dependencies:

  • oteapi-dlite>0.1.6 (i.e., the next version to be released after this PR has been merged)
  • oteapi-core>=0.6
  • otelib>=0.4

@CasperWA
Copy link
Contributor Author

CasperWA commented Jan 8, 2024

@francescalb Gentle reminder that this has been texted externally and poses no apparent issues - other than assuring the latest versions are used for all OTEAPI-related packages after merging and updating the version. And possibly upgrade plugins as otherwise expected to support pydantic v2 if the depend on oteapi-dlite.

Copy link
Contributor

@francescalb francescalb left a comment

Choose a reason for hiding this comment

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

Looks fine.

@CasperWA CasperWA merged commit 3f40f1e into master Feb 23, 2024
10 checks passed
@CasperWA CasperWA deleted the cwa/close-187-migrate-to-pydantic-v2 branch February 23, 2024 10:27
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
3 participants