# python-dotenv

> Read key-value pairs from a .env file and set them as environment variables

Source: https://talira.ai/catalog/python-dotenv-xnw2w6rp
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library, Command-line tool
- Categories: [libraries / configuration](https://talira.ai/categories/libraries/configuration), [developer tools / environment / env vars](https://talira.ai/categories/developer-tools/environment/env-vars), [languages / python](https://talira.ai/categories/languages/python)
- Licence: BSD-3-Clause[^3]
- Pricing: Free and open source[^3]
- Free tier: yes[^3]
- Backed by: [Saurabh Kumar](https://talira.ai/orgs/saurabh-kumar.md)

python-dotenv reads key-value pairs from a .env file and can set them as environment variables, so a [Python](https://talira.ai/catalog/python-tgjs08pq.md) app that takes its configuration from the environment, the 12-factor way, can load it from a file in development and from the real environment in production. load_dotenv() sets the variables in os.environ, while dotenv_values() returns them as a dict without touching the environment, so several files and the environment can be layered. It supports multiline values, POSIX-style ${VAR} expansion, streams and loading in IPython, and an optional dotenv CLI sets, lists and runs commands with a file's variables. PYTHON_DOTENV_DISABLED=1 turns loading off.

## Links

- Website: https://saurabh-kumar.com/python-dotenv/
- GitHub: https://github.com/theskumar/python-dotenv

## Problems it solves

- load environment variables from a .env file in my Python app
- keep local development settings out of my code and in a .env file
- run a command with variables from a .env file

## Features

- load_dotenv() sets .env values in os.environ
- dotenv_values() returns values as a dict without changing the environment
- POSIX ${VAR} variable expansion
- multiline values and streams
- IPython extension
- dotenv CLI to set, list and run with a file's variables

## Limitations

- Needs Python 3.10 or later[^1]
- Only ${VAR} is expanded: bare $VAR references are left as they are[^2]

## Trust

Overall: 0.58 out of 1.
Signals: maintenance 0.69, adoption 0.79, momentum 0.54, community 0.84, backing 0.30, extensibility 0.00.

- last commit 20 days ago
- 14 commits in the last 90 days
- latest release v1.2.4 2 months ago
- 8.9k GitHub stars
- 124 contributors
- backed by Saurabh Kumar

## Alternatives

- [dotenvx](https://talira.ai/catalog/dotenvx-30gqzg73.md): A secure dotenv, from the creator of dotenv
- [pydantic-settings](https://talira.ai/catalog/pydantic-settings-24kkfv29.md): Typed Python app settings from environment variables, .env files and secret stores

## Sources

[^1]: https://github.com/theskumar/python-dotenv/blob/main/pyproject.toml (checked 27 Nov 2026)
[^2]: https://github.com/theskumar/python-dotenv/blob/main/README.md (checked 27 Nov 2026)
[^3]: https://github.com/theskumar/python-dotenv/blob/main/LICENSE (checked 27 Nov 2026)
