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.0.tar.gz
.
File metadata
- Download URL: pydantic_settings_sops-0.1.0.tar.gz
- Upload date:
- Size: 55.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3978e0cc0e8398e451ee85660e0fc871abbbe7e2d5c9cd7a07f3479dd56d64f |
|
MD5 | 67d8bcedb45b2107510a2d7a9a8a9028 |
|
BLAKE2b-256 | a49479a777e3879929e62a77028bbc36ce1eababf55c75fbe4e33d75ec519cdd |
File details
Details for the file pydantic_settings_sops-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: pydantic_settings_sops-0.1.0-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 | 69b16dda25fd07d48140a3aa10245ce3e2aba4ab49312c24127318aaf4d25877 |
|
MD5 | 28384c505f7caaf6439926845bfa1b45 |
|
BLAKE2b-256 | 6d7f3515e465f11560513d6031ec789bb88214b1f7b0414fc276110e2aec6093 |