Skip to main content

The universal .env and configuration library. One API for every language.

Project description

dotlyte — Python

The universal .env and configuration library for Python.

Installation

pip install dotlyte

Quick Start

from dotlyte import load

config = load()

config.port           # automatically int
config.debug          # automatically bool
config.database.host  # dot-notation access

Features

  • Zero-config startload() with no arguments just works
  • .env file loading — auto-detects .env, .env.local, .env.{env}
  • YAML, JSON, TOML support — config.yaml, config.json, config.toml
  • Layered priority — env vars > .env > YAML > JSON > TOML > defaults
  • Type coercion"true"True, "8080"8080, "a,b,c"["a", "b", "c"]
  • Dot-notation accessconfig.database.host
  • Safe accessconfig.get("key", default)
  • Required accessconfig.require("key") throws if missing
  • Prefix strippingAPP_DB_HOSTconfig.db.host

Advanced Usage

config = load(
    files=["config.yaml", ".env.production"],
    prefix="APP",
    defaults={"port": 3000, "debug": False},
    env="production",
)

API

load(**options) → Config

Option Type Description
files list[str] Explicit files to load
prefix str Strip env var prefix
defaults dict Default values (lowest priority)
sources list[str] Custom source order
env str Environment name

Config

Method Description
config.key Dot-notation access
config.get(key, default) Safe access with fallback
config.require(key) Throws DotlyteError if missing
config.to_dict() Convert to plain dict

License

MIT

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

dotlyte-0.1.1.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

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

dotlyte-0.1.1-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

Details for the file dotlyte-0.1.1.tar.gz.

File metadata

  • Download URL: dotlyte-0.1.1.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for dotlyte-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cc32a57d441488a69aa46a05d1e0c05902b1b4338e2cb5b9b2f8e36ab5c128d1
MD5 fe5abf4b888fb25a4d63fb6035830b3b
BLAKE2b-256 4d3612a75cf38df2f948445d0a6abf1a62520db6909b023e7fe61910fe02f468

See more details on using hashes here.

File details

Details for the file dotlyte-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: dotlyte-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 28.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for dotlyte-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0363b17fce5068f3441a955573942776e0488fac969643a327125749b5556fd2
MD5 759a6e6ce14ece202cc2d08bf7a2c3ea
BLAKE2b-256 0ebcf5b29b8ed147997e2bc2a7254c2ddc460b75879b0a8d83cc8ce44db7cfc1

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