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, measurements):
        git_context = self.get_context(context)
        tracked_files = git_context.get("git_tracked_files", [])
        python_files = [f for f in tracked_files if f.endswith(".py")]
        return self.measure(value=len(python_files))

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.4.0.tar.gz (4.3 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.4.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: checkup_git-0.4.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","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.4.0.tar.gz
Algorithm Hash digest
SHA256 417b642736c974ccb3bfbac159e427577453afb656f0473e11ea2649a673e490
MD5 30ad5ac024b1eeef45133ea2ffe96626
BLAKE2b-256 09a947c10b16ad3ce12edb80796ac68ebaf74dbcad227c91f4e19f9ba9e56aae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: checkup_git-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 05865c0c6f1469128c84cd35103b020c368d5b742368a1b4b32faf948adabe7a
MD5 ebb3139a8be05044c0fce89ae6991021
BLAKE2b-256 e4ed39fb101f0a5fad9e127b72c8a9b652bb281178c8eca1e76bd34bc3262ed2

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