Pass current_state in when calling custom and built-in sources.
This will allow sources to dynamically decided if to provide a value for the attribute. For example, a higher priority source can decided to leave the low-priority source "as is" if it's not None.
Note: I think this is considered a breaking change as the signature of __call__ on the source abstract type is changing.
See https://github.com/pydantic/pydantic-settings/issues/223#issuecomment-1913196648 for context Interested in the maintainers thoughts here :)
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
40230ab) 97.69% compared to head (e024247) 97.71%.
Additional details and impacted files
@@ Coverage Diff @@
## main #224 +/- ##
==========================================
+ Coverage 97.69% 97.71% +0.01%
==========================================
Files 5 5
Lines 347 350 +3
Branches 76 76
==========================================
+ Hits 339 342 +3
Misses 6 6
Partials 2 2
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thanks @mnbbrown for this PR.
we need some tests for this and have to wait to merge it before V3 because it is a breaking change.
Superseded by https://github.com/pydantic/pydantic-settings/pull/326