dotenv-diff
Lightweight tool for quickly spotting missing keys and differing values in .env files
dotenv-diff helps compare multiple .env files and immediately see:
- Which variables are missing in which files
- Which values differ between environments
- A clear matrix overview of all keys and files
It is designed as a simple developer utility for projects that maintain multiple environment configurations (local, staging, production, etc.).
Features
- Compare any number of
.envfiles at once - Detect missing keys across environments
- Detect diverging values
- Show results in human‑friendly tables
- Three different views: summary, values, and presence
- Works with individual files, directories, and glob patterns
Installation
pip install dotenv-diff
Usage
All functionality is available through the command line interface.
You can pass:
- Individual
.envfiles - Directories containing
.env*files - Glob patterns like
.env.*
Reveal Mode
Environment variables are often quoted in .env files to protect sensitive
values or to ensure correct parsing.
When a value is wrapped in quotes, dotenv-diff treats it as masked and
hides the actual content in output tables.
Example:
SECRET_KEY="secret-value" -> SECRET_KEY ********
If you need to inspect the real values, you can reveal them using the --reveal flag after every command. This will display the actual contents instead of masked placeholders.
Commands
summary
Show a high‑level overview of differences.
dotenv-diff summary /path/to/.env.* [--reveal]
| Metric | Value |
|---|---|
| Total Files | 3 |
| Unique Keys | 12 |
| Incomplete Keys | 3 |
| Diverging Values | 4 |
Incomplete Key Details
• REDIS_HOST is missing in:
↳ .env.production
↳ .env.staging
Diverging Value Details
• APP_ENV
↳ .env.local: development
↳ .env.production: production
↳ .env.staging: staging
values
Show a matrix of actual values for each key and file.
dotenv-diff values /path/to/.env.* [--reveal]
| VARIABLE | .env.local | .env.staging | .env.production |
|---|---|---|---|
| APP_ENV | development | staging | production |
| DEBUG | true | true | false |
| LOG_LEVEL | DEBUG | — | INFO |
| DATABASE_USER | ******** | ******** | ******** |
| DATABASE_PASS | dev_pass | prod_pass | prod_pass |
| PORT | 8000 | 8000 | — |
presence
Show only whether a variable exists in each file.
dotenv-diff presence /path/to/.env.*
| VARIABLE | .env.local | .env.staging | .env.production |
|---|---|---|---|
| APP_ENV | ✅ | ✅ | ✅ |
| DEBUG | ✅ | ✅ | ✅ |
| LOG_LEVEL | ✅ | ❌ | ✅ |
| DATABASE_USER | ✅ | ✅ | ✅ |
| DATABASE_PASS | ✅ | ✅ | ✅ |
| PORT | ✅ | ✅ | ❌ |
Metadata
Release files for dotenv-diff 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dotenv_diff-0.2.1.tar.gz | 5.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dotenv_diff-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.0 kB
Release files / dotenv_diff-0.2.1.tar.gz
| Download URL | dotenv_diff-0.2.1.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
61e6528afda901dc313804792b21fa2d2fb60462fa4c1e839e2fdbbb3f628cc7
|
|
BLAKE2b-256 checksum How to use checksums |
4c525045f2489886b3771b16f224551ddeae230d075a43d196e13f2f1c75a2a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / dotenv_diff-0.2.1-py3-none-any.whl
| Download URL | dotenv_diff-0.2.1-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
37a5cc121b5463a90f5ecec690d3690e7394d7cb7ecdee211fce85f85f673b37
|
|
BLAKE2b-256 checksum How to use checksums |
d221ac646ca2653b85fe2590cfe48af95bffdfb8e4170f253f2436f3dc4e09ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|