Change8

v2.11.0

Breaking Changes
📦 pydantic-settingsView on GitHub →
3 breaking9 features🐛 6 fixes🔧 6 symbols

Summary

Pydantic Settings 2.11.0 introduces CLI serialization, root model support, and several enhancements, while removing automatic CLI argument parsing and disabling abbreviation handling, which may require migration steps.

⚠️ Breaking Changes

  • Removed parsing of command line arguments from `CliSettingsSource.__init__`. Code that relied on automatic CLI parsing must now pass arguments explicitly or use the new CLI handling API.
  • Reverted the fix that respected `cli_parse_args` from `model_config` with `settings_customise_sources`. The previous behavior is restored, so any custom `cli_parse_args` settings will no longer be applied.
  • Disabled `allow_abbrev` on subparsers, so abbreviated CLI options are no longer accepted.

Migration Steps

  1. If you previously relied on `CliSettingsSource` automatically parsing `sys.argv`, update your code to pass arguments explicitly or use the new CLI API.
  2. Review any custom `cli_parse_args` settings in `model_config`; they are no longer respected after the revert.
  3. If you used abbreviated CLI options, update them to full option names due to `allow_abbrev` being disabled.
  4. When using `AWSSecretsManagerSettingsSource`, you can now provide an `endpoint_url` kwarg; adjust calls if needed.
  5. Check for warnings about unused `model_config` keys and clean up configuration.

✨ New Features

  • Added CLI serialize support.
  • Implemented inspection of type aliases to detect complex annotations.
  • Added warning when `model_config` contains unused keys for missing settings sources.
  • Added `endpoint_url` keyword argument to `AWSSecretsManagerSettingsSource`.
  • Added support for root model parsing in CLI.
  • Implemented snake_case conversion for Azure Key Vault keys.
  • Made `InitSettingsSource` resolution deterministic.
  • Improved Windows path handling in CLI.
  • Improved handling of environment variable prefixes to avoid fallback without prefix.

🐛 Bug Fixes

  • Fixed CLI serialization issues.
  • Fixed PydanticModel type checking.
  • Prevented `env_prefix` from falling back to unprefixed environment variables.
  • Fixed typo "Accesing" in the "Adding sources" documentation.
  • Fixed Windows path handling in CLI.
  • Fixed subparser abbreviation behavior.

🔧 Affected Symbols

CliSettingsSource.__init__AWSSecretsManagerSettingsSourceInitSettingsSourcemodel_configCliSettingsSourceAzureKeyVaultSettingsSource