envdoctor (Python)
Native Python port of envdoctor — a local-first consistency checker for environment variables, distributed on PyPI so Python projects can use it without Node.
Install
pip install arun-envdoctor
The PyPI distribution is named
arun-envdoctor(PyPI blocksenvdoctoras too similar to an existing project), but the installed command and the importable package are both stillenvdoctor.
Quick start
envdoctor scan --dir . # audit; exit 1 on errors
envdoctor scan --strict # treat warnings as errors too
envdoctor scan --json # emit findings as a JSON array (no values)
What it detects
Reconciles the environment variables used in your Python source
(os.getenv("X"), os.environ.get("X"), os.environ["X"], and the
from os import environ forms) against those defined in your .env files,
then reports:
| Rule | Severity | Meaning |
|---|---|---|
undefined-in-source |
error | Used in code but not defined in any .env file |
duplicates |
error | The same key is defined 2+ times within a single .env file |
public-prefix |
error | A secret-looking variable is exposed to client bundles via a public prefix (NEXT_PUBLIC_, VITE_, REACT_APP_, EXPO_PUBLIC_, GATSBY_, NUXT_PUBLIC_, VUE_APP_, PUBLIC_) |
type-mismatch |
error | A variable's value has incompatible inferred types across environments (e.g. PORT=3000 vs PORT=abc) |
unused |
warning | Defined in .env but never referenced in source |
environment-diff |
warning | Defined in some environment files but missing from others |
weak-secret |
warning | A secret-looking variable has a weak, empty, or placeholder value |
typo |
warning | A used-but-undefined name closely matches a defined one (likely a typo) |
Comments and docstrings are stripped before scanning, so documented examples
don't cause false positives. Nothing is uploaded and variable values are
never printed — they are used only for detection and never appear in any output
(human or --json). envdoctor scan exits 1 when there are errors (or with
--strict, warnings), making it CI-friendly. Pass --json to emit a JSON array
of findings (each with rule, severity, name, message, file, line)
for machine consumption.
Library use
from pathlib import Path
from envdoctor import scan
result = scan(Path("."))
for finding in result.errors:
print(finding.name, finding.message)
Development
pip install -e ".[dev]" pytest
pytest
Other languages
envdoctor ships as a standalone native port for each ecosystem:
- Node (reference) · Go · Ruby · PHP · Java · Perl
- 📖 Docs: arun-skg.github.io/envdoctor
- Main repository: github.com/arun-skg/envdoctor
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file arun_envdoctor-0.1.1.tar.gz.
File metadata
- Download URL: arun_envdoctor-0.1.1.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9c7f37c54da2c3d251a882c2bea87cf53e3040588e34c1996592000affafe36
|
|
| MD5 |
9b47b7658e7fccf25c026ceb8d11f7f2
|
|
| BLAKE2b-256 |
a2eaa7625b6d18bfd8c0b0e4e80aa95fe3efe8b6cfaffb8e9abc2cd06dc7670f
|
Provenance
The following attestation bundles were made for arun_envdoctor-0.1.1.tar.gz:
Publisher:
python-release.yml on arun-skg/envdoctor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arun_envdoctor-0.1.1.tar.gz -
Subject digest:
b9c7f37c54da2c3d251a882c2bea87cf53e3040588e34c1996592000affafe36 - Sigstore transparency entry: 2567908175
- Sigstore integration time:
-
Permalink:
arun-skg/envdoctor@a17463b0f4ac85c900aaef5571eff9169e567935 -
Branch / Tag:
refs/tags/python-v0.1.1 - Owner: https://github.com/arun-skg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@a17463b0f4ac85c900aaef5571eff9169e567935 -
Trigger Event:
push
-
Statement type:
File details
Details for the file arun_envdoctor-0.1.1-py3-none-any.whl.
File metadata
- Download URL: arun_envdoctor-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
109253be9872016f7ef19301b4642170e0bc5a0d071e6a64c92111421bff9668
|
|
| MD5 |
5219978a6f782662dc3f0b97b8342dc4
|
|
| BLAKE2b-256 |
b439538c4d6b8f96f5057666ae38218d16d7fa14d15525086b7420119d688fde
|
Provenance
The following attestation bundles were made for arun_envdoctor-0.1.1-py3-none-any.whl:
Publisher:
python-release.yml on arun-skg/envdoctor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arun_envdoctor-0.1.1-py3-none-any.whl -
Subject digest:
109253be9872016f7ef19301b4642170e0bc5a0d071e6a64c92111421bff9668 - Sigstore transparency entry: 2567908179
- Sigstore integration time:
-
Permalink:
arun-skg/envdoctor@a17463b0f4ac85c900aaef5571eff9169e567935 -
Branch / Tag:
refs/tags/python-v0.1.1 - Owner: https://github.com/arun-skg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@a17463b0f4ac85c900aaef5571eff9169e567935 -
Trigger Event:
push
-
Statement type: