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 at two Git revisions. Explore Markdown, JSON, and offline HTML reports; this site publishes the latest successful main-branch overview.
Optional Model Support
Analysis and comparison need no LLM. Refactoring defaults to heuristics or templates; a configured model enables optional rewrites. Cloud models receive source code—local preference is not an enforced local-only mode.
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 and rollback attempts are safeguards, not guarantees; test discovery, recovery, and behavior preservation have known limits.
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. Complexity findings are informational; incomplete 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.