semvec/pypi-packages huggingface dataset:
SecretsServiceManager 0.1.1
A Python package providing helper function to dynamically retrieve secrets & their values from cloud platforms like Azure or AWS.
Requires Python: >=3.9

# SecretsManager

A Python package providing helper function to dynamically retrieve secrets & their values from cloud platforms like Azure or AWS.

## Features

- Connects to Azure Key Vault or AWS Secrets Manager client.
- Retrieves the list of all the secrets & their respective values.
- Handles authentication using Azure AD `DefaultAzureCredential` for Azure and `boto3` library for connecting to the AWS Session client.
- Returns a dictionary, with key-value pairs of all the secrets & their valies.

## Installation

Install via PyPI once published:

```bash
pip install SecretsManager
```

# Usage

## Retrieving the secrets from Azure/AWS

```python
from SecretsManager import get_secrets

# Your connection info
conn_point = "Azure" or "AWS
azure_vault_url = "https://your-vault-url.vault.azure.net/"
aws_secret_name = "your-aws-secret-name"
aws_region = "your-aws-region-name"

# call the function with the paramets
result = get_secrets(conn_point, azure_vault_url, aws_secret_name, aws_region)
print(result)

# Example usage :
key_value = result["key_name"]
```

# Prerequisites

- For Azure:
    - Azure environment or VM's Managed Identity configured for Azure authentication.
    - Azure Key Vault set up in the same subscription in which the VM is created.
    - Appropriate **IAM Role assignments** to be provided to the Key Vault, wherein VM's Managed Identity is to be given the `key-vault-secrets-user` role, so that it has the read access for the contents of the secrets.
    - `azure-identity` Python package installed for `DefaultAzureCredential` support.
    - give it some time (~2-3mins) to propagate these permissions.
    - [[Follow this link for step-by-step configuration details](https://learn.microsoft.com/en-us/azure/key-vault/secrets/quick-create-python?tabs=azure-cli)]

- For AWS:
    - AWS environment or EC2 Instance(VM) configured for AWS authentication.
    - Create an IAM Role having the permission for `SecretsManagerReadWrite`, that would provide proper access.
    - Assign this **AWS IAM role** to the security of the EC2 Instance(VM), that would give the EC2 Instance the access to retrieve all the secrets.
    - `boto3` Python package installed for AWS Session client connection support.
    - [[Follow this link for step-by-step configuration details](https://docs.aws.amazon.com/secretsmanager/)]


```bash
pip install azure-identity azure-keyvault-secrets boto3
```

# License

This project is licensed under the MIT License - see the [LICENSE] (LICENSE) file for details.

# Contributing

Feel free to open issues or submit pull requests to improve the package.

# Author

Antick Mazumder â€” antick.majumder@gmail.com
py-deal 0.1.0
Simple .env-to-dataclass validator and static config holder
Requires Python: >=3.9

# 🧩 DEAL — Dataclass Environment Auto Loader

[![PyPI version](https://img.shields.io/pypi/v/py-deal.svg?color=blue)](https://pypi.org/project/py-deal/)
[![Python version](https://img.shields.io/badge/python-3.9%2B-blue)](https://www.python.org/)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)

---

**DEAL** (Dataclass Environment Auto Loader) is a lightweight Python library that loads and validates `.env` files into a typed `dataclass` schema.

It automatically:
- Casts environment variables to the correct types (`str`, `int`, `float`, `bool`, `Optional`, `list`, `dict`);
- Reads from a `.env` file or system environment;
- Masks sensitive values (e.g. fields containing `"KEY"`) in `str(Config)`;
- Exposes a static `Config` holder accessible from anywhere in your code.

---

## 🚀 Installation

### From PyPI

```bash
pip install py-deal
```

### From source

```
git clone https://github.com/kundlatsch/py_deal.git
cd py_deal
pip install .
```

## ⚙️ Usage Example

```
from dataclasses import dataclass
from typing import List, Dict, Any
from deal.config import Config

@dataclass
class Settings:
    APP_NAME: str
    DEBUG: bool
    PORT: int
    ALLOWED_HOSTS: List[str]
    DB_CONFIG: Dict[str, Any]
    AWS_KEY: str
    DB_KEY: str
    API_TOKEN: str


# Load configuration from .env
Config.load(Settings, env_path=".env")

# Print masked output
print(str(Config))

# Access raw values
print(Config.settings.APP_NAME)
print(Config.settings.DB_CONFIG["port"])
```

### Example .env
```
APP_NAME=My Cool App
DEBUG=true
PORT=8080
ALLOWED_HOSTS=localhost,127.0.0.1
DB_CONFIG={"host": "localhost", "port": 5432}
AWS_KEY=abc123SECRET
DB_KEY=mydbsuperkey
API_TOKEN=tok_xyz_999
```

### Output
```
=== Loaded Settings ===
APP_NAME='My Cool App'
DEBUG=True
PORT=8080
ALLOWED_HOSTS=['localhost', '127.0.0.1']
DB_CONFIG={'host': 'localhost', 'port': 5432}
AWS_KEY=abc*****
DB_KEY=myd*****
API_TOKEN='tok_xyz_999'
My Cool App
5432
```

## 🧑‍💻 Development Setup

Clone and install dependencies

```bash
git clone https://github.com/kundlatsch/py_deal.git
cd py_deal
pip install -r requirements.txt
```

Run tests

```bash
pytest -v

# You can manually test the library with the included script
python -m scripts.manual_test
```

## 📜 License

MIT © 2025 [Gustavo Kundlatsch](https://github.com/kundlatsch)