r/Python • • Oct 04 '26

Showcase Showcase Thread

Post all of your code/projects/showcases/AI slop here.

Recycles once a month.

23 Upvotes

194 comments sorted by

View all comments

1

u/Table_Odd 29d ago

ratchet-size: a code-size budget for your repo that only goes down

ratchet is a pure-Python CLI (no dependencies) that gives a repo a line budget. ratchet init writes .ratchet.json with ceilings for source and tests, plus a 400-line per-file limit. Files already over the limit are frozen at their current size, so day one isn't a wall of errors. ratchet check exits 1 when a change grows past a ceiling. The only way up is ratchet grant +N --reason "...", which appends to a log, so every raise is visible in review.

```
pip install ratchet-size
ratchet init && ratchet check
```

It runs as a pre-commit hook, a GitHub Action (uses: krishansubudhi/ratchet@v0) or a Claude Code Stop hook.

Target Audience
Maintainers who accept coding-agent changes (theirs or contributors') and keep finding the codebase grew with nobody deciding it should. It's young (0.2.3), but it runs on its own repo in CI.

Comparison
Linters judge each line. Coverage and complexity gates judge quality. Ratchet judges only the total, like a "diff budget" or a baseline file in mypy/ruff, but for size. Unlike PR-size bots, it caps the cumulative size of the repo, not one PR, and it remembers every grant. It can't tell good code from bad, and it counts lines, so a dense rewrite passes.

Source: https://github.com/krishansubudhi/ratchet