Type-safe environment variable management
Project description
envmaster 🔐
Type-safe environment variable management for Python.
Installation
pip install envmaster
Usage
from envmaster import env
# String (required)
DATABASE_URL = env.str("DATABASE_URL", required=True)
# Boolean with default
DEBUG = env.bool("DEBUG", default=False)
# Integer with default
MAX_CONNECTIONS = env.int("MAX_CONNECTIONS", default=10)
# Float
TIMEOUT = env.float("TIMEOUT", default=30.0)
# List (comma-separated)
ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", default=["localhost"])
# JSON
CONFIG = env.json("CONFIG", default={})
Methods
| Method | Return Type | Description |
|---|---|---|
env.str() |
str | String value |
env.int() |
int | Integer value |
env.float() |
float | Float value |
env.bool() |
bool | Boolean value |
env.list() |
list | List of strings |
env.json() |
any | Parsed JSON |
Boolean Values
Truthy: true, 1, yes, on
Falsy: false, 0, no, off
Error Handling
from envmaster import env, EnvError
try:
secret = env.str("SECRET_KEY", required=True)
except EnvError as e:
print(f"Configuration error: {e}")
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
envmaster-1.0.0.tar.gz
(2.8 kB
view details)
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 envmaster-1.0.0.tar.gz.
File metadata
- Download URL: envmaster-1.0.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22264aa492b193430d23e0837a181b4bc0da854b5a5145e6a7359d79cfd099bd
|
|
| MD5 |
f926ed9b4670b5fe9caa00f4d3518aaf
|
|
| BLAKE2b-256 |
0c9f7d7e49c860d988ff35d240179f30d76f0453e41025e2ba00e3ead36a727d
|
File details
Details for the file envmaster-1.0.0-py3-none-any.whl.
File metadata
- Download URL: envmaster-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a6bf0a73fd19070ba91b63433029c4aadf7ff74810df737f6ed69fb87c51a05
|
|
| MD5 |
f6b215734117f4e1403dea981183e8a2
|
|
| BLAKE2b-256 |
e7900d0c94821772723a1b51ef2a1aad7c4e54e7a1921deb0e9aba0b39c0d82a
|