Skip to main content

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 .yaml config files with a single function
  • ✅ Access .env variables like os.getenv()
  • ✅ Unified and clean API for config management
  • ✅ Minimal dependency: just python-dotenv and PyYAML

📦 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 .env file
  • jsonFile – Path to .json file
  • yamlFile – Path to .yaml or .yml file

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 .toml files

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple_loader-0.1.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_loader-0.1.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

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

Hashes for simple_loader-0.1.0.tar.gz
Algorithm Hash digest
SHA256 309b77e25607fa2125090cef4c4231bd451a7762c90a731a8bd8c9af60513dc8
MD5 5ceaab6cdd5fdf2ca2df58e639a5bd6e
BLAKE2b-256 0530a9a91a89bb82e3b6604ac23c0cf39acab604d9eec46a5bb10db8fe8c0a33

See more details on using hashes here.

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

Hashes for simple_loader-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3d95907e0a96e0af4fd395a2f0dacc8c2119abb7a5d118d4cbccc392520e7d1c
MD5 eee61a4e785f6ee89a94e591a23cf54f
BLAKE2b-256 2920b02a4bd246ea0b07cbf124b115883bcdc7aeee94fee148bfcf2b1e6b0120

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page