Skip to main content

Git metrics for checkup

Project description

checkup-git

Git repository metrics plugin for checkup.

Installation

pip install checkup-git

Requirements

  • Python >= 3.12
  • checkup
  • Git installed on the system

Usage

from checkup import CheckHub
from checkup_git import (
    GitProvider,
    GitDaysSinceLastUpdateMetric,
    GitTrackedFileCountMetric,
)

results = (
    CheckHub()
    .with_metrics([
        GitDaysSinceLastUpdateMetric,
        GitTrackedFileCountMetric,
    ])
    .with_providers([
        GitProvider("./my_repo"),
    ])
    .measure()
)

Provider

GitProvider

Extracts metadata from a git repository, including the last commit date and list of tracked files.

Available Metrics

GitDaysSinceLastUpdateMetric

Returns the number of days since the last git commit.

GitTrackedFileCountMetric

Returns the number of git tracked files, optionally filtered by a glob pattern. Configure by subclassing:

from checkup_git import GitTrackedFileCountMetric

class PythonTestFileCountMetric(GitTrackedFileCountMetric):
    name = "python_test_file_count"
    description = "Number of Python test files"
    pattern = "tests/test_*.py"

Creating Custom Metrics

Extend GitMetric to create custom git-based metrics:

from checkup_git import GitMetric

class MyCustomGitMetric(GitMetric):
    name = "my_custom_metric"
    description = "My custom git metric"

    def calculate(self, context, metrics):
        git_context = self.get_context(context)
        tracked_files = git_context.get("git_tracked_files", [])
        self.value = len([f for f in tracked_files if f.endswith(".py")])

Project details


Download files

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

Source Distribution

checkup_git-0.2.2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

checkup_git-0.2.2-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file checkup_git-0.2.2.tar.gz.

File metadata

  • Download URL: checkup_git-0.2.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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_git-0.2.2.tar.gz
Algorithm Hash digest
SHA256 dd630bcda516aa13242fe69f02e4fca695377d65d0e1ea1ea6e01fe12afbba12
MD5 032d5832bdeea01bf45a19ecd463c3b7
BLAKE2b-256 1a4d627711c878013a939b8a2cede67622fe310f8eba175e653d362422f690af

See more details on using hashes here.

File details

Details for the file checkup_git-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: checkup_git-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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_git-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0521e8cf86a493f007fe4868426c4fcc722249514003b7348a94032fd38992f3
MD5 f821f6b9adaa71a664a0ab2435ba628f
BLAKE2b-256 d26766a64ce1c8b68dd832b6541b4db18b6bd531943068db0769f44fb45051c0

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 Pingdom Monitoring Sentry Error logging StatusPage Status page