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.

I

Scan

Analyze Python functions and symbols, inspect hotspots, and compare committed changes. Dependency mapping and duplicate search are not part of the analyze command.

II

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.

III

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

GitHub CI Recommended

Analyze main and compare pull requests. Read Markdown summaries, download interactive dashboards, or publish main-only reports to Pages.

Set up GitHub CI →

PyPI

Requires Python 3.14+. Install the published reducio package and run the reducio command.

Check installation status →

GitHub Releases Executable

PyApp packages a Linux x64 executable with reports and embeddings. First launch downloads Python and dependencies; Git is still needed for revision comparisons.

Publication is gated by verified PyPI installation and executable smoke checks. Available after the first successful release.

Browse releases →

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.