CodeVetter · Repo Unpack · Feature catalog
pydantic/pydantic-settings
The user-facing surface is primarily Python APIs plus model-generated command-line behavior. Configuration features cover precedence, aliases, nested values, decoding, files, and secrets. Optional cloud sources adapt remote secret stores to model fields. Reloading, shared caching, diagnostic logging, help generation, and CLI serialization round out the operational APIs.
- SettingsConfigDict and constructor overrides configure case sensitivity, environment prefixes and prefix targets, empty-value filtering, nested delimiters/split limits, null strings, and enum parsing.
- Complex environment values support JSON decoding and nested-key overrides; NoDecode, ForceDecode, and enable_decoding control decoding, while nested_model_default_partial_update can contribute model/dataclass default mappings.
- Dotenv loading supports multiple files, encoding, bounded parent-directory discovery, and only_existing or match_prefix filtering; explicit _env_file=None disables loading.
- JSON, TOML, and YAML sources accept multiple paths or packaged Traversable resources and optional deep merging; TOML selects tuple-based tables, YAML selects dotted sections, and pyproject defaults to tool.pydantic-settings.
- Flat secrets load field-matched UTF-8 files from ordered directories; nested secrets additionally support directory-shaped nesting, separate prefix/case rules, missing-directory policies, and a default 16 MiB size limit.
- Cloud integrations include AWS Secrets Manager with optional VersionId, recursive decrypted AWS SSM parameters, Azure enabled-secret lookup and name conversion, and GCP project resolution plus per-field SecretVersion metadata.
- CLI models support subcommands, positional and variadic arguments, dual/toggle/explicit boolean flags, unknown-argument capture, suppression, shortcuts, kebab-case naming, mutually exclusive groups, and customizable parser methods.
- Operational APIs include settings_cached/settings_clear_cache, documented in-place __init__ reloading, PYDANTIC_SETTINGS_DEBUG source diagnostics, and CliApp run, run_subcommand, serialize, format_help, and print_help.