PragyaLint is a static dead-code analyzer for Python. This guide walks you through your first scan, how to read the output, and how to make it part of your workflow.
After installing, run PragyaLint from your project root:
$ pragyalint
./src/orphan.py
✘ [HIGH ] module 'orphan' is not reachable from any entry point
./src/utils/helper.py
⚠ [MEDIUM] export 'legacy_fn' of module 'utils.helper' is never imported
./src/app.py
✘ [HIGH ] import 'os' is never used
3 findings in 12 files (11 reachable).
2 high | 1 medium
By default PragyaLint detects entry points automatically (files like
main.py, app.py, __main__.py, and
setup.py), builds a module graph from them, and marks anything
unreachable as a candidate for removal.
Each finding has a rule, a confidence, and a location.
| Rule | Default confidence | Meaning |
|---|---|---|
unused_file | high | Module not reachable from any entry point |
unused_import | high | Import never used in its module |
unused_export | medium | Public name never imported elsewhere |
unused_local | medium | Function/class/variable defined but never used |
cycle | low | Circular import cycle |
__all__
re-exports). Review them before acting.
Analysis only reports. To actually remove code, use
--fix — always with a dry-run first:
# Preview what would change (does NOT modify files)
pragyalint --fix --dry-run
# Remove dead code
pragyalint --fix
# Include lower-confidence removals too
pragyalint --fix exports --confidence medium+
Read the Fixes page for the full details and safety model.
Use --fail-on to gate your pipeline on dead-code findings, and
JSON or SARIF output to feed other tools:
pragyalint --fail-on high # exits non-zero on high findings
pragyalint --json # machine-readable report
pragyalint --sarif > pragyalint.sarif # GitHub Code Scanning
pragyalint.toml and pyproject.toml.