Skip to main content

envguard

Validate .env files against a schema, with secret-strength heuristics, drift detection between environments, and a CI-friendly CLI. Zero runtime dependencies — pure Python 3.8+.

Install

pip install dotenv-lint
# dev tools
pip install -e .[dev]

The PyPI distribution is named dotenv-lint because envguard and similar variants were taken / blocked by PyPI's name-similarity filter. The import name (envguard) and CLI command (envguard) are unchanged.

Quick start

Declare a schema in .env.schema.toml:

[DATABASE_URL]
type     = "url"
required = true

[PORT]
type     = "int"
required = true
range    = [1024, 65535]

[JWT_SECRET]
type        = "str"
required    = true
secret      = true
min_length  = 32

Validate from the CLI:

envguard validate .env --schema .env.schema.toml
envguard validate .env --schema .env.schema.toml --format json
envguard validate .env --schema .env.schema.toml --strict --exit-on-fail
envguard secrets .env
envguard compare .env.development .env.production
envguard scaffold .env > .env.schema.toml

Or from Python:

from envguard import validate

result = validate(env_file=".env", schema=".env.schema.toml")
if not result.is_valid:
    for err in result.errors:
        print(err.code, err.message)
    raise SystemExit(1)

Exit codes

Code Meaning
0 All checks passed
1 One or more errors found
2 One or more warnings (no errors)
3 File not found or unreadable

Schema format

TOML is the primary format (.env.schema.toml); JSON is also accepted (.env.schema.json). The built-in TOML reader is a constrained subset sufficient for the schema layout — top-level tables containing scalars, booleans, and single-line arrays. If you need richer TOML syntax, switch to JSON.

Supported types: str, int, float, bool, url, email, list, json, path, uuid. Constraints per key: required, default, description, secret, choices, range, schemes (URLs), min_length, max_length, must_exist (paths).

Secret strength

When secret = true, EnvGuard runs five heuristics: minimum-length, Shannon-entropy, blocklist, sequential/repeated/keyboard-walk patterns, and all-same-case. Findings come back as WEAK_SECRET / PLAINTEXT_SECRET_PATTERN warnings with HIGH/MEDIUM/LOW severity.

Pre-commit hook

# .pre-commit-config.yaml
repos:
  - repo: https://github.com/FaraiMacheka/envguard
    rev: v1.0.0
    hooks:
      - id: envguard
        args: [".env", "--schema", ".env.schema.toml", "--exit-on-fail"]

The hook calls envguard validate with the args you supply, so point it at whichever .env and schema your repo uses.

Security

For vulnerability reports, see SECURITY.md.

License

MIT.

Metadata

Release files for dotenv-lint 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dotenv-lint 1.0.0
File Size Uploaded Provenance Actions
dotenv_lint-1.0.0.tar.gz 35.4 kB With provenance Details for dotenv_lint-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dotenv-lint 1.0.0
File Interpreter ABI Platform Actions
dotenv_lint-1.0.0-py3-none-any.whl Python 3 none any Details for dotenv_lint-1.0.0-py3-none-any.whl

Total release size: 56.1 kB

Release files / dotenv_lint-1.0.0.tar.gz

Download URL dotenv_lint-1.0.0.tar.gz
Size 35.4 kB
Tags Source
SHA-256 checksum
How to use checksums
eb39df227d4159101a0a01e96ec579d339ec2ffd3326b6dedfc2404640bfbf00
BLAKE2b-256 checksum
How to use checksums
506902abd7771cb17e9014185ff2667ddfa67833716da6780c7238a8eca881fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 11, 2026.

Transparency log

Release files / dotenv_lint-1.0.0-py3-none-any.whl

Download URL dotenv_lint-1.0.0-py3-none-any.whl
Size 20.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab1b9d0d304b11806ef7572c116e979d3c0c2c215280966973f3a104a3d4ded5
BLAKE2b-256 checksum
How to use checksums
d34efc60c79f9c74dc2db59d9df32026213b0dd9468b5b29a430dcc8e77ac4f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 11, 2026.

Transparency log

Security for dotenv-lint 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dotenv_lint-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page