Skip to main content

Command line tools for GitHub repo statistics

Project description

ghrepo-stats PyPI version

Have you ever wondered how the number of stargazers or the number of open issues has changed over time for your (or any) GitHub repository? I did, so I wrote this small command line tool to do this.

ghrepo-stats uses pygithub to collect some statistics from a specific repository using a command line tool and show it using matplotlib or write it to a csv file.

Features

The following sub-commands are supported:

  • stars: shows the number of stargazers over time (caveat: stargazers that have removed their star are not shown, as the info is not available)
  • issues: shows the number of open issues over time
  • prs: shows the number of open pull requests over time
  • commits: shows the number of commits over the last year
  • codesize: shows the change of the code size over time measured by the number of additions and deletions

Caution: Don't use issues or prs sub-commands with repositories with many (open or close) issues - this will take a lot of time and load on the GitHub API.

Installation

If you want to try it, you can install it from PyPi:

pip install ghrepo-stats

Or you can install the current master from GitHub:

pip install git+https://github.com/mrbean-bremen/ghrepo-stats

Usage

To use this, you need a personal access token able to read public repositories for your GitHub account. The user name and token is expected to be found in the file ghrepo-stats.ini, either in the repository root, or in your home path.

The contents should be in the form:

[auth]
username = my-github-username
token = 123456789abcdef0123456789abcdef012345678

To get usage information you can now type:

$ show-ghstats -h
usage: show-ghstats [-h] [--verbose] [--csv CSV] sub_command repo_name

Shows GitHub repo statistics

positional arguments:
  sub_command    The kind of statistics to show. Possible values: 'issues',
                 'prs', 'stars', 'commits', 'codesize'.
  repo_name      Full repository name in the form <repo_owner>/<repo_name>.

optional arguments:
  -h, --help     show this help message and exit
  --verbose, -v  Outputs diagnostic information
  --csv CSV      Write the output into a csv file with the given file path

So, for example, to get a star plot of a specific repository, you can write:

$ show-ghstats stars "my-github-username/my-repo"

If you want to have the numbers saved in a csv file instead to play around with the numbers you can write:

$ show-ghstats stars "my-github-username/my-repo" --csv=my_repo-issues

This will write a file my_repo-issues.csv with the numbers (date+time / number of issues) in the current path.

Examples

Get some measure of popularity change by showing the number of stargazers over time (note: stars that have been retracted are not counted):

$ show-ghstats stars "jmcgeheeiv/pyfakefs"

stars

Check how fast issues are handled by showing how many issues have been open over time:

$ show-ghstats issues "vvvv/svg"

issues

See how the code size changed over time measured in code additions/deletions:

$ show-ghstats codesize "pytest-dev/pytest"

codesize

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

ghrepo-stats-0.2.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

ghrepo_stats-0.2.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file ghrepo-stats-0.2.0.tar.gz.

File metadata

  • Download URL: ghrepo-stats-0.2.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.2 requests-toolbelt/0.8.0 tqdm/4.46.1 CPython/3.7.1

File hashes

Hashes for ghrepo-stats-0.2.0.tar.gz
Algorithm Hash digest
SHA256 613a8e6af9f129623cd3fb33631b31a00a1733e7fa2f56ca8d7837b7ce5c7d4b
MD5 ae60f363e0b93e0484c44707145b33f5
BLAKE2b-256 67a8da658d720ffeb0a93c79975e46f417080414ce5baaa35c43398b6bb5c545

See more details on using hashes here.

File details

Details for the file ghrepo_stats-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ghrepo_stats-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.2 requests-toolbelt/0.8.0 tqdm/4.46.1 CPython/3.7.1

File hashes

Hashes for ghrepo_stats-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f3c65b992c86b3dea2ce7cee6075517556d12bd469dda4c164503601387cae4
MD5 bab84f9d04ff241a308965d1c396fda3
BLAKE2b-256 4ab4174e2dc96fe04f9fae4999080f02051a86294a7e61ca34aabb1666610afa

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