skillfed

dotenv-linter

Linting dotenv files like a charm!

dotenv-linter v0.9.0 172.8K downloads/30d#10,326 on PyPI305
Permissive license MIT Active released

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-linter

uv

uv add dotenv-linter

poetry

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

Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Quality Assurance

Tags

env file linterdotenv validationenvironment file checkerdotenv consistency rulesenv file qualitylinting dotenv filesenv variable best practices
lintingenv-filesconfiguration

More Python Modules packages