Skip to main content

git-author-stats

test PyPI version

This package provides a CLI and library for extracting author "stats" (insertions and deletions) for a Git repository or Github organization.

Under the hood, these metrics are obtained by:

  1. Cloning truncated versions of all specified repositories (or all repositories in a specified Github organizations) into temp directories
  2. Calculating a series of date ranges based on the temporal limits and frequency you've specified
  3. Using git log --numstat to get a count of the insertions and deletions made by each author during each date range

Please note that this package does not provide functionality for aggregation or analysis of the metrics extracted, instead the output is provided in a format suitable for use with tools such as polars, pandas, and pyspark.

All stats obtained from this package will be unique when grouped by url + commit + author_name + file, and include the following fields:

  • url (str): The URL of the repository (provided because stats for multiple repositories can be obtained with one function call or command)
  • since (date|None): The start date for a pre-defined time period as determined by frequency and time range parameters provided by the user
  • before (date|None): The (non-inclusive) end date for a pre-defined time period as determined by frequency and time range parameters provided by the user
  • author_date (datetime.datetime|None): The date and time of the author's commit
  • author_name (str): The name of the author
  • commit (str): The abbreviated commit hash
  • file (str): The relative path of the modified file
  • insertions (int): The number of lines inserted in this commit (please note that this is always 0 for binary files)
  • deletions (int): The number of lines deleted in this commit (please note that this is always 0 for binary files)

Please note that:

  • The fields since and before are provided as a convenience for easy aggregation of stats, based on parameters provided by the user, but do not provide any additional information about the commit or file
  • All dates and times are expressed in coordinated universal time (UTC), as timezone-unaware datetime.datetime or datetime.date objects in python, and output in ISO 8601 format when written to CSV/TSV files and/or console output

Installation

You can install git-author-stats with pip:

pip3 install git-author-stats

Please note that you will need to specify the extra "github" in your pip install command if you want to extract stats from all repositories owned by a Github organization without needing to provide each repository URL explicitly:

pip3 install 'git-author-stats[github]'

Metadata

Release files for git-author-stats 1.0.2

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

Source distribution (sdist)

Source distribution for git-author-stats 1.0.2
File Size Uploaded
git_author_stats-1.0.2.tar.gz 11.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for git-author-stats 1.0.2
File Interpreter ABI Platform
git_author_stats-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 25.1 kB

Release files / git_author_stats-1.0.2.tar.gz

Download URL git_author_stats-1.0.2.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
76ac420b186d5710d1f148bdbcaef0eb3e8f5b418fb518074af98c07cc3ead6b
BLAKE2b-256 checksum
How to use checksums
356299cf46e8211aa5d152e80781212757b36d5e0120efc9a0f740d603efdde6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Release files / git_author_stats-1.0.2-py3-none-any.whl

Download URL git_author_stats-1.0.2-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
12609cade3de56c0173231d19ae70908710062062fd42b519d66c1ce14271e7d
BLAKE2b-256 checksum
How to use checksums
0b256bd434b2ccdac3a44e8e10e21ad08039a22c3d2162b79b29d5896a4dfc2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.1

2 release files

0.0.0

2 release files

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