Getting started

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.

Your first scan

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.

Reading the output

Each finding has a rule, a confidence, and a location.

Rules

RuleDefault confidenceMeaning
unused_filehighModule not reachable from any entry point
unused_importhighImport never used in its module
unused_exportmediumPublic name never imported elsewhere
unused_localmediumFunction/class/variable defined but never used
cyclelowCircular import cycle

Confidence levels

Tip: medium-confidence findings can be false positives if code is used dynamically (e.g. reflection, plugins, or __all__ re-exports). Review them before acting.

Removing dead code

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.

Running in CI

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

Next steps