# Extension points — pydantic/pydantic-settings

> Canonical page: https://codevetter.com/unpack/pydantic-settings/extension-points

# Extension points — pydantic/pydantic-settings

Scanned commit 5927b441848c330853eac74c82358bc283cd3640 (2026-10-02). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

Customization centers on explicit source composition rather than automatic plugin discovery. Sources can reuse field preparation and observe higher-priority state. CLI extensions use model metadata and an argparse-compatible adapter surface. File readers, cloud-client injection, validation hooks, and public exports provide additional concrete places to extend behavior.
- Override settings_customise_sources to add, remove, or reorder dictionary-producing sources; its tuple establishes highest-first priority, and the orchestrator appends DefaultSettingsSource afterward. — [pydantic_settings/main.py#L329-L351](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/main.py#L329-L351) [pydantic_settings/main.py#L509-L516](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/main.py#L509-L516) [docs/index.md#L3457-L3469](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/docs/index.md#L3457-L3469)
- Subclass PydanticBaseSettingsSource and implement get_field_value/__call__; inherited prepare_field_value, field_is_complex, and decode_complex_value supply reusable conversion hooks. — [pydantic_settings/sources/base.py#L146-L212](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/sources/base.py#L146-L212)
- Dependent sources can read current_state and settings_sources_data populated immediately before __call__; GCP project resolution is an implemented example of consuming prior-source state. — [pydantic_settings/sources/base.py#L118-L144](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/sources/base.py#L118-L144) [pydantic_settings/main.py#L560-L563](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/main.py#L560-L563) [pydantic_settings/sources/providers/gcp.py#L285-L305](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/sources/providers/gcp.py#L285-L305)
- New structured-file providers can combine ConfigFileSourceMixin with InitSettingsSource and implement _read_file, retaining shared multi-file ordering, optional deep merging, and alias normalization. — [pydantic_settings/sources/base.py#L215-L239](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/sources/base.py#L215-L239) [pydantic_settings/sources/providers/json.py#L23-L55](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/sources/providers/json.py#L23-L55)
- CliSettingsSource accepts an external root_parser and injectable parse/add/group/subparser/help methods; adapters must honor argparse-compatible signatures, and external parsers cannot request case-insensitive matching. — [pydantic_settings/sources/providers/cli.py#L320-L324](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/sources/providers/cli.py#L320-L324) [pydantic_settings/sources/providers/cli.py#L387-L394](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/sources/providers/cli.py#L387-L394) [pydantic_settings/sources/providers/cli.py#L472-L474](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/sources/providers/cli.py#L472-L474) [pydantic_settings/sources/providers/cli.py#L980-L1008](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/sources/providers/cli.py#L980-L1008)
- CLI Annotated helpers and CliMutuallyExclusiveGroup extend model-driven parser generation; _CliArg and _parser_map connect field metadata to argument destinations, subcommand models, and serialization. — [pydantic_settings/sources/providers/cli.py#L92-L93](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/sources/providers/cli.py#L92-L93) [pydantic_settings/sources/providers/cli.py#L160-L188](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/sources/providers/cli.py#L160-L188) [pydantic_settings/sources/providers/cli.py#L302-L313](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/sources/providers/cli.py#L302-L313) [pydantic_settings/sources/providers/cli.py#L1689-L1703](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/sources/providers/cli.py#L1689-L1703)
- CliApp accepts an alternate cli_cmd_method_name, while Pydantic validators can transform or check the model after settings acquisition; inspected tests exercise alternate command dispatch and an after-model validator. — [pydantic_settings/main.py#L823-L830](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/main.py#L823-L830) [pydantic_settings/main.py#L777-L818](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/main.py#L777-L818) [tests/test_source_cli.py#L3273-L3291](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/tests/test_source_cli.py#L3273-L3291) [tests/test_settings.py#L185-L195](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/tests/test_settings.py#L185-L195)
- GCP supports prebuilt secret_client injection and SecretVersion field metadata; adding public APIs or provider dependencies also involves the explicit package exports and optional-extras manifest. — [pydantic_settings/sources/providers/gcp.py#L163-L174](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/sources/providers/gcp.py#L163-L174) [pydantic_settings/sources/providers/gcp.py#L238-L265](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/sources/providers/gcp.py#L238-L265) [pydantic_settings/__init__.py#L36-L72](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pydantic_settings/__init__.py#L36-L72) [pyproject.toml#L50-L58](https://github.com/pydantic/pydantic-settings/blob/5927b441848c330853eac74c82358bc283cd3640/pyproject.toml#L50-L58)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
