The Shrinking Charm
reducio
Understand Complexity. Review Changes.
Analyze Python code, compare committed revisions, and explore interactive reports. Refactoring proposals help you plan improvements; automatic edits remain experimental.
Magical Abilities
Practical tools for Python codebases
Duplication Detection
Find similar functions across Python files with the optional embeddings extra. Generate shared-utility suggestions; originals and call sites are not rewritten.
Experimental Idiom Proposals
Propose comprehensions, None comparisons, truthiness, and membership rewrites. Start with dry-run: current rules can change behavior and require code review.
Pattern Suggestions
Generate advisory Factory, Strategy, Observer, and Singleton modules. Default templates are not automatically integrated into your existing code.
Complexity Scrying
Measure functions with syntax-aware cyclomatic complexity and a custom nesting-weighted cognitive score. Hotspots use the cyclomatic threshold; lower scores do not prove correctness.
Change-Impact Reports
Compare whole functions in changed files, then explore complexity trends and persistent hotspots across Git history. Markdown, JSON, and offline HTML reports are available; this site publishes main-branch history and the latest overview.
Optional Model Support
Analysis and comparison need no LLM. Refactoring defaults to heuristics or templates; a configured model enables optional rewrites. Model planning sends source code to your explicitly configured compatible API, even during dry runs. There is no automatic provider switching.
The Ritual
Measure first. Inspect proposals. Validate independently.
Scan
Analyze Python functions and symbols, inspect hotspots, and compare committed changes. Dependency mapping and duplicate search are not part of the analyze command.
Plan
Use dry-run to save a proposal without changing source files. Review unified diffs, diagnostics, and the planning method in terminal output, Markdown reports, or saved sessions.
Review & Validate
Apply only after reviewing the proposal, preferably in a disposable clean checkout. Syntax checks, scoped file backups and opt-in target tests are safeguards, not guarantees. Unknown heuristic cases are skipped; model proposals still require behavior review.
Complexity Checks in GitHub CI
See what changed, directly from your workflow run. No model or API key needed.
Review Pull Requests
Compare the PR head with its merge base. Measure whole functions in changed Python files and distinguish improvements, regressions, additions, and removals.
Keep a Main-Branch Overview
Scan the current codebase after a push to main. Read the Markdown job summary and download an offline interactive HTML dashboard plus JSON measurements.
Follow the Run
Progress messages show exploration, analysis, and report generation in job logs. PR warnings and regression gates are opt-in; main-only history charts reveal longer-term changes. Incomplete current analysis or report errors fail the command.
Acquire the Wand
Begin your journey into code alchemy
Witness the Magic
Example commands from a source checkout—not a benchmark or a promise of savings
$ reducio analyze reducio/ --report --format all
# Measure current Python files; print report paths.
$ reducio compare reducio/ --base HEAD~1 --head HEAD --report --format all
# Compare committed changes, ignoring working-tree edits.
$ reducio idiomatize reducio/ --dry-run
# Save an experimental proposal without changing source files.
# HTML dashboards need the reports extra.
# Use . or your source directory when analyzing another project.