2.6.0 breaks sub-modules inheriting from BaseSettings
for independent environment variables
#449
Labels
BaseSettings
for independent environment variables
#449
We are (in a pretty large number of places) intentionally using the pre-2.6 behavior of submodels that inherit from
BaseSettings
instead ofBaseModel
as a way to use environment variables to configure those portions of the settings directly without having to use the more complex convention for environment variables that specify the full path down to the field. This allows us to use standardized environment variables for that specific block of settings, regardless of what application settings they're embedded in.For example, this code works as desired with pydantic-settings 2.5.2, but breaks with 2.6.0:
With pydantic-settings 2.6.0, it produces the following error:
We use this configuration pattern very heavily for Kubernetes applications, since most of the application configuration is injected from the
values.yaml
file as YAML, but secrets, which have to come from Kubernetes secrets, are then injected via environment variables.I think this may partially duplicate other issues (specifically #447 and #445), but the descriptions there aren't quite the same and involve more complex functionality that we weren't using, so I thought the separate report may still be useful.
The text was updated successfully, but these errors were encountered: