oo-ratchet
The Punt Labs quality ratchets for Python repos, extracted from the copies that
lived in tools/ of vox, quarry, lux and z-spec. One installable package, one
CLI, three gates:
| Gate | Command | Rule |
|---|---|---|
| OO metrics | oo-ratchet oo <src> --check |
must-improve: no metric regresses on a touched file and at least one improves |
| Coupling/cohesion | oo-ratchet coupling <src> --check |
regression-only |
| Suppressions | oo-ratchet suppressions <src> --check |
regression-only on the total noqa / type: ignore / pylint: disable / pyright: ignore / per-file-ignores count |
Every gate compares against the baseline committed at the merge base, fails
closed when the base or baseline cannot be read, and only loosens through
audited operations (--relax, --rebaseline-files, --rebaseline). The
policy it enforces is
python-oo-adoption.md
in punt-kit; the formal model is docs/ratchet.tex.
Install
uv add --dev punt-oo-ratchet
Requires Python 3.13+. No runtime dependencies.
Use
check-oo:
uv run oo-ratchet oo src/pkg/ --check $(OO_BASE)
update-oo:
uv run oo-ratchet oo src/pkg/ --update $(OO_BASE)
check-coupling:
uv run oo-ratchet coupling src/pkg/ --check $(COUPLING_BASE)
check-suppressions:
uv run oo-ratchet suppressions src/pkg/ --check $(SUPPRESSION_BASE)
On PRs, pass the merge-base SHA: --base-ref "$(git merge-base origin/main HEAD)" --require-base (an explicit ref is compared as given, so origin/main itself
would pull in later main changes). On the post-merge push: [main] run, pass
--base-ref HEAD~1 --require-base --tripwire to every gate so the one-time
adoption merge bootstrap-passes. oo-ratchet <gate> --help lists each gate's
flags. Baseline and audit files (.oo-baseline.json, .oo-audit.jsonl,
.oo-coupling-baseline.json, ...) keep the same names as the embedded copies,
so a repo switches over without rebaselining.
Configure
Optional per-repository settings live in pyproject.toml; with none the strict
defaults apply. Unknown keys, metrics or modes are an error, not ignored.
[tool.oo-ratchet.coupling]
# "dataclass" (default): LCOM skips only @dataclass / __slots__ = () classes
# that store no instance state. "any": skip every class that never writes a
# private self._* attribute (object/super()/type(self).__setattr__ count).
stateless-values = "any"
[tool.oo-ratchet.coupling.caps]
# Exact repository-relative paths; a cap replaces that metric's default target
# for that one file (here a wiring hub whose job is importing many modules).
"src/pkg/facade.py" = { efferent_coupling = 20 }
oo-ratchet coupling <src> --rebaseline-files a.py,b.py --reason "<why>" is the
coupling counterpart of the OO bless: each named file is recorded unless a
metric is both over its cap (configured caps included) and worse than its
baseline; refused files are listed and not written, and the bless is audited
and waives exactly those deltas at the next --check.
oo-ratchet suppressions <src> --rebaseline --reason "<why>" [--source PL-123]
resets the suppression baseline to the current counts. It's the one write that may
raise the total (for example after a package upgrade changes the counter), and it
is audited.
Provenance
Seeded from vox (tools/oo_ratchet, tools/coupling, tools/suppression),
then merged:
- quarry: extraction provenance for new zero-class modules (
diffmodel.py,provenance.py), coupling--tripwire,tokenize-based suppression scan. - lux:
--rebaseline-filesbounded bless with over-cap carry (bless.py), vanished-row cleanup on--update, removed rows recorded in the audit log; in 0.2.0 the broad stateless-value LCOM exemption, exact-path coupling caps (as[tool.oo-ratchet.coupling]config) and coupling--rebaseline-files. - new here: unreadable or non-UTF-8 files become error rows instead of crashing the OO scorer (PL-778).
Develop
uv sync
make check # ruff, mypy, pyright (tests), full pytest suite
Metadata
Release files for punt-oo-ratchet 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| punt_oo_ratchet-0.2.2.tar.gz | 82.5 kB | With provenance | Details for punt_oo_ratchet-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| punt_oo_ratchet-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for punt_oo_ratchet-0.2.2-py3-none-any.whl |
Total release size: 189.2 kB
Release files / punt_oo_ratchet-0.2.2.tar.gz
| Download URL | punt_oo_ratchet-0.2.2.tar.gz |
|---|---|
| Size | 82.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c1de26f25bd64a7bad9c42eb5da8ccd68f25792c22604ce7126bd561544c1711
|
|
BLAKE2b-256 checksum How to use checksums |
761adeffeca3fc85d0d6e76f4e3acf9a59f8e7bc4a7742fe6fc0568d9189301d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logRelease files / punt_oo_ratchet-0.2.2-py3-none-any.whl
| Download URL | punt_oo_ratchet-0.2.2-py3-none-any.whl |
|---|---|
| Size | 106.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a3b85ba32ba3e179991eaf32bac6035de481d70041f1d9e3307b78319a76873a
|
|
BLAKE2b-256 checksum How to use checksums |
dbe5be79910f7932e46e786671f363a2fea8a9c6b960cfbdb134f9a11580c5b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logSecurity for punt-oo-ratchet 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for punt_oo_ratchet-0.2.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.