Skip to main content

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"))

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

checkup_cruft-0.1.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

checkup_cruft-0.1.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file checkup_cruft-0.1.1.tar.gz.

File metadata

  • Download URL: checkup_cruft-0.1.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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}

File hashes

Hashes for checkup_cruft-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3c5e013e4eb11256ced1e9930d1ee90574f49fc3e95d6b5db1bb5a09e1ab948e
MD5 b176967d8e33945b11988e1f9d861ba8
BLAKE2b-256 a361dfcf05a25ebc8fb33320c6682d64f0e6370e8b225dc34ad9bc30b64c4fed

See more details on using hashes here.

File details

Details for the file checkup_cruft-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: checkup_cruft-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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}

File hashes

Hashes for checkup_cruft-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0a421b6dd7e33fee1b7151ba39d133271b8836c6dc5f3b819bda23cfb4cf8a30
MD5 0f7f1716e7a9164c2e360bdd35d1582c
BLAKE2b-256 20feb6d6fd189e37b20bfd56641aca3bd67bf5a0bf995ffe3950a9cd6700021c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page