SOPS extension for pydantic-settings
Project description
pydantic-settings-sops
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pydantic_settings_sops-0.1.1.tar.gz
.
File metadata
- Download URL: pydantic_settings_sops-0.1.1.tar.gz
- Upload date:
- Size: 61.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a85b3782c2e05ebb3bdf86df53fdaf69506da0f8c8e0925dea5f4e867b5d1587 |
|
MD5 | 274e2d1bf438522b67423b52248477df |
|
BLAKE2b-256 | 8e27b0d9a5d878fc35b7c713c90343fc15e479937c2acac02478daf0562265d9 |
File details
Details for the file pydantic_settings_sops-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: pydantic_settings_sops-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd9de9c8556cf85136d64af9bf633ab8b2253ea63004878d101889930a368e51 |
|
MD5 | 7ae9423c863cac8cf211dcd96e7fd36b |
|
BLAKE2b-256 | b83d47da66d10f7b6f4a7e92760a0b66269da4d7982e7781ed8345533c185a9b |