Proactive refactoring audit for Python repositories.
Project description
Cremona
Cremona turns Python structural-debt signals into an agent-ready refactoring queue and CI regression gate.
It combines ruff C901, lizard, complexipy, vulture, git history, and optional coverage data so you can answer two questions quickly:
- Is structural debt regressing?
- Which files should be refactored next?
60-second quickstart
Run Cremona against a repository without cloning this repo first:
uvx cremona scan /path/to/repo
Keep it installed for repeated use:
pipx install cremona
cremona scan /path/to/repo
By default, Cremona writes these files in the target repository:
output/refactor-audit/report.mdoutput/refactor-audit/report.jsonoutput/refactor-audit/raw/
Start with report.md. It gives you the repo verdict, the file queue, the top hotspots, and the baseline diff in one pass.
Why Cremona
rufftells you where control flow is growing.lizardandcomplexipyshow which functions are hard to change safely.- Git history shows churn and coupling.
- Coverage data shows where change risk is still high.
- Cremona turns those signals into a refactoring queue instead of a pile of unrelated warnings.
Example verdict and queue
This excerpt comes from Cremona's current self-host report.
- Repo verdict:
stable - Routing pressure:
watch_only - Signal health:
full
| Priority | Score | File | Why it stays visible |
|---|---|---|---|
watch |
33 | src/cremona/core/engine.py |
5 commits, 2444 churn, branch coverage 0.82, coupled with tests/test_cremona_scan.py |
watch |
32 | tests/test_cremona_scan.py |
8 commits, 4168 churn, branch coverage 1.00, coupled with src/cremona/core/engine.py |
watch |
27 | src/cremona/scan.py |
2 commits, 5870 churn, line coverage 1.00, coupled with src/cremona/core/__init__.py |
On a repository with active structural pressure, the same queue will surface investigate_soon and investigate_now rows.
Codex and agent workflow
Use the bundled Codex skill when you want an agent to turn the report into a concrete refactor plan.
- Run
uvx cremona scan /path/to/repo. - Open
report.mdand choose the top file fromagent_routing_queue. - Ask Codex to make the smallest safe refactor.
- Run Cremona again.
- Update the baseline only when debt actually dropped or the schema changed.
When you start Codex inside this repository, it discovers the repo-scoped skill automatically from .agents/skills/cremona-proactive-refactor-audit.
To install the same skill into your personal Codex setup:
$skill-installer install the skill from https://github.com/NeapolitanIcecream/cremona/tree/main/.agents/skills/cremona-proactive-refactor-audit
Read docs/codex-skill.md for the full workflow.
CI gate
Bootstrap the first baseline:
uvx cremona scan /path/to/repo --update-baseline
git add quality/refactor-baseline.json
Use coverage in the gate so routing can score change risk:
uv run coverage run -m pytest -q
uv run coverage json -o coverage.json
uvx cremona scan --baseline quality/refactor-baseline.json --coverage-json coverage.json --fail-on-regression
Read docs/ci-gate.md for a copyable GitHub Actions recipe.
Install from source for contributors
Use the source install when you are changing Cremona itself.
git clone https://github.com/NeapolitanIcecream/cremona.git
cd cremona
uv sync --group dev
uv run cremona --help
Read next
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cremona-0.1.0.tar.gz.
File metadata
- Download URL: cremona-0.1.0.tar.gz
- Upload date:
- Size: 36.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e1bceed27c6db4f49225558625615e16e647b3a75a010d0d1418956f7d9a795
|
|
| MD5 |
624657bf9f03ad38d8273307ea96b074
|
|
| BLAKE2b-256 |
ca5fe856a97d7903634290259324134ca60d4bf3b609cb854bea0afe17b926a2
|
File details
Details for the file cremona-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cremona-0.1.0-py3-none-any.whl
- Upload date:
- Size: 40.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e2865a3a4f425509c347e05c43cc47048f06087648d19e69e079f6d85c2181f
|
|
| MD5 |
e7c42c985dfa4c894665861b3766640b
|
|
| BLAKE2b-256 |
1feb83d5791961467aa0423ed8f56bc1f4a3037563bdca003296aa7acb8ebbeb
|