Skip to main content

Lightweight tool for quickly spotting missing keys and differing values in .env files

Project description

dotenv-diff

PyPI Python License Build

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 .env files 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 .env files
  • 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]
╭─ SUMMARY ───────────────────╮
│ 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            │     ✅     │      ✅     │       ❌       │
╰───────────────────────────────────────────────────────────────╯

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

dotenv_diff-0.2.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

dotenv_diff-0.2.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file dotenv_diff-0.2.0.tar.gz.

File metadata

  • Download URL: dotenv_diff-0.2.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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}

File hashes

Hashes for dotenv_diff-0.2.0.tar.gz
Algorithm Hash digest
SHA256 79e5482cbca6d95d576988a0b2e998f7cf1e901a9739262cfbc597d7cb46b3a6
MD5 b190ed2e1b0e9ada896e062536bbff70
BLAKE2b-256 feb0029531c277c212fe353cda0d62f5b55acc511dd74eae8288d530c93a716e

See more details on using hashes here.

File details

Details for the file dotenv_diff-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: dotenv_diff-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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}

File hashes

Hashes for dotenv_diff-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 634a7c8e0450f2fe86cd652723b3c2163798b22c9386715c38b920bf86fe2b25
MD5 3f615d48b813fa78fb9827c022b05514
BLAKE2b-256 ed991068e18b694c6db03ee8ff0de6e9846ad411032ec5d93030e65eb3b62613

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