Easy environment variables management with type validation
Project description
easy-dotenv
Simple and type-safe environment variables management for Python.
Installation
pip install easy-dotenv
Usage
from easy_dotenv import EnvLoader
env = EnvLoader.load(
# Required variables
database_url=str,
port=int,
# Optional variables with defaults
debug=(bool, False),
workers=(int, 4)
)
# Access your environment variables
print(env.database_url)
print(env.port)
print(env.debug) # False if not set
print(env.workers) # 4 if not set
Features
- Type validation
- Required/optional variables
- Default values
- .env file support
- Clean and simple API
- Type hints support
Error Handling
from easy_dotenv import EnvLoader, EnvMissingError, EnvTypeError
try:
env = EnvLoader.load(
api_key=str,
port=int
)
except EnvMissingError as e:
print("Missing environment variables:", e)
except EnvTypeError as e:
print("Invalid environment variable type:", 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
easy_dotenv-0.1.0.tar.gz
(2.3 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 easy_dotenv-0.1.0.tar.gz.
File metadata
- Download URL: easy_dotenv-0.1.0.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eddc5d1cf977bcc7ce20d265d7d5a1e4f4e1b9895da1ed3534ee4366a0f8fb47
|
|
| MD5 |
9586d88f5179d18da97cc2b07b1e7785
|
|
| BLAKE2b-256 |
b174746912e4f18758514e080b057a232b2626f93c4342c65a852d59402d37aa
|
File details
Details for the file easy_dotenv-0.1.0-py3-none-any.whl.
File metadata
- Download URL: easy_dotenv-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef63182b7e0ed1118e986b2a43b8f3c6642e19e2a26feff06a108d5264760402
|
|
| MD5 |
7c3d78f07d6ba1f4f275bdf6eab93f86
|
|
| BLAKE2b-256 |
fd588db9b0979172927d44bc54e080d0399bf54d597f4fe8d731bcfade540439
|