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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file checkup_git-0.3.0.tar.gz.
File metadata
- Download URL: checkup_git-0.3.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c165628e36608691a7d3d44f7d44fc5980d1f5314389cf564120116cf3aa475
|
|
| MD5 |
6f5b364614681846a7cf47134351f072
|
|
| BLAKE2b-256 |
a26f892413129ae38e748c1bb399327f8a54c047b3c7d62146ac437731b61a37
|
File details
Details for the file checkup_git-0.3.0-py3-none-any.whl.
File metadata
- Download URL: checkup_git-0.3.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e90de88d6d39707d2a8f8efb63ead3e79ce5ba86e2c56e5244c87fdd39ba5e5
|
|
| MD5 |
d1610068eaf88b322e004396b2dbd712
|
|
| BLAKE2b-256 |
e1993bcad57cd0e158863490a3b3787c084d46de28a8b8fd9a4085689fb110a7
|