Registry / devops / python-dotenv

python-dotenv

JSON →
library1.2.3pypypi✓ verified 27d ago

python-dotenv is a Python library that reads key-value pairs from a .env file and sets them as environment variables. The current version is 1.2.2, released in March 2026. The library is actively maintained with regular updates.

pip install python-dotenv
INSTALL
IMPORT
SIG · PYTHON-DOTENV
P
python-dotenv
devopspythonv1.2.3
Install
1.7s avg
Import
56ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.056s · 17.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.056s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

load_dotenv
from dotenv import load_dotenv
import dotenv
The correct import is from dotenv import load_dotenv; importing dotenv directly will not work.

This example demonstrates how to load environment variables from a .env file and access them using os.environ.

from dotenv import load_dotenv import os # Load environment variables from .env file load_dotenv() # Access environment variables SECRET_KEY = os.environ.get('SECRET_KEY', '') DATABASE_PASSWORD = os.environ.get('DATABASE_PASSWORD', '') print(f'SECRET_KEY: {SECRET_KEY}') print(f'DATABASE_PASSWORD: {DATABASE_PASSWORD}')
dotenv --version
Debug
Known issues
breakingDropped support for Python 3.7; minimum required version is now Python 3.10.
fix
Upgrade your Python environment to version 3.10 or higher.
affects: 1.0.0 and later
gotchaImporting dotenv directly instead of from dotenv import load_dotenv will result in ImportError.
fix
Use from dotenv import load_dotenv to import the function correctly.
affects: All versions
gotchaThe load_dotenv function does not override existing environment variables by default.
fix
Pass override=True to load_dotenv() if you want to override existing environment variables.
affects: All versions
gotchaThe dotenv run command now forwards flags directly to the specified command.
fix
Ensure that any flags intended for dotenv run are placed before the command to avoid unintended behavior.
affects: 1.2.2 and later
Upgrade
Version history
1.2.3latest on PyPI · released Aug 16, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
8
OpenAI (training)
1
Resources
python-dotenv — pip install python-dotenv · libregistry