Skip to main content

philiprehberger-git-analyzer

Tests PyPI version Last updated

Git repository statistics and commit analysis.

Installation

pip install philiprehberger-git-analyzer

Usage

from philiprehberger_git_analyzer import analyze

report = analyze(".")

print(f"Total commits: {report.total_commits}")
print(f"Contributors: {report.contributor_count}")
print(f"Most active file: {report.most_changed_file}")
print(f"Commits/week: {report.commits_per_week}")

# Per-author stats
for author in report.authors:
    print(f"{author.name}: {author.commits} commits")

# File hotspots (most changed files)
for file in report.hotspots(limit=10):
    print(f"{file.path}: {file.change_count} changes")

# Language breakdown
for ext, count in report.file_extensions.items():
    print(f"{ext}: {count} files")

# Activity patterns
print(report.commits_by_hour)      # {9: 42, 10: 38, ...}
print(report.commits_by_weekday)   # {0: 120, 1: 115, ...} (0=Mon)
print(report.activity_heatmap())   # {weekday: {hour: count}}

Top authors and hotspots

from philiprehberger_git_analyzer import analyze

report = analyze(".")

# Top 5 most active contributors
for author in report.top_authors(5):
    print(f"{author.name}: {author.commits} commits")

# Top 5 most frequently changed files
for file in report.top_hotspots(5):
    print(f"{file.path}: {file.change_count} changes")

API

analyze(repo_path, branch?, max_commits?) -> RepoReport

Field Description
total_commits Total number of commits
contributor_count Number of unique authors
first_commit_date Date of earliest commit
last_commit_date Date of latest commit
commits_per_week Average commits per week
most_changed_file File with most changes
authors List of AuthorStats
file_extensions Extension → file count
commits_by_day Date → commit count
commits_by_hour Hour → commit count
commits_by_weekday Weekday → commit count
hotspots(limit) Most frequently changed files
activity_heatmap() Weekday × hour activity matrix
top_authors(n=10) Top N authors by commit count, descending
top_hotspots(n=10) Top N files by change frequency, descending

Development

pip install -e .
python -m pytest tests/ -v

Support

If you find this project useful:

⭐ Star the repo

🐛 Report issues

💡 Suggest features

❤️ Sponsor development

🌐 All Open Source Projects

💻 GitHub Profile

🔗 LinkedIn Profile

License

MIT

Release files for philiprehberger-git-analyzer 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for philiprehberger-git-analyzer 0.2.0
File Size Uploaded
philiprehberger_git_analyzer-0.2.0.tar.gz 175.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for philiprehberger-git-analyzer 0.2.0
File Interpreter ABI Platform
philiprehberger_git_analyzer-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 181.8 kB

Release files / philiprehberger_git_analyzer-0.2.0.tar.gz

Download URL philiprehberger_git_analyzer-0.2.0.tar.gz
Size 175.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6900af9ee69954e1c66102e75f044d55b219bdf988a20e240d54b20030ac15e9
BLAKE2b-256 checksum
How to use checksums
f5549d104eebb0ac8404a265ede8c114b33455236ded636d9c1535cc4dfa2865
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / philiprehberger_git_analyzer-0.2.0-py3-none-any.whl

Download URL philiprehberger_git_analyzer-0.2.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e24c4f252de148a06d2b57a04f6d86126c4a169d4e579ff8aee2c0e54b7a49a7
BLAKE2b-256 checksum
How to use checksums
1e5ed176e809b3fb8b0fe8203ab1b14d32746f1cac1fac1d18a905b4b0a3a690
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page