Understand your Python code before it ships.
Paste any Python code. We compute complexity and structural risks using AST-based analysis, then AI explains findings and suggests refactors.
{
"risk_level": "High",
"cyclomatic_complexity": 24,
"nesting_depth": 6,
"ai_explanation": "The function handles order validation with robust error handling. Decomposing nested logic into helpers would improve readability."
}
How it works
Three steps. Zero setup.
Paste your code
Drop any Python code into the editor. No signup, no config files, no CLI.
Analyze structure & complexity
We parse your code using Python’s AST to compute cyclomatic complexity, nesting depth, and per-function metrics.
Understand risks & refactor
AI interprets the analysis from Step 02 to explain risk factors and suggest safe, behavior-preserving refactors.
Capabilities
Built for real-world Python.
Not a toy linter. PyPURGE statically analyzes nested control flow, exception handling patterns, and boolean complexity, the things that actually make code hard to maintain.
Cyclomatic Complexity
Counts every decision path your tests need to cover
Nesting Depth Analysis
Detects deeply nested logic that increases cognitive load
Per-Function Breakdown
Metrics for each function, not just file-level averages
AI-Powered Explanations
Gemini explains the analysis results in clear, plain-English terms
Refactoring Suggestions
Targeted, behavior-preserving refactoring suggestions per function, with optional rewritten code
Try it now — no signup required.
Paste code, click analyze, get results. That simple.