Skip to content

Releases: pydantic/pydantic-settings

v2.15.0

Choose a tag to compare

@hramezani hramezani released this 07 Aug 09:26
f725ca1

Highlights

Behavior changes

  • case_sensitive now applies to init kwargs and config-file sources (#900). InitSettingsSource and the JSON/TOML/YAML config sources previously ignored case_sensitive. Since it defaults to False, case-insensitive matching is now the default for these sources — e.g. Settings(TeSt=...) now populates a test field where it previously did not. Nested keys are still matched case-sensitively.
  • Fields with unresolved forward references now emit a warning (#901). Settings sources can silently fail to resolve such fields; they now raise IncompleteFieldDefinitionWarning telling you to call model_rebuild(). If you have filterwarnings = error configured, this may surface as a new failure.
  • Non-JSON env values for strict fields now raise ValidationError (#926) instead of a less specific error.

New features

  • Show environment variable names in CLI help via cli_show_env_vars=True (#860), so generated --help output doubles as configuration documentation.
  • PYDANTIC_SETTINGS_DEBUG for debugging settings resolution (#906, #913). Set it to a truthy value with DEBUG logging enabled to see each source's contribution in priority order, which source won for each value, and which env_file/secret files were probed, loaded, or skipped — the long-standing "why isn't my .env being picked up?" question.
  • toml_table_header for regular TOML files (#882, #886, #887), letting you root settings at a nested table in any TOML file, not just pyproject.toml.
  • Traversable support for JSON/TOML/YAML file sources (#902), so you can load config packaged inside a distribution — including files inside a zip or wheel — via importlib.resources.files(...) without casting to Path.
  • GCP: project_id can come from an earlier settings source (#878), rather than only from the constructor or GOOGLE_CLOUD_PROJECT.

Bug fixes

  • Fix env vars not loading on Windows with case_sensitive=True (#894). Windows upper-cases os.environ keys, so fields raised Field required instead of picking up their values.
  • Read secret files as UTF-8 instead of the platform locale encoding (#917). On Windows code pages such as cp1252 this silently corrupted non-ASCII secrets.
  • Fix AliasPath on nested model fields not JSON-decoding env values (#898).
  • Fix case-insensitive matching for optional nested models (#905).
  • Fix dotenv extras being wrongly claimed by a complex field sharing a name prefix (#912) — e.g. dbx_token being swallowed by a db: dict field.
  • Fix nested_model_default_partial_update=True corrupting discriminated unions (#876).
  • Fix Secret subclasses crashing when loaded from the environment (#920).
  • Fix enum names not parsing through nested annotations such as Optional[Annotated[MyEnum, ...]] with env_parse_enums=True (#910).
  • An empty yaml_config_section now falls back to defaults instead of raising AttributeError: 'NoneType' object has no attribute 'keys' (#914).
  • NestedSecretsSettingsSource no longer follows symlinks pointing outside secrets_dir (#889).
  • GCP: skip the list_secrets call when case_sensitive=True (#862), lowering the required IAM permissions to just roles/secretmanager.secretAccessor.
  • AWS: types-boto3[secretsmanager] is no longer required at runtime (#880).

Documentation

  • Document JSON parsing of complex env values, plus a comma-separated-values recipe (#919).
  • Recommend an async settings loading pattern (#908).
  • Clarify behavior when an unprefixed value is present in a dotenv file (#895).
  • Clarify environment variable helper descriptions (#867) and fix assorted typos (#904).
All changes (including dependency bumps and internal maintenance)

What's Changed

  • Update documentation link for Pydantic settings by @hramezani in #863
  • Bump the python-packages group with 4 updates by @dependabot[bot] in #865
  • docs: clarify environment variable helper descriptions by @vip892766gma in #867
  • Bump the python-packages group with 4 updates by @dependabot[bot] in #870
  • Bump the python-packages group with 4 updates by @dependabot[bot] in #875
  • Skip list_secrets call when case_sensitive=True by @ecerulm in #862
  • GoogleSecretManagerSettingsSource: read project_id from previous sources by @ecerulm in #878
  • Bump the python-packages group with 3 updates by @dependabot[bot] in #883
  • fix: move SecretsManagerClient type import under TYPE_CHECKING by @gavin913-lss in #880
  • Skip partial update merging for discriminated union fields by @hramezani in #876
  • Support using a table header as root when reading a TOML file by @whyscream in #882
  • Bump the python-packages group with 4 updates by @dependabot[bot] in #885
  • Don't complain about missing table headers in a TOML file that isn't there by @whyscream in #886
  • Address issues in toml table header implementation by @whyscream in #887
  • Bump the python-packages group with 2 updates by @dependabot[bot] in #888
  • Prevent NestedSecretsSettingsSource from following symlinks outside secrets_dir by @hramezani in #889
  • Add 'Part of the Pydantic Stack' footer to README by @strawgate in #891
  • Bump the python-packages group with 3 updates by @dependabot[bot] in #893
  • Add support for showing environment variable names in CLI help text by @brad-alexander in #860
  • Fix loading env vars on Windows with case_sensitive=True by @hramezani in #894
  • Bump the github-actions group with 3 updates by @dependabot[bot] in #896
  • Bump the python-packages group with 3 updates by @dependabot[bot] in #897
  • Add explicit callout for the case where the unprefixed value is in dotenv by @martinky24 in #895
  • Fix AliasPath on nested model fields not decoding env values (#670) by @hramezani in #898
  • Support case_sensitive in InitSettingsSource and config file sources by @hramezani in #900
  • Warn when using fields not fully resolved at instantiation by @Viicos in #901
  • Support Traversable for json/toml/yaml config file sources (#299) by @hramezani in #902
  • docs: fix typos in docs and source comments by @maxtaran2010 in #904
  • Apply case-insensitive field matching to optional nested models (#903) by @hramezani in #905
  • Bump boto3 from 1.43.36 to 1.43.40 in the python-packages group by @dependabot[bot] in #907
  • Add PYDANTIC_SETTINGS_DEBUG for debugging settings sources (#538) by @hramezani in #906
  • docs: recommend async settings loading pattern by @w3lld1 in #908
  • fix: parse enum names through nested annotations by @Sanjays2402 in #910
  • Fix dotenv extras being claimed by complex fields sharing a name prefix by @ritsth in #912
  • Add debug logging for env_file an...
Read more

v2.14.2

Choose a tag to compare

@hramezani hramezani released this 19 Jun 14:17
d703bd7

What's Changed

This is a security patch release.

  • Prevent NestedSecretsSettingsSource from following symlinks outside secrets_dir by @hramezani in #889
  • Prepare release 2.14.2 by @hramezani in #890

Security

Fixes GHSA-4xgf-cpjx-pc3j: NestedSecretsSettingsSource with secrets_nested_subdir=True could follow a symbolic link inside secrets_dir pointing outside it, reading out-of-tree files into settings values and bypassing the secrets_dir_max_size cap. Affected versions: >= 2.12.0, < 2.14.2.

Full Changelog: v2.14.1...v2.14.2

v2.14.1

Choose a tag to compare

@hramezani hramezani released this 08 May 13:40
e95c30b

What's Changed

Full Changelog: v2.14.0...v2.14.1

v2.14.0

Choose a tag to compare

@hramezani hramezani released this 20 Apr 14:25
8916bee

What's Changed

  • Fix parsing env vars into Optional Strict types by @hramezani in #792
  • Fix RecursionError with mutually recursive models in CLI by @hramezani in #794
  • Fix env_file from model_config ignored in CliApp.run() (#795) by @hramezani in #796
  • Update dependencies by @hramezani in #798
  • Add Dependabot configuration by @hramezani in #801
  • Bump samuelcolvin/check-python-version from 4.1 to 5 by @dependabot[bot] in #802
  • Bump actions/upload-artifact from 4 to 7 by @dependabot[bot] in #803
  • Bump actions/checkout from 4 to 6 by @dependabot[bot] in #804
  • Bump astral-sh/setup-uv from 5 to 7 by @dependabot[bot] in #805
  • Bump actions/setup-python from 5 to 6 by @dependabot[bot] in #806
  • Ignore chardet and group GitHub Actions in Dependabot by @hramezani in #808
  • Bump actions/download-artifact from 4 to 8 in the github-actions group by @dependabot[bot] in #809
  • Bump the python-packages group with 2 updates by @dependabot[bot] in #810
  • Support reading .env files from FIFOs (e.g. 1Password Environments) by @JacobHayes in #776
  • Fix AliasChoices ignored when changing provider priority by @hramezani in #813
  • fix: resolve KeyError in run_subcommand for underscore field names by @bradykieffer in #799
  • Bump the python-packages group with 3 updates by @dependabot[bot] in #814
  • Fix Literal[numeric Enum] coercion for CLI and env vars by @m9810223 in #811
  • Fix nested discriminated unions not discovered by env/CLI providers by @hramezani in #816
  • Bump the python-packages group with 3 updates by @dependabot[bot] in #820
  • CLI ensure env nested max split internally. by @kschwab in #821
  • Bump the python-packages group with 4 updates by @dependabot[bot] in #824
  • Migrate boto3-stubs to types-boto3 by @hramezani in #831
  • Fix CLI not recognizing field name with validate_by_name and AliasChoices by @hramezani in #826
  • Allow customisation of the dotevn setting source to filter variables by @CaselIT in #832
  • Bump the python-packages group with 3 updates by @dependabot[bot] in #833
  • Introduce yamlfmt by @Viicos in #836
  • Bump boto3 from 1.42.82 to 1.42.83 in the python-packages group by @dependabot[bot] in #837
  • Introduce zizmor by @Viicos in #838
  • Fix CliPositionalArg[list[CustomType]] crash for custom types by @hramezani in #839
  • Add note about Mypy plugin for BaseSettings.__init__() by @Viicos in #842
  • Fix cli_ignore_unknown_args=True not working on subcommands by @hramezani in #844
  • Bump the python-packages group with 4 updates by @dependabot[bot] in #847
  • Fix CLI descriptions lost under python -OO by falling back to json_schema_extra by @hramezani in #843
  • Prepare release 2.14.0 by @hramezani in #848

New Contributors

Full Changelog: v2.13.1...v2.14.0

v2.13.1

Choose a tag to compare

@hramezani hramezani released this 20 Apr 13:27
e87d12d

What's Changed

Full Changelog: v2.13.0...v2.13.1

v2.13.0

Choose a tag to compare

@hramezani hramezani released this 16 Feb 08:49
198e71c

What's Changed

  • fix: Deterministic alias selection when using validate_by_name by @chbndrhnns in #707
  • add deep merge functionality to config file sources by @pmeier in #698
  • Add support for AWS Secrets Manager VersionId parameter by @jcyamacho in #708
  • bugfix: Return None for inaccessible GCP Secret Manager secrets by @zaphod72 in #712
  • Bugfix for cli_kebab_case="all" and CliImplicitFlag[bool] by @Digity101 in #702
  • Unpack type alisases when looking for NoDecode by @tselepakis in #695
  • CliToggleFlag and CliDualFlag by @kschwab in #717
  • Fix for CLI duplicate enum field values. by @kschwab in #722
  • fixed load nested config from env by @Sube-py in #723
  • Add non-Path files support (for example Traversable) and open files using Path.open method by @mahenzon in #724
  • add one more traversable test by @mahenzon in #725
  • CLI fix fox external list args. by @kschwab in #727
  • fix: handle case-insensitive retrieval in GoogleSecretManagerSettingsSource by @ezwiefel in #730
  • CLI test fixes for help text formatting. by @kschwab in #735
  • Avoid conflicts with the NAME environment variable in WSL by @kzrnm in #747
  • fix: When restoring init kwargs, use deterministic order by @chbndrhnns in #746
  • Add env_prefix_target by @kzrnm in #749
  • Remove (default: …) in the help message for CliToggleFlag by @kzrnm in #740
  • Add support for CLI serialize styles. by @kschwab in #755
  • Add support for overriding default help on CLI internal parser. by @kschwab in #758
  • CLI format_help method support by @kschwab in #759
  • feat(gcp): support SecretVersion annotation for per-field secret versioning by @ezwiefel in #763
  • Allow snake_case_conversion with env_prefix for Azure Key Vault source by @cstarkers in #762
  • fix: Only override preferred_key when no value was found by @chbndrhnns in #767
  • Update deps by @hramezani in #768
  • CLI coerce numeric types. by @kschwab in #769
  • CLI Union Discriminator Choices in Help by @kschwab in #764
  • Add nested path support for yaml_config_section (fixes #772) by @hugo-romero-mm in #773
  • Prepare release 2.13.0 by @hramezani in #777

New Contributors

Full Changelog: v2.12.0...v2.13.0

v2.12.0

Choose a tag to compare

@hramezani hramezani released this 10 Nov 14:28
584983d

What's Changed

New Contributors

Full Changelog: v2.11.0...v2.12.0

v2.11.0

Choose a tag to compare

@hramezani hramezani released this 24 Sep 14:18
3e66430

What's Changed

New Contributors

Full Changelog: 2.10.1...v2.11.0

v2.10.1

Choose a tag to compare

@hramezani hramezani released this 24 Jun 13:27
6bae3ab

What's Changed

  • Fix UnboundLocalError error in _replace_field_names_case_insensitively by @hramezani in #639
  • Remove unknown file reference in documentation by @Viicos in #640
  • Prepare release 2.10.1 by @hramezani in #642

Full Changelog: 2.10.0...2.10.1

v2.10.0

Choose a tag to compare

@hramezani hramezani released this 21 Jun 13:55
910b1b1

What's Changed

New Contributors

Full Changelog: v2.9.1...2.10.0