AWS SSM support for Pydantic Settings
Project description
pydantic-ssm-settings
Integrate AWS Systems Manager Parameter Store with Pydantic Settings.
Usage
The simplest way to use this module is to inhert your settings from SsmBaseSettings. This add the SsmSettingsSource as a custom settings source and enabled passing source configuration (e.g. _ssm_prefix, _ssm_client) via kwargs when initializing a settings class.
from pydantic_ssm_settings import SsmBaseSettings
class WebserviceSettings(SsmBaseSettings):
some_val: str
another_val: int
WebserviceSettings(_ssm_prefix="/prod/webservice")
Alternatively, configuration may be specified within the settings class via BaseModel.model_config:
from pydantic_ssm_settings import SsmSettingsConfigDict
class WebserviceSettings(SsmBaseSettings):
model_config = SsmSettingsConfigDict(ssm_prefix="/prod/webservice")
some_val: str
another_val: int
WebserviceSettings()
If it is preferred to avoid altering the baseclass of a settings model, the source can be manually added and configured as such:
from typing import Tuple, Type
from pydantic_settings import (
BaseSettings,
EnvSettingsSource,
InitSettingsSource,
PydanticBaseSettingsSource,
SecretsSettingsSource,
)
from pydantic_ssm_settings import SsmSettingsConfigDict, SsmSettingsSource
class WebserviceSettings(BaseSettings):
model_config = SsmSettingsConfigDict(ssm_prefix="/asdf")
foo: str
def settings_customise_sources(
self,
settings_cls: Type[BaseSettings],
init_settings: InitSettingsSource,
env_settings: EnvSettingsSource,
dotenv_settings: PydanticBaseSettingsSource,
file_secret_settings: SecretsSettingsSource,
) -> Tuple[PydanticBaseSettingsSource, ...]:
return (
init_settings,
env_settings,
dotenv_settings,
file_secret_settings,
SsmSettingsSource(settings_cls),
)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydantic_ssm_settings-1.1.2.tar.gz.
File metadata
- Download URL: pydantic_ssm_settings-1.1.2.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b50228d1d863c1e97d9dfd018f7fdfe85fb65ab54f16a4f258b58de91a98b3a9
|
|
| MD5 |
c568e6bede97b68933a57d8d19811798
|
|
| BLAKE2b-256 |
579dbdb5acf5c072d517126f9c1058680d36019e6296a6ce027d7b1b17dc6cde
|
Provenance
The following attestation bundles were made for pydantic_ssm_settings-1.1.2.tar.gz:
Publisher:
main.yaml on developmentseed/pydantic-ssm-settings
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydantic_ssm_settings-1.1.2.tar.gz -
Subject digest:
b50228d1d863c1e97d9dfd018f7fdfe85fb65ab54f16a4f258b58de91a98b3a9 - Sigstore transparency entry: 168789022
- Sigstore integration time:
-
Permalink:
developmentseed/pydantic-ssm-settings@be829419e680c28ea23f85298b77579e291cabe4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/developmentseed
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yaml@be829419e680c28ea23f85298b77579e291cabe4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pydantic_ssm_settings-1.1.2-py3-none-any.whl.
File metadata
- Download URL: pydantic_ssm_settings-1.1.2-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b01c00c64930bfad755ac78fafa9dbc4b3ea0a3b2b3a6a0f8eb1fd4d02b3c3b
|
|
| MD5 |
c98308af68cae445a9b4d038d218ee45
|
|
| BLAKE2b-256 |
e9c530dcdae47685d9402b7514a7afc003217bfd3922fa01ee9c32a7135f61c2
|
Provenance
The following attestation bundles were made for pydantic_ssm_settings-1.1.2-py3-none-any.whl:
Publisher:
main.yaml on developmentseed/pydantic-ssm-settings
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydantic_ssm_settings-1.1.2-py3-none-any.whl -
Subject digest:
0b01c00c64930bfad755ac78fafa9dbc4b3ea0a3b2b3a6a0f8eb1fd4d02b3c3b - Sigstore transparency entry: 168789025
- Sigstore integration time:
-
Permalink:
developmentseed/pydantic-ssm-settings@be829419e680c28ea23f85298b77579e291cabe4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/developmentseed
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yaml@be829419e680c28ea23f85298b77579e291cabe4 -
Trigger Event:
push
-
Statement type: