Skip to content

Apply source order: init > env > dotenv > secrets > defaults and pres…#688

Merged
hramezani merged 4 commits intopydantic:mainfrom
chbndrhnns:init-over-env
Oct 7, 2025
Merged

Apply source order: init > env > dotenv > secrets > defaults and pres…#688
hramezani merged 4 commits intopydantic:mainfrom
chbndrhnns:init-over-env

Conversation

@chbndrhnns
Copy link
Copy Markdown
Contributor

…erve earlier values

  • Deep merge for config files using deep_update in ConfigFileSourceMixin._read_files
  • Deterministic alias selection for init kwargs (prefer first alias in validation_alias; field name allowed with populate_by_name=True).

Fixes #180

…erve earlier values

- Deep merge for config files using deep_update in ConfigFileSourceMixin._read_files
- Deterministic alias selection for init kwargs (prefer first alias in validation_alias; field name allowed with populate_by_name=True).
Comment thread tests/test_config_file_deep_merge.py Outdated
@hramezani
Copy link
Copy Markdown
Member

Thanks @chbndrhnns for the PR.

I will review it later.

@kschwab it would be great if you could review it when you have time.

@chbndrhnns
Copy link
Copy Markdown
Contributor Author

Not sure how to resolve this error:
 
The job was not acquired by Runner of type hosted even after multiple attempts
 

Comment thread tests/test_config_file_deep_merge.py Outdated
Comment thread pydantic_settings/sources/base.py Outdated
@hramezani hramezani merged commit 7a6e96e into pydantic:main Oct 7, 2025
19 checks passed
@hramezani
Copy link
Copy Markdown
Member

Thanks @chbndrhnns

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.

Cannot override env var when creating model

2 participants