Skip to main content

Compare two .env files and show added, removed, and changed keys

Project description

env-diff

Compare two .env files and see what changed — ignoring order and comments.

Install

# From source
pip install -e .

# Or run directly
python3 env-diff file1.env file2.env

Usage

# Basic comparison
env-diff .env.example .env

# Disable colors (for piping)
env-diff .env.example .env --no-color

# Quiet mode (exit code only, for CI/CD)
env-diff .env.example .env --quiet
echo $?   # 0 = identical, 1 = differences found

Output

  • Red -: Keys only in file1 (removed)
  • Green +: Keys only in file2 (added)
  • Yellow ~: Keys in both files with different values (changed)

Example:

- REDIS_URL  (only in .env.example)
+ DEBUG  (only in .env)
~ DATABASE_URL: postgres://prod/db -> postgres://localhost/db

1 removed, 1 added, 1 changed total

Features

  • Compares by key name, ignores line order
  • Skips # comments and blank lines
  • Handles export KEY=VALUE prefix
  • Strips surrounding quotes from values
  • Color-coded output (disable with --no-color)
  • Exit code 0/1 for CI/CD pipelines
  • Zero dependencies — pure Python 3.11+ stdlib

Running tests

PYTHONPATH=src python3 -m unittest tests.test_env_diff -v

License

MIT

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

shipstack_envdiff-0.1.0.tar.gz (29.9 kB view details)

Uploaded Source

Built Distribution

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

shipstack_envdiff-0.1.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file shipstack_envdiff-0.1.0.tar.gz.

File metadata

  • Download URL: shipstack_envdiff-0.1.0.tar.gz
  • Upload date:
  • Size: 29.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for shipstack_envdiff-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e3cf36d39786c3cf05cf28a8bedc0028ec3ae155f0568504fff1c15048431c2e
MD5 6198299e6881fc233760c9407bcd61b3
BLAKE2b-256 3ac1c3c8d92f6c7382014f1cdfce0acc085996719ec64c2a8e6fa2001985dbbc

See more details on using hashes here.

File details

Details for the file shipstack_envdiff-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for shipstack_envdiff-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f4f5e9add303d918a2dc7d0b883dbe0f75522aade8cb56e1c281354d0415b079
MD5 adce6e56b40d28f54f6881f92ba02314
BLAKE2b-256 a51fef53fc7885c86b85b0f34fdf12fb0d8f093ef8de85f0464cde74e2542bc1

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