--- id: dotenv-linter version: "0.9.0" license: MIT license_treatment: permissive maintenance: active --- # dotenv-linter — Linting dotenv files like a charm! License: permissive · Maintenance: active · Downloads: 172.8K/mo ## 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 above — 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 pip install dotenv-linter uv add dotenv-linter poetry add dotenv-linter ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 172.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags env file linter, dotenv validation, environment file checker, dotenv consistency rules, env file quality, linting dotenv files, env variable best practices, linting, env-files, configuration [View on SkillFed](https://skillfed.io/packages/dotenv-linter) · [View on PyPI](https://pypi.org/project/dotenv-linter/)