dotenv-linter
Linting dotenv files like a charm!
What it is and what it does
dotenv-linter is a command-line tool that checks `.env` files for consistency and adherence to best practices. It detects problems like leading whitespace, improper spacing around equals signs, unnecessary quotes, duplicate keys, and non-uppercase variable names—issues that are easy to miss in simple text files but can cause subtle bugs or configuration errors.
The tool is designed to integrate into existing workflows, including as a pre-commit hook. It depends on a small set of libraries: attrs for data structures, click for CLI scaffolding, lark for parsing, and typing_extensions for type hints. The project is actively maintained and supports modern Python versions from 3.10 onward.
Use it for:
- Enforce naming conventions (UPPER_CASE) and formatting rules across team `.env` files in a shared project.
- Catch duplicate environment variable definitions before they cause configuration conflicts in production.
- Validate `.env.template` files alongside actual `.env` files to ensure consistency between template and implementation.
- Integrate into CI/CD pipelines via pre-commit hooks to prevent malformed `.env` files from being committed.
- Audit existing `.env` files in legacy projects to identify and fix accumulated formatting and consistency issues.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Lints `.env` files for consistency violations and best practices, catching issues like duplicate keys, improper casing, spacing errors, and quote misuse.
Yes. dotenv-linter is actively maintained, has no known vulnerabilities, low install friction, and solves a real problem—catching `.env` file mistakes that are easy to overlook. It's lightweight, integrates well with pre-commit workflows, and is suitable for teams that want to enforce consistency in environment configuration files.
Install
dotenv-linter on PyPI
pip
pip install dotenv-linteruv
uv add dotenv-linterpoetry
poetry add dotenv-linterInstalling dotenv-linter
Before you install
Low install friction with a pure Python wheel and five lightweight dependencies (attrs, click, click_default_group, lark, typing_extensions). Active maintenance with a release 14 days ago and recent commits.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions.
Quickstart
pip install dotenv-linter
dotenv-linter .env .env.template
Requires Python 3.10 or later (supports up to 3.14).
Verify before relying
- Whether the linter's rule set covers all common `.env` anti-patterns beyond the documented examples.
- Performance characteristics when linting very large `.env` files or many files in a single run.
- How pre-commit hook integration handles exit codes and failure reporting in CI/CD pipelines.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — attrs, click, click_default_group, lark, typing_extensions |
| Maintenance | actively maintained — 14 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 172,774/month — #10,326 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: dotenv_linter-0.9.0-py3-none-any.whl
Keywords: dotenv, linter, wemake.services, code quality
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
dump-envGenerates .env files by merging an…
permissive · top 15,000 on PyPI
gitlint-coreLints Git commit messages against configurable…
permissive · top 5,000 on PyPI
yamllintyamllint checks YAML files for syntax errors,…
copyleft · top 1,000 on PyPI
rumdlA Rust-based Markdown linter and formatter that…
permissive · top 5,000 on PyPI
tclinttclint is a CLI linter, formatter, and language…
permissive · top 15,000 on PyPI
ickIck is a polyglot tool for bundling best…
permissive · top 15,000 on PyPI
wemake-python-styleguideA flake8 plugin that enforces strict,…
permissive · top 15,000 on PyPI
dotenvLoads environment variables from a .env file…
unclear · top 5,000 on PyPI
python-dotenvReads key-value pairs from a .env file and sets…
permissive · top 100 on PyPI
hadolint-coatlProvides a pip-installable hadolint binary…
permissive · top 15,000 on PyPI