A simple loader for .env, .json, and .yaml config files
Project description
simple-loader
A simple Python library for loading and accessing configuration from .env, .json, and .yaml files — all in one place.
🌟 Features
- ✅ Load
.env,.json, and.yamlconfig files with a single function - ✅ Access
.envvariables likeos.getenv() - ✅ Unified and clean API for config management
- ✅ Minimal dependency: just
python-dotenvandPyYAML
📦 Installation
pip install simpleloader
🛠 Usage
📁 Example files
# .env
USERNAME=env_user
API_KEY=env_key_123
// config.json
{
"database": {
"host": "localhost",
"port": 5432
},
"debug": true
}
# config.yaml
server:
host: "0.0.0.0"
port: 8000
logging:
level: "info"
🧪 Python code
import simpleloader
simpleloader.load(
envFile=".env",
jsonFile="config.json",
yamlFile="config.yaml"
)
print(simpleloader.get_env("USERNAME")) # → env_user
print(simpleloader.get_json()["database"]["host"]) # → localhost
print(simpleloader.get_yaml()["server"]["port"]) # → 8000
📘 API
load(envFile=None, jsonFile=None, yamlFile=None)
Load config files. Each argument is optional.
envFile– Path to.envfilejsonFile– Path to.jsonfileyamlFile– Path to.yamlor.ymlfile
get_env(key: str, fallback: Any = None)
Get a variable from the .env file (or environment), with optional fallback.
get_json() -> dict
Returns the loaded JSON config as a dictionary.
get_yaml() -> dict
Returns the loaded YAML config as a dictionary.
🧾 License
MIT © 2025 redbean0721
💡 Future Plans
- Add
get("section.key")unified access across all config types - Support config priority / overrides
- Add support for
.tomlfiles
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
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 simple_loader-0.1.0.tar.gz.
File metadata
- Download URL: simple_loader-0.1.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
309b77e25607fa2125090cef4c4231bd451a7762c90a731a8bd8c9af60513dc8
|
|
| MD5 |
5ceaab6cdd5fdf2ca2df58e639a5bd6e
|
|
| BLAKE2b-256 |
0530a9a91a89bb82e3b6604ac23c0cf39acab604d9eec46a5bb10db8fe8c0a33
|
File details
Details for the file simple_loader-0.1.0-py3-none-any.whl.
File metadata
- Download URL: simple_loader-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d95907e0a96e0af4fd395a2f0dacc8c2119abb7a5d118d4cbccc392520e7d1c
|
|
| MD5 |
eee61a4e785f6ee89a94e591a23cf54f
|
|
| BLAKE2b-256 |
2920b02a4bd246ea0b07cbf124b115883bcdc7aeee94fee148bfcf2b1e6b0120
|