Skip to main content

A CLI tool to fetch GitHub repository statistics

Project description

⚡️ repostats

PyPI version Tests Python 3.9+ License: MIT

A CLI tool to fetch GitHub repository statistics.

Installation

pip install repostats

Usage

# Basic usage - single repository
repostats python/cpython

# Multiple repositories
repostats python/cpython golang/go rust-lang/rust

# With GitHub token for higher rate limits
export GITHUB_TOKEN=your_token_here
repostats python/cpython

# Or pass token directly
repostats python/cpython --token your_token_here

# Output as JSON
repostats python/cpython --format json

# Output as YAML
repostats python/cpython --format yaml

# Save output to a file
repostats python/cpython --format json --output stats.json

# Multiple repos with JSON output to file
repostats python/cpython golang/go --format json -o repos.json

Example output

Text format (default):

python/cpython statistics
-------------------------
Stars       : 70,399
Forks       : 33,713
Open issues : 9,248
Watchers    : 1,529
Language    : Python
License     : NOASSERTION
Size        : 754.8 MB
Default branch: main
Latest release: v3.13.0
Created     : 2017-02-10T19:23:51Z
Updated     : 2025-12-20T23:50:36Z

JSON format:

{
  "name": "python/cpython",
  "stars": 58000,
  "forks": 29000,
  "open_issues": 992,
  "watchers": 3400,
  "language": "Python",
  "created_at": "2007-02-20T00:00:00Z",
  "updated_at": "2024-01-15T12:34:56Z"
}

YAML format:

name: python/cpython
stars: 58000
forks: 29000
open_issues: 992
watchers: 3400
language: Python
created_at: '2007-02-20T00:00:00Z'
updated_at: '2024-01-15T12:34:56Z'

The command exits with code 1 when the GitHub API request fails (for example, when the repository is missing or you hit a rate limit), which makes it easy to integrate into scripts.

Features

  • Multiple repositories: Fetch stats for multiple repos in a single command
  • Rich metrics: Stars, forks, issues, watchers, language, license, size, latest release, and more
  • Multiple output formats: text (default), JSON, and YAML
  • File output: Save results to a file with --output
  • GitHub token support: Authenticate to increase rate limits
  • Clean output: Accessible formatting for all output types
  • Helpful error messages: Clear guidance on rate limits and missing repos
  • Exit codes: Non-zero exit on failure for scripting integration
  • Cross-platform: Works on macOS, Linux, and Windows

Development

# Clone the repository
git clone https://github.com/sahansera/repostats.git
cd repostats

# Create virtual environment
uv venv
source .venv/bin/activate

# Install in development mode
make install-dev

# Run tests
make test

# Format code
make format

# Type checking
make type-check

# See all available commands
make help

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

repostats-1.2.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

repostats-1.2.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file repostats-1.2.0.tar.gz.

File metadata

  • Download URL: repostats-1.2.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for repostats-1.2.0.tar.gz
Algorithm Hash digest
SHA256 a85a27e6f0563bd92cfe5187a01d5b28af22b7a16ba948c73d2c80b4374a4845
MD5 a407b05c88cd2c8d290211cf2bb8e69a
BLAKE2b-256 0ebaefd902926d3bb57efb995c33411ef392bb3428ec62790d183f353d5bc1b4

See more details on using hashes here.

File details

Details for the file repostats-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: repostats-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for repostats-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fef16ffa6b04c9daa9e66b63443b159611a22cf0b8d31fe5325db1dba68162e2
MD5 dd58bcdc3164da27ad51b4530a1f58d2
BLAKE2b-256 300a97baa9121ce6e8702a672a41eb2f75542566cf2a04695e3d3368bc536d4c

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