Skip to main content

Settings management for Pydantic models using Doppler

Project description

Pydantic Settings Doppler

CI codecov Pydantic v2 only PyPI - Implementation PyPI - Python Version PyPI - License PyPI - Version

Pydantic Settings for Doppler integration! This package provides a seamless way to load configuration values from Doppler into your Pydantic models. It leverages the power of Doppler's secrets management and Pydantic's settings management to make your application configuration secure and easy to use.

🚀 Features

  • Secure: Fetch secrets directly from Doppler.
  • Simple: Integrates seamlessly with Pydantic's BaseSettings.
  • Flexible: Supports environment variable fallbacks and default values.

📦 Installation

Install the package using pip:

pip install pydantic-settings-doppler

🛠️ Usage

Here's a quick example to get you started:

from pydantic_settings import BaseSettings
from pydantic_settings.sources import PydanticBaseSettingsSource
from pydantic_settings_doppler import DopplerSettingsSource


class Settings(BaseSettings):
    database_url: str
    api_key: str

    @classmethod
    def settings_customise_sources(
        cls,
        settings_cls: type[BaseSettings],
        init_settings: PydanticBaseSettingsSource,
        env_settings: PydanticBaseSettingsSource,
        dotenv_settings: PydanticBaseSettingsSource,
        file_secret_settings: PydanticBaseSettingsSource,
    ) -> tuple[PydanticBaseSettingsSource, ...]:
        return (
            init_settings,
            DopplerSettingsSource(
                settings_cls,
                token="your-doppler-token",
                project_id="your-project-id",
                config_id="your-config-id",
            ),
            env_settings,
            dotenv_settings,
            file_secret_settings,
        )


# Load settings
settings = Settings()
print(settings.database_url)
print(settings.api_key)

📖 Documentation

For more details, check out the Doppler documentation and Pydantic documentation.

🧑‍💻 Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

⚖️ License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydantic_settings_doppler-0.1.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydantic_settings_doppler-0.1.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file pydantic_settings_doppler-0.1.1.tar.gz.

File metadata

File hashes

Hashes for pydantic_settings_doppler-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e82a2a0aec17071771df66ad3e9fecd98426ce46562e8969c93068a9afb48f00
MD5 d3c3e61837aaac476842b04099bd605e
BLAKE2b-256 8e9dc0318aaefa6789d6aad85e06301fcf4a34ea2ebf031c34d162f6ee9af3c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydantic_settings_doppler-0.1.1.tar.gz:

Publisher: release.yaml on ajauniskis/pydantic-settings-doppler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydantic_settings_doppler-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pydantic_settings_doppler-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 128bb70836f896acda28946c5d416d14ac396f8d6ceeb225829ce224ef65c2a7
MD5 2261bddaf531bc46e621ec65b017f454
BLAKE2b-256 cd32e67cee1c0487a06d9aa637eef7754c72e623aef94f2ad2b7928baa86161f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydantic_settings_doppler-0.1.1-py3-none-any.whl:

Publisher: release.yaml on ajauniskis/pydantic-settings-doppler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page