Skip to main content

Repo-local CLI for env drift across code, .env.example, Docker, and GitHub Actions.

Project description

dotenvdrift logo

dotenvdrift

PyPI version Python 3.11+ MIT License

Small repo-local CLI that catches env drift between code, .env.example, Docker / docker-compose, and GitHub Actions.

Why

I built this after repeatedly hitting env drift while moving quickly, including with coding agents: the code was done, but .env.example, Docker, docker-compose, and GitHub Actions had drifted apart.

That failure mode is not specific to AI-assisted repos. It breaks onboarding, local runs, and CI in any repo. This tool is just especially handy in fast-moving codebases where config drift shows up early.

What It Checks

  • missing: used in code but absent from .env.example
  • undocumented: referenced in Docker or GitHub Actions but not documented locally
  • unused: still listed in .env.example but no longer referenced

It scans Python and JS/TS code, .env.example, Docker / docker-compose files, and GitHub Actions workflows with simple deterministic patterns.

Install

Requires Python 3.11+.

uv sync

Fallback:

python -m pip install .

Usage

uv run dotenvdrift .
uv run dotenvdrift examples/broken-repo
uv run dotenvdrift . --json
uv run dotenvdrift . --strict
uv run dotenvdrift . --only missing

Sample output:

missing
  NODE_ENV             web/client.ts:2
  OPENAI_API_KEY       app/settings.py:4
  VITE_API_BASE_URL    web/client.ts:1

undocumented
  DATABASE_URL         docker-compose.yml:5
  PYPI_TOKEN           .github/workflows/release.yml:11
  RELEASE_REGION       .github/workflows/release.yml:7

unused
  DEBUG_SQL            .env.example:2

✗ 7 drift issues

Limits

  • It never loads or prints env values, only names and locations.
  • It uses line-based regex scans, not ASTs or YAML parsers.
  • It stays generic. AWS, GCP, Azure, and crypto repos work when they use env vars, but there is no provider-specific logic.
  • It does not sync secrets, manage vaults, validate schemas, or auto-fix anything.

Development

uv run python -m unittest discover -s tests -p 'test_*.py' -v
uv build

Exit Codes

  • 0: no issues, or issues found without --strict
  • 1: issues found with --strict
  • 2: invalid repository path

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

dotenvdrift-0.1.2.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

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

dotenvdrift-0.1.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file dotenvdrift-0.1.2.tar.gz.

File metadata

  • Download URL: dotenvdrift-0.1.2.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for dotenvdrift-0.1.2.tar.gz
Algorithm Hash digest
SHA256 aab460adecff251f8afbdec1b2cff481b5550634533bc7b693d6ec9d04557bcc
MD5 2d2021bc50f0f765120da75acc24005c
BLAKE2b-256 4bc8464fbd577e7353e1347207232681692218c510214257e0a9d31adbfd2cc9

See more details on using hashes here.

File details

Details for the file dotenvdrift-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: dotenvdrift-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for dotenvdrift-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d9faf25b9472f5788fcf75cf20e03ba9e05b8a404cf7af743698631e9e3c6053
MD5 e388f1b4fcc1beb4d43f178465b5b05c
BLAKE2b-256 18410d031d32e5d10bfcc2bda0dd3cd960783b8836d7d855bb241e92d39eb290

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