Skip to main content

Git repository statistics and commit analysis

Project description

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}}

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

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

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

philiprehberger_git_analyzer-0.1.8.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

philiprehberger_git_analyzer-0.1.8-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file philiprehberger_git_analyzer-0.1.8.tar.gz.

File metadata

File hashes

Hashes for philiprehberger_git_analyzer-0.1.8.tar.gz
Algorithm Hash digest
SHA256 cdf507f51f4dc8254d920fbfd7354dd516d42b660bc5af3d53b74cc632234ccc
MD5 e63f9e9ef37dd217d1ca1f8ffae0e555
BLAKE2b-256 c002c8ec6a154616cd1ba1bfc03c3406ecd8b8e9002164ad7263666b5ccee8fc

See more details on using hashes here.

File details

Details for the file philiprehberger_git_analyzer-0.1.8-py3-none-any.whl.

File metadata

File hashes

Hashes for philiprehberger_git_analyzer-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 fb1a7118f4fb092abb17fa8a3f8bbba409b6ab1049e88dffbe94f5538ff46ac9
MD5 b1ec1b92e8ed399541703ab98b97c7fe
BLAKE2b-256 bd4dc844a708f0f049c483a8e5e8ce19304fba855d4320f287c7c01a5058f3b0

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