Skip to main content

Centralized Settings Loader for Python Apps

Project description

sai-akruti

Centralized, flexible settings loader for Python apps using Pydantic v2.x.

This library provides a reusable, extensible settings system with built-in support for:

  • Multiple .env files
  • AWS Systems Manager (SSM) Parameter Store
  • AWS Secrets Manager
  • Standard environment variables and secret files (handled via Pydantic automatically)

It’s designed for clean separation of settings logic and allows each app to define its own settings hierarchy, source priorities, and overrides.


✅ Features

  • Compatible with Pydantic v2.x (pydantic-settings).
  • Automatically loads settings on instantiation — no manual .load() needed.
  • Supports per-environment configuration (dev, prod, etc.).
  • Easy to extend for other sources (YAML, remote config, etc.).
  • Production-safe and future-proof.

✅ Installation

pip install sai-akruti

✅ AWS Credentials & IAM Permissions (Required)

This library can also use AWS Systems Manager (SSM) Parameter Store and AWS Secrets Manager for secure configuration. Required IAM Permissions:

Ensure your environment (developer machine, Lambda, EC2, ECS, etc.) has the following IAM permissions:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ssm:GetParametersByPath",
        "secretsmanager:GetSecretValue"
      ],
      "Resource": "*"
    }
  ]
}

Best Practice: In production, restrict the "Resource" field to specific parameter/secret ARNs.

How Credentials Are Provided:

This library uses boto3's standard credential chain:

  • Environment Variables(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, etc.)
  • ~/.aws/credentials or configured profiles (via aws configure).
  • IAM Role on EC2, Lambda, or ECS (via Instance Metadata Service).
  • AWS CLI SSO or other advanced credential providers.

Usage in Lambda Functions:

When used in an AWS Lambda function:

  • Assign an IAM Role to your Lambda function with the above permissions.
  • No manual credential configuration is needed—boto3 automatically uses the Lambda’s IAM Role.
  • Example IAM Policy for Lambda:
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ssm:GetParametersByPath",
        "secretsmanager:GetSecretValue"
      ],
      "Resource": "arn:aws:ssm:REGION:ACCOUNT_ID:parameter/your-prefix/*"
    }
  ]
}

How to retrieve AWS Account ID:

To retrieve the AWS Account ID in your code:

import boto3
account_id = boto3.client("sts").get_caller_identity()["Account"]

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

sai_akruti-0.1.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sai_akruti-0.1.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file sai_akruti-0.1.1.tar.gz.

File metadata

  • Download URL: sai_akruti-0.1.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.0 Windows/11

File hashes

Hashes for sai_akruti-0.1.1.tar.gz
Algorithm Hash digest
SHA256 36b262a0dc0c578c31f163bdb1094f395837eb3b6b78bdf9b219773b0415fa9b
MD5 1736ad63061ca116388e1552e3859f95
BLAKE2b-256 d9273d0f62c6838b45337798199b34dc7ddb19f361a0aec878c5bf785abe9537

See more details on using hashes here.

File details

Details for the file sai_akruti-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: sai_akruti-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.0 Windows/11

File hashes

Hashes for sai_akruti-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 51fae4c4cb44e503cb62cdbf4fa9e9726da61be1e311cd10757295871fee40b5
MD5 cda07c5504e807bac1164ab06b08c0dc
BLAKE2b-256 2b246fc99ee01fc6a1ca17a0197ea143270f9879ee2d1073b852fb7677d06eb9

See more details on using hashes here.

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