Keep environment variable names in sync across repos.
dotenv-keep compares your .env.example against the variables referenced
in your code and reports names that are missing, unused, or drifted. It
catches the silent misconfiguration that only shows up in production.
pip install git+https://github.com/libnudget/dotenv-keepdotenv-keep --example .env.example --path srcFor each referenced variable that is missing from the example file, the
command prints a missing: line and exits with a non-zero status. It
also reports unused: names that appear in the example but are never
referenced in code.
- Missing: referenced in code as
os.environ["NAME"],os.getenv("NAME"), orprocess.env.NAME, but absent from the example file. - Unused: present in the example file but never referenced in code.
fromdotenv_keepimportload, find_references, compareexample=load(".env.example")
refs=find_references(source_code_text)
missing, unused=compare(example, refs)pip install -e ".[dev]"
pytestMIT