Name | gitstats JSON |
Version |
0.5.0
JSON |
| download |
home_page | None |
Summary | GitStats - Visualize Your Git Repositories |
upload_time | 2025-01-21 01:12:01 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | None |
keywords |
git
gitstats
statistics
git history
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# GitStats 📊
Visualize Your Git Repositories.
<!--[![PyPI - Downloads](https://img.shields.io/pypi/dm/gitstats?color=blue)](https://pypistats.org/packages/gitstats)-->
[![GitStats Report](https://img.shields.io/badge/GitStats_Report-passing-lightgreen?style=flat&&logo=git&&logoColor=white)](https://shenxianpeng.github.io/gitstats/index.html)
[![Test](https://github.com/shenxianpeng/gitstats/actions/workflows/test.yml/badge.svg)](https://github.com/shenxianpeng/gitstats/actions/workflows/test.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=shenxianpeng_gitstats&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=shenxianpeng_gitstats)
[![PyPI - Version](https://img.shields.io/pypi/v/gitstats?color=blue)](https://pypi.org/project/gitstats/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/gitstats)
## Example
Run `gitstats . report`[^1] to generate this report: https://shenxianpeng.github.io/gitstats/index.html
[^1]: Before running `gitstats`, ensure all required dependencies are installed on your system. See [requirements](#Requirements)
## Features
Here is a list of some features of _gitstats_:
* **General**: total files, lines, commits, authors, age.
* **Activity**: commits by hour of day, day of week, hour of week, month of year, year and month, and year.
* **Authors**: list of authors (name, commits (%), first commit date, last commit date, age), author of month, author of year.
* **Files**: file count by date, extensions.
* **Lines**: line of code by date.
* **Tags**: tags by date and author.
* **Customizable**: config values through `gitstats.conf`.
* **Cross-platform**: works on Linux, Windows, and macOS.
📈 More examples: [Jenkins project example](https://shenxianpeng.github.io/gitstats/examples/jenkins/index.html): A report showcasing data from the Jenkins project.
## Requirements
- Python 3.9+
- Gnuplot (http://www.gnuplot.info): You can install Gnuplot on
- Ubuntu with `sudo apt install gnuplot`
- macOS with `brew install gnuplot`
- Windows with `choco install gnuplot`
- Git (http://git-scm.com/)
## Installation
### Install from PyPI
```bash
pip install gitstats
```
### Install from Docker
You can also get gitstats docker image.
```bash
docker run ghcr.io/shenxianpeng/gitstats:latest --help
```
## Usage
```bash
gitstats --help
usage: gitstats [-h] [-v] [-c key=value] [-f {json}] <gitpath> [<gitpath> ...] <outputpath>
Generate statistics for a Git repository.
positional arguments:
<gitpath> Path(s) to the Git repository.
<outputpath> Path to the directory where the output will be stored.
options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-c key=value, --config key=value
Override configuration value. Can be specified multiple times. Default configuration: {'max_domains':
10, 'max_ext_length': 10, 'style': 'gitstats.css', 'max_authors': 20, 'authors_top': 5, 'commit_begin':
'', 'commit_end': 'HEAD', 'linear_linestats': 1, 'project_name': '', 'processes': 8, 'start_date': ''}.
-f {json}, --format {json}
The extra format of the output file.
```
> [!TIP]
> If you want to use gitstats with CI like GitHub Actions or Jenkins to generate reports and deploy them, please the following examples.
### Use gitstats in GitHub Actions
<details>
<summary>Example GitHub Actions</summary>
Use gitstats in GitHub Actions to generate reports and deploy them to GitHub Pages.
```yaml
name: GitStats Preview
on:
cron:
- cron: '0 0 * * 0' # Run at every sunday at 00:00
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # get all history.
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y gnuplot
- name: Generate GitStats Report
run: |
pipx install gitstats
gitstats . gitstats-report
- name: Deploy to GitHub Pages for view
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: gitstats-report
```
</details>
### Use gitstats in Jenkins
<details>
<summary>Example Jenkinsfile</summary>
Use gitstats in Jenkins to generate reports and publish them to Jenkins server.
```groovy
pipeline {
agent any
options {
cron('0 0 * * 0') // Run at every sunday at 00:00
}
stages {
stage('Generate GitStats Report') {
steps {
checkout scm
sh '''
python3 -m venv venv
source venv/bin/activate
pip install gitstats
gitstats . gitstats-report
'''
}
}
stage('Publish GitStats Report') {
steps {
publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true, reportDir: 'gitstats-report', reportFiles: 'index.html', reportName: 'GitStats Report'])
}
}
}
post {
always {
cleanWs()
}
}
}
```
</details>
## FAQ
1. How do I generate statistics of a non-master branch?
Use the `-c commit_end=devel` parameter.
2. I have files in my git repository that I would like to exclude from the statistics. How do I do that?
At the moment, the only way is to use [git-filter-branch(1)](https://git-scm.com/docs/git-filter-branch) to create a temporary repository and generate the statistics from that.
3. How do I merge author information when the same author has made commits using different names or emails?
Use Git's `.mailmap` feature, as described in the [gitmailmap](https://git-scm.com/docs/gitmailmap) documentation.
## Contributors
[![GitStats Report](https://contrib.rocks/image?repo=shenxianpeng/gitstats)](https://github.com/shenxianpeng/gitstats/graphs/contributors)
## License
Both the code and the web site are licensed under GPLv2/GPLv3.
---
The gitstats project was originally created by [H​eikki H​okkanen](https://github.com/hoxu) but is no longer maintained since 2015. It is now maintained by [Xianpeng Shen](https://github.com/shenxianpeng).
Raw data
{
"_id": null,
"home_page": null,
"name": "gitstats",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "git, gitstats, statistics, git history",
"author": null,
"author_email": "Xianpeng Shen <xianpeng.shen@gmail.com>, Heikki Hokkanen <hoxu@users.sf.net>",
"download_url": null,
"platform": null,
"description": "# GitStats \ud83d\udcca\n\nVisualize Your Git Repositories.\n\n<!--[![PyPI - Downloads](https://img.shields.io/pypi/dm/gitstats?color=blue)](https://pypistats.org/packages/gitstats)-->\n[![GitStats Report](https://img.shields.io/badge/GitStats_Report-passing-lightgreen?style=flat&&logo=git&&logoColor=white)](https://shenxianpeng.github.io/gitstats/index.html)\n[![Test](https://github.com/shenxianpeng/gitstats/actions/workflows/test.yml/badge.svg)](https://github.com/shenxianpeng/gitstats/actions/workflows/test.yml)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=shenxianpeng_gitstats&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=shenxianpeng_gitstats)\n[![PyPI - Version](https://img.shields.io/pypi/v/gitstats?color=blue)](https://pypi.org/project/gitstats/)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/gitstats)\n\n## Example\n\nRun `gitstats . report`[^1] to generate this report: https://shenxianpeng.github.io/gitstats/index.html\n\n[^1]: Before running `gitstats`, ensure all required dependencies are installed on your system. See [requirements](#Requirements)\n\n## Features\n\nHere is a list of some features of _gitstats_:\n\n* **General**: total files, lines, commits, authors, age.\n* **Activity**: commits by hour of day, day of week, hour of week, month of year, year and month, and year.\n* **Authors**: list of authors (name, commits (%), first commit date, last commit date, age), author of month, author of year.\n* **Files**: file count by date, extensions.\n* **Lines**: line of code by date.\n* **Tags**: tags by date and author.\n* **Customizable**: config values through `gitstats.conf`.\n* **Cross-platform**: works on Linux, Windows, and macOS.\n\n\ud83d\udcc8 More examples: [Jenkins project example](https://shenxianpeng.github.io/gitstats/examples/jenkins/index.html): A report showcasing data from the Jenkins project.\n\n## Requirements\n\n- Python 3.9+\n- Gnuplot (http://www.gnuplot.info): You can install Gnuplot on\n - Ubuntu with `sudo apt install gnuplot`\n - macOS with `brew install gnuplot`\n - Windows with `choco install gnuplot`\n- Git (http://git-scm.com/)\n\n## Installation\n\n### Install from PyPI\n\n```bash\npip install gitstats\n```\n\n### Install from Docker\n\nYou can also get gitstats docker image.\n\n```bash\ndocker run ghcr.io/shenxianpeng/gitstats:latest --help\n```\n\n## Usage\n\n```bash\ngitstats --help\nusage: gitstats [-h] [-v] [-c key=value] [-f {json}] <gitpath> [<gitpath> ...] <outputpath>\n\nGenerate statistics for a Git repository.\n\npositional arguments:\n <gitpath> Path(s) to the Git repository.\n <outputpath> Path to the directory where the output will be stored.\n\noptions:\n -h, --help show this help message and exit\n -v, --version show program's version number and exit\n -c key=value, --config key=value\n Override configuration value. Can be specified multiple times. Default configuration: {'max_domains':\n 10, 'max_ext_length': 10, 'style': 'gitstats.css', 'max_authors': 20, 'authors_top': 5, 'commit_begin':\n '', 'commit_end': 'HEAD', 'linear_linestats': 1, 'project_name': '', 'processes': 8, 'start_date': ''}.\n -f {json}, --format {json}\n The extra format of the output file.\n```\n\n> [!TIP]\n> If you want to use gitstats with CI like GitHub Actions or Jenkins to generate reports and deploy them, please the following examples.\n\n### Use gitstats in GitHub Actions\n\n<details>\n<summary>Example GitHub Actions</summary>\n\nUse gitstats in GitHub Actions to generate reports and deploy them to GitHub Pages.\n\n```yaml\nname: GitStats Preview\n\non:\n cron:\n - cron: '0 0 * * 0' # Run at every sunday at 00:00\n workflow_dispatch:\n\njobs:\n build:\n runs-on: ubuntu-latest\n\n steps:\n - name: Checkout Repository\n uses: actions/checkout@v4\n with:\n fetch-depth: 0 # get all history.\n\n - name: Install Dependencies\n run: |\n sudo apt-get update\n sudo apt-get install -y gnuplot\n\n - name: Generate GitStats Report\n run: |\n pipx install gitstats\n gitstats . gitstats-report\n\n - name: Deploy to GitHub Pages for view\n uses: peaceiris/actions-gh-pages@v4\n with:\n github_token: ${{ secrets.GITHUB_TOKEN }}\n publish_dir: gitstats-report\n```\n</details>\n\n### Use gitstats in Jenkins\n\n<details>\n<summary>Example Jenkinsfile</summary>\n\nUse gitstats in Jenkins to generate reports and publish them to Jenkins server.\n\n```groovy\npipeline {\n agent any\n options {\n cron('0 0 * * 0') // Run at every sunday at 00:00\n }\n stages {\n stage('Generate GitStats Report') {\n steps {\n checkout scm\n sh '''\n python3 -m venv venv\n source venv/bin/activate\n pip install gitstats\n gitstats . gitstats-report\n '''\n }\n }\n stage('Publish GitStats Report') {\n steps {\n publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true, reportDir: 'gitstats-report', reportFiles: 'index.html', reportName: 'GitStats Report'])\n }\n }\n }\n post {\n always {\n cleanWs()\n }\n }\n}\n```\n</details>\n\n## FAQ\n\n1. How do I generate statistics of a non-master branch?\n\n Use the `-c commit_end=devel` parameter.\n\n2. I have files in my git repository that I would like to exclude from the statistics. How do I do that?\n\n At the moment, the only way is to use [git-filter-branch(1)](https://git-scm.com/docs/git-filter-branch) to create a temporary repository and generate the statistics from that.\n\n3. How do I merge author information when the same author has made commits using different names or emails?\n\n Use Git's `.mailmap` feature, as described in the [gitmailmap](https://git-scm.com/docs/gitmailmap) documentation.\n\n## Contributors\n\n[![GitStats Report](https://contrib.rocks/image?repo=shenxianpeng/gitstats)](https://github.com/shenxianpeng/gitstats/graphs/contributors)\n\n## License\n\nBoth the code and the web site are licensed under GPLv2/GPLv3.\n\n---\n\nThe gitstats project was originally created by [H\u200beikki H\u200bokkanen](https://github.com/hoxu) but is no longer maintained since 2015. It is now maintained by [Xianpeng Shen](https://github.com/shenxianpeng).\n",
"bugtrack_url": null,
"license": null,
"summary": "GitStats - Visualize Your Git Repositories",
"version": "0.5.0",
"project_urls": {
"homepage": "https://shenxianpeng.github.io/gitstats/main/index.html",
"source": "https://github.com/shenxianpeng/gitstats",
"tracker": "https://github.com/shenxianpeng/gitstats/issues"
},
"split_keywords": [
"git",
" gitstats",
" statistics",
" git history"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6d8820e1dc6ff232b35d34638667f35cbb98c66fb0ef5f50d27db90911b6f885",
"md5": "38f6615e572c0dbad7c6bc009a2ca266",
"sha256": "31c2bd4991780e11c5a2cf168eb2a0e848824f861078966ffd19333264397bce"
},
"downloads": -1,
"filename": "gitstats-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "38f6615e572c0dbad7c6bc009a2ca266",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 25065,
"upload_time": "2025-01-21T01:12:01",
"upload_time_iso_8601": "2025-01-21T01:12:01.174440Z",
"url": "https://files.pythonhosted.org/packages/6d/88/20e1dc6ff232b35d34638667f35cbb98c66fb0ef5f50d27db90911b6f885/gitstats-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-21 01:12:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "shenxianpeng",
"github_project": "gitstats",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "gitstats"
}