checkup-cruft
Cruft template metrics plugin for checkup.
Tracks how well a project stays in sync with its cruft (cookiecutter) template.
Installation
pip install checkup-cruft
Requirements
- Python >= 3.12
- checkup
- Git installed on the system
- Network access to the template repository (only for the drift metrics)
Usage
from checkup import CheckHub
from checkup_cruft import (
CruftProvider,
CruftLinkedMetric,
CruftDaysSinceUpdateMetric,
CruftConflictCountMetric,
CruftUpToDateMetric,
)
results = (
CheckHub()
.with_metrics([
CruftLinkedMetric(),
CruftDaysSinceUpdateMetric(),
CruftConflictCountMetric(),
CruftUpToDateMetric(),
])
.with_providers([[
CruftProvider(project_path="./my_product", fetch_template=True),
]])
.measure()
)
Provider
CruftProvider
Reads .cruft.json from the project. With fetch_template=True it also clones the template repository
to compare the pinned commit against the template head; leave it off (the default) for a fully local,
offline run, in which case the drift metrics report None.
Available Metrics
Local Metrics
CruftLinkedMetric
Whether a .cruft.json template link is present.
CruftDaysSinceUpdateMetric
Days since .cruft.json last changed in git.
CruftConflictCountMetric
Number of *.rej files left by a failed cruft update.
Template Drift Metrics
These require the provider to run with fetch_template=True.
CruftUpToDateMetric
Whether the pinned commit matches the latest template commit.
CruftCommitsBehindMetric
Number of template commits between the pinned commit and the head.
CruftDaysBehindTemplateMetric
Days between the pinned commit and the template head.
Creating Custom Metrics
Extend CruftMetric to read the cruft context directly:
from checkup_cruft import CruftMetric
class TemplateUrlMetric(CruftMetric):
name = "cruft_template_url"
description = "Configured cruft template URL"
def calculate(self, context, measurements):
cruft = self.get_context(context)
return self.measure(value=cruft.get("template"))
Metadata
Release files for checkup-cruft 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| checkup_cruft-0.2.0.tar.gz | 5.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| checkup_cruft-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.2 kB
Release files / checkup_cruft-0.2.0.tar.gz
| Download URL | checkup_cruft-0.2.0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ecafc3ddf3151860c6cb09b529a2d68e4784f50f6015f02445d1cc35da458d8
|
|
BLAKE2b-256 checksum How to use checksums |
bc18803695625384c08577fb5e363bbeb3fd807ccfd6f8d500c014d9453d3965
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / checkup_cruft-0.2.0-py3-none-any.whl
| Download URL | checkup_cruft-0.2.0-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa0ea56865f365aa92b3345b27d75e803fc6a9cbf859edbf555057c96a1de206
|
|
BLAKE2b-256 checksum How to use checksums |
2d6d275679bbc79c0f1756a1422d56c4ec127914c46c3b1602edc5bf37c08b71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|