Skip to main content

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),
        )

Metadata

Release files for pydantic-ssm-settings 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydantic-ssm-settings 1.1.2
File Size Uploaded
pydantic_ssm_settings-1.1.2.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pydantic-ssm-settings 1.1.2
File Interpreter ABI Platform
pydantic_ssm_settings-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.6 kB

Release files / pydantic_ssm_settings-1.1.2.tar.gz

Download URL pydantic_ssm_settings-1.1.2.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b50228d1d863c1e97d9dfd018f7fdfe85fb65ab54f16a4f258b58de91a98b3a9
BLAKE2b-256 checksum
How to use checksums
579dbdb5acf5c072d517126f9c1058680d36019e6296a6ce027d7b1b17dc6cde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 5, 2025.

Transparency log

Release files / pydantic_ssm_settings-1.1.2-py3-none-any.whl

Download URL pydantic_ssm_settings-1.1.2-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0b01c00c64930bfad755ac78fafa9dbc4b3ea0a3b2b3a6a0f8eb1fd4d02b3c3b
BLAKE2b-256 checksum
How to use checksums
e9c530dcdae47685d9402b7514a7afc003217bfd3922fa01ee9c32a7135f61c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 5, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page