🧩 DEAL — Dataclass Environment Auto Loader
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
.envfile or system environment; - Masks sensitive values (e.g. fields containing
"KEY") instr(Config); - Exposes a static
Configholder accessible from anywhere in your code.
🚀 Installation
From PyPI
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
git clone https://github.com/kundlatsch/py_deal.git
cd py_deal
pip install -r requirements.txt
Run tests
pytest -v
# You can manually test the library with the included script
python -m scripts.manual_test
📜 License
MIT © 2025 Gustavo Kundlatsch
Metadata
Release files for py-deal 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py_deal-0.1.0.tar.gz | 7.1 kB | Without provenance | Details for py_deal-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_deal-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for py_deal-0.1.0-py3-none-any.whl |
Total release size: 13.6 kB
Release files / py_deal-0.1.0.tar.gz
| Download URL | py_deal-0.1.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d12a52ad0769a154f32ce13920cab7424e8a615bffa66054dba24fdd5bf212cc
|
|
BLAKE2b-256 checksum How to use checksums |
a2aab397162d1d057a8896f316a408ebde7239ce09d72c470636a1e71342e913
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / py_deal-0.1.0-py3-none-any.whl
| Download URL | py_deal-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c8e1b331a331a356631a5688dbdb4a5b681ee2fc2c99fa076f12807907c879e3
|
|
BLAKE2b-256 checksum How to use checksums |
32154e0c5a6d6f28f986c7e8bd3821885a2a3b1ba7b7436cfddeed1193ab544d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Security for py-deal 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.