Skip to main content

SOPS extension for pydantic-settings

Project description

pydantic-settings-sops

CI conda-forge pypi-version python-version

SOPS extension for pydantic-settings.

This package allows you to read SOPS files into a pydantic-settings object.

You can install this package via

pip install pydantic-settings-sops
# or
pixi add pydantic-settings-sops

Example

To use pydantic-settings-sops, adjust your settings sources by defining a custom settings_customise_sources. For more information on pydantic-settings, please visit the official documentation.

from pydantic_settings import (
    BaseSettings,
    PydanticBaseSettingsSource,
    SettingsConfigDict,
)
from pydantic_settings_sops import SOPSConfigSettingsSource

class SettingsExample(BaseSettings):
    model_config = SettingsConfigDict(
        yaml_file="secrets.yaml"
    )

    foobar: str

    @classmethod
    def settings_customise_sources(
        cls,
        settings_cls: BaseSettings,
        init_settings: PydanticBaseSettingsSource,
        env_settings: PydanticBaseSettingsSource,
        dotenv_settings: PydanticBaseSettingsSource,
        file_secret_settings: PydanticBaseSettingsSource,
    ) -> tuple[PydanticBaseSettingsSource, ...]:
        return (init_settings, SOPSConfigSettingsSource(settings_cls))

Installation

This project is managed by pixi. You can install the package in development mode using:

git clone https://github.com/pavelzw/pydantic-settings-sops
cd pydantic-settings-sops

pixi run pre-commit-install
pixi run postinstall
pixi run test

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_sops-0.1.2.tar.gz (57.7 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_sops-0.1.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file pydantic_settings_sops-0.1.2.tar.gz.

File metadata

  • Download URL: pydantic_settings_sops-0.1.2.tar.gz
  • Upload date:
  • Size: 57.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pydantic_settings_sops-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8d03ea8233cec696b4737563947bc668a7cd4a2773252b40948f850784d718cd
MD5 ec0c0e6bfb8f90b932d5dedbfc8f6f0a
BLAKE2b-256 047be45527771f7f92a1a31bd569a3b092c70ba33b50e8bf7dc18189e8e74057

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydantic_settings_sops-0.1.2.tar.gz:

Publisher: build.yml on pavelzw/pydantic-settings-sops

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_sops-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pydantic_settings_sops-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0e13d68d2630921d4ba1b45806b26d4a38a5bdc8880dba41d439591d331ce903
MD5 ded1dc462d374c20aede18eccad38942
BLAKE2b-256 deebadb8bb3873f4925b3c0c6c223b356ae51303cc9a2068f4f40e9a1d118cbe

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydantic_settings_sops-0.1.2-py3-none-any.whl:

Publisher: build.yml on pavelzw/pydantic-settings-sops

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