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 this exists

I kept hitting the same issue while working fast, especially with coding agents: the code worked, but the repo did not. .env.example drifted, CI expected different variables, Docker had its own set, and onboarding broke.

This tool catches that drift early. It is useful in any repo, and especially handy in fast-moving AI-assisted repos where config drift shows up early.

What it checks

  • env vars used in code but missing from .env.example
  • vars referenced in Docker or GitHub Actions but undocumented locally
  • stale keys left behind in .env.example

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

Agent usage

This repository includes AGENTS.md and Copilot instructions for use with coding agents.

The project is intentionally small, deterministic, and easy to audit.

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

Limitations

  • It never loads or prints env values, only names and locations.
  • It is heuristic-based, using regex and line-based scanning instead of full parsing.
  • It may miss dynamically constructed env names.
  • It does not validate values or types.
  • 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, 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.3.tar.gz (9.9 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.3-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dotenvdrift-0.1.3.tar.gz
  • Upload date:
  • Size: 9.9 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.3.tar.gz
Algorithm Hash digest
SHA256 177f35dbc8e1e7bff8764ab4d1898fdf2094c578509f346b6bf4f0c19e22f235
MD5 51784fb731195a269226a521f5fc9dea
BLAKE2b-256 b8f2e368c43351bd60126bb3097ca5dded0e2e28dace8eba14206d99cf4899ad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dotenvdrift-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 8.3 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b5c6cba0afc59460e256703463a312c398b18263375a3fa67ef85e090da95cf8
MD5 2f5ff59d6592ae771d2af86dca7a746a
BLAKE2b-256 3bc04cbd7d0c06ad34fd8e53af452c1b6d09f86251f3630576aa84bf8c330165

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