load-dotenv

Automatically load .env files into your Python environment at startup, with zero code changes.

Tool
PyPI
v0.1.0
0stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
15/100Needs Attention
Development Activity0
Maintenance0
Community4
Maturity56
Momentum0

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
67/100Good
Architecture60
Code Quality55
Innovation58
Learning Curve95

load-dotenv is a small Python package that automatically loads variables from a .env file into your process environment when Python starts, without adding any load_dotenv() call to your application code. It works via a .pth file that runs on interpreter startup, gated behind a LOAD_DOTENV environment variable so it only activates in development.

This lets you keep .env loading out of your production code path entirely: set LOAD_DOTENV=true locally and your variables are populated automatically, while production runs untouched. It builds on the popular python-dotenv package for the actual parsing.

What You Get

  • Automatic .env loading on interpreter startup with no code changes
  • An opt-in switch via the LOAD_DOTENV environment variable so production stays untouched
  • A configurable file path through the LOAD_DOTENV_PATH variable

Common Use Cases

  • Loading development-only configuration without editing application code
  • Keeping load_dotenv() calls out of production code paths
  • Sharing a single .env convention across a team’s local environments

Under The Hood

Architecture - The package ships a load_dotenv.pth file that Python executes automatically at interpreter startup. That hook checks the LOAD_DOTENV environment variable and, when enabled, calls into load_dotenv.py, which delegates to the python-dotenv package to parse the .env file (path overridable via LOAD_DOTENV_PATH) and populate os.environ.

Tech Stack - Pure Python packaged with a classic setup.py and MANIFEST.in; its single runtime dependency is python-dotenv, which does the actual file parsing. Distribution relies on the site-packages .pth mechanism.

Code Quality - The codebase is intentionally tiny: one .pth hook and a small load_dotenv.py module. There is no test suite, which fits its minimal scope but means correctness rests on python-dotenv.

API Design - There is effectively no API to learn: configuration is entirely through two environment variables (LOAD_DOTENV and LOAD_DOTENV_PATH), making adoption a matter of installing the package and setting a flag.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search