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

⬆️ Fix custom settings class with pydantic-settings~=2.6 #6644

Conversation

pcrespov
Copy link
Member

@pcrespov pcrespov commented Oct 31, 2024

What do these changes do?

The upgrade to pydantic-settings~=2.6 disrupted the auto_default_from_env mechanism. This PR introduces a solution:

  • 🎨 Adds EnvSettingsWithAutoDefaultSource, a new settings source that executes the default factory injected upon construction of the class (see __pydantic_init_subclass__).
  • ✅ Includes additional tests for robust coverage.
  • 🐛 Corrects import errors in the catalog.
  • Updates latest pydatnci-settings everywhere

Related issue/s

How to test

cd packages/settings-library
make install-dev
pytest -vv tests -k test_upgrade_failure_to_pydantic_settings_2_6

Dev-ops checklist

None

@pcrespov pcrespov self-assigned this Oct 31, 2024
@pcrespov pcrespov changed the title WIP: Is4481/fix settings class WIP: Is4481/fix settings class with pydantic-settings==2.6.0 Oct 31, 2024
Copy link

codecov bot commented Oct 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.56%. Comparing base (24218c1) to head (f129f23).
Report is 1 commits behind head on pydantic_v2_migration_do_not_squash_updates.

Additional details and impacted files
@@                               Coverage Diff                               @@
##           pydantic_v2_migration_do_not_squash_updates    #6644      +/-   ##
===============================================================================
- Coverage                                        71.63%   68.56%   -3.08%     
===============================================================================
  Files                                             1100      963     -137     
  Lines                                            49250    43324    -5926     
  Branches                                          1390     1331      -59     
===============================================================================
- Hits                                             35281    29703    -5578     
+ Misses                                           13736    13385     -351     
- Partials                                           233      236       +3     
Flag Coverage Δ *Carryforward flag
integrationtests 64.78% <ø> (ø) Carriedforward from a453269
unittests 77.70% <ø> (-5.24%) ⬇️

*This pull request uses carry forward flags. Click here to find out more.

Components Coverage Δ
api ∅ <ø> (∅)
pkg_aws_library 93.32% <ø> (ø)
pkg_dask_task_models_library 96.61% <ø> (ø)
pkg_models_library ∅ <ø> (∅)
pkg_notifications_library 83.79% <ø> (ø)
pkg_postgres_database ∅ <ø> (∅)
pkg_service_integration 70.00% <ø> (ø)
pkg_service_library 76.51% <ø> (ø)
pkg_settings_library ∅ <ø> (∅)
pkg_simcore_sdk 77.41% <ø> (ø)
agent 97.22% <ø> (ø)
api_server ∅ <ø> (∅)
autoscaling ∅ <ø> (∅)
catalog ∅ <ø> (∅)
clusters_keeper ∅ <ø> (∅)
dask_sidecar ∅ <ø> (∅)
datcore_adapter 93.17% <ø> (ø)
director 58.38% <ø> (ø)
director_v2 76.21% <ø> (ø)
dynamic_scheduler ∅ <ø> (∅)
dynamic_sidecar 59.64% <ø> (ø)
efs_guardian 90.10% <ø> (ø)
invitations 93.49% <ø> (ø)
osparc_gateway_server 79.52% <ø> (ø)
payments ∅ <ø> (∅)
resource_usage_tracker 87.36% <ø> (-0.16%) ⬇️
storage ∅ <ø> (∅)
webclient ∅ <ø> (∅)
webserver 59.70% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 24218c1...f129f23. Read the comment docs.

@giancarloromeo giancarloromeo self-requested a review November 1, 2024 12:05
@pcrespov pcrespov added this to the Event Horizon milestone Nov 4, 2024
@pcrespov pcrespov force-pushed the is4481/fix-settings-class branch from 9aec7ae to a453269 Compare November 5, 2024 09:40
Copy link

sonarqubecloud bot commented Nov 5, 2024

@pcrespov pcrespov changed the title WIP: Is4481/fix settings class with pydantic-settings==2.6.0 ⬆️ Fix custom settings class with pydantic-settings~=2.6 Nov 5, 2024
@pcrespov pcrespov marked this pull request as ready for review November 5, 2024 09:59
@pcrespov pcrespov requested a review from wvangeit November 5, 2024 10:22
@pcrespov pcrespov merged commit b01c4a7 into ITISFoundation:pydantic_v2_migration_do_not_squash_updates Nov 5, 2024
65 of 89 checks passed
@pcrespov pcrespov deleted the is4481/fix-settings-class branch November 5, 2024 10:24
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.

3 participants