Closed zzstoatzz closed 7 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
965d1b4
) 97.63% compared to head (abcc165
) 97.65%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thanks @zzstoatzz for reporting and preparing the fix
closes #237 and adds regression test
example of updated behavior
### setup ```bash » tree -a . ├── .env └── settings.py ``` `.env` ``` FOO_X=something FOO_Y=something_else ``` `settings.py` ```python from pydantic_settings import BaseSettings, SettingsConfigDict class FooSettings(BaseSettings): model_config = SettingsConfigDict( extra='allow', env_file='.env', env_prefix='foo_' ) x: str settings = FooSettings() print(f'{getattr(settings, "y", None)=}') print(f'{getattr(settings, "foo_y", None)=}') ``` ### usage ```bash » python settings.py getattr(settings, "y", None)='something_else' getattr(settings, "foo_y", None)=None ```