Skip to main content

pydantic-settings-yaml

Note: 0.2.x needs Pydantic>2.0,<3.0. Install 0.1.x if you still need Pydantic 1.x.

Yaml support for Pydantic settings. Load a yaml config file as nested Pydantic models.

Allows to use file:xxxx placeholders in the yaml config file for secrets. A placeholder is replaced with the contents of the file. Paths are relative to the 'secrets_dir' setting (see below).

Usage

$cat /config/config.yaml

database: 
  password: <file:database_password>
  username: my_database_username

$cat /secrets/database_password

my_secret_database_password

Python code example:

    from pydantic import BaseModel
    from pydantic_settings_yaml import YamlBaseSettings
    from pydantic_settings import SettingsConfigDict

    class Database(BaseModel):
        username: str
        password: str


    class Settings(YamlBaseSettings):
        database: Database

        # configure paths to secrets directory and YAML config file
        model_config = SettingsConfigDict(
            secrets_dir="/secrets", yaml_file="/config/config.yaml")

    settings = Settings()

    assert settings.dict() == {
        "database": {
            "password": "my_secret_database_password", 
            "username": "my_database_username"
        }
    }

Metadata

Release files for pydantic-settings-yaml 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydantic-settings-yaml 0.2.1
File Size Uploaded Provenance Actions
pydantic_settings_yaml-0.2.1.tar.gz 7.7 kB Without provenance Details for pydantic_settings_yaml-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pydantic-settings-yaml 0.2.1
File Interpreter ABI Platform Actions
pydantic_settings_yaml-0.2.1-py2.py3-none-any.whl Python 2, Python 3 none any Details for pydantic_settings_yaml-0.2.1-py2.py3-none-any.whl

Total release size: 14.4 kB

Release files / pydantic_settings_yaml-0.2.1.tar.gz

Download URL pydantic_settings_yaml-0.2.1.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f2c1ac1e0edff4597c5d8223df5e07211e70dc1faf7b47b3c757cc3cf2433b38
BLAKE2b-256 checksum
How to use checksums
86677cd819e7ff73e5fbf13851714606aeedecf7d62b48602b6b4f359369afa2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / pydantic_settings_yaml-0.2.1-py2.py3-none-any.whl

Download URL pydantic_settings_yaml-0.2.1-py2.py3-none-any.whl
Size 6.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
efe62012e4abab0f060dbdd359c889373b7b4ca3b46420761674b70658dd6859
BLAKE2b-256 checksum
How to use checksums
5aabdf6b49e0c727c88a7582ca4a519bd3c07442a732918c2ef8eb3c93ca5ece
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for pydantic-settings-yaml 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page