Skip to main content

A tool for mining GitHub repository metadata and activity data

Project description

Git Miner

Search GitHub repositories and export their data to CSV, JSON, or Parquet.

PyPI version PyPI downloads License

Installation

pip install git-miner

Quick Start

Search and export repositories:

git-miner search "python web framework" --language python --min-stars 1000

Add your GitHub token for higher rate limits:

Option 1: Using the auth command (recommended)

git-miner auth add --token your_token

Your token is stored locally in ~/.cache/git-miner/tokens.db and automatically used.

Option 2: Environment variable

export GITHUB_TOKEN=your_token
git-miner search "data science" --format json

Option 3: Command line flag

git-miner search "data science" --token your_token

Manage cached tokens

# List stored tokens
git-miner auth list

# Remove a token
git-miner auth remove

# Show a specific token
git-miner auth show --name default

Use Cases

  • Research: Study open-source trends, language adoption, repository patterns
  • Data Science: Build datasets for ML model training on code repositories
  • Academic: Analyze collaboration patterns, project lifecycles
  • Analytics: Track repository growth, contributor engagement
  • Tooling: Find repositories matching specific criteria for automation
  • Market Research: Identify popular libraries and frameworks

Commands

Auth

Manage GitHub tokens locally:

git-miner auth list|add|remove|show [OPTIONS]

Actions:

  • list: Show all cached tokens
  • add: Store a new token
  • remove: Delete a token
  • show: Display a token value

Options:

  • --name, -n: Token name (default: "default")
  • --token, -t: Token value (required for add)

Search

git-miner search QUERY [OPTIONS]

Filters:

  • --language, -l: Programming language
  • --min-stars / --max-stars: Star count range
  • --min-forks / --max-forks: Fork count range
  • --license: License type (e.g., mit, apache-2.0)
  • --topics: Topics to include (comma-separated)
  • --fork / --no-fork: Include or exclude forks
  • --archived / --no-archived: Include or exclude archived repos
  • --sort: Sort by stars, forks, or updated
  • --max-results: Limit number of results

Output:

  • --format, -f: csv, json, or parquet
  • --output-dir, -o: Output directory

Examples:

# Python repos with 1000+ stars
git-miner search "web framework" --language python --min-stars 1000

# MIT-licensed repos
git-miner search "data science" --license mit

# Exclude forks and archived
git-miner search "api" --no-fork --no-archived

# Top 50 by stars, export to Parquet
git-miner search "machine learning" --sort stars --max-results 50 --format parquet

Extract

Get detailed stats for repositories:

git-miner extract owner/repo

Options:

  • --activity / --no-activity: Include commit/issue/PR stats
  • --contributors / --no-contributors: Include contributor stats

Output Formats

Format Best For
CSV Excel, traditional tools
JSON Web apps, APIs
Parquet Big data, analytics

Configuration

Create gitminer.toml:

[output]
dir = "./datasets"
format = "parquet"

[api]
max_retries = 3
timeout = 30.0

Use it:

git-miner --config gitminer.toml search "web framework"

Note: GitHub tokens are now managed via the auth command and stored in a local SQLite cache.

Rate Limits

  • No token: 60 requests/hour
  • With token: 5,000 requests/hour

The tool respects rate limits automatically.

Dataset Fields

Repository Metadata:

  • repository_id, name, owner, description
  • primary_language, stars, forks, open_issues
  • license, created_at, updated_at, pushed_at
  • size_kb, url, is_fork, is_archived, topics

Activity Statistics:

  • commit_total, commit_additions, commit_deletions
  • issues_open, issues_closed, prs_open, prs_closed, prs_merged

Coming Soon

  • Direct code extraction from repositories into datasets
  • GraphQL API support
  • Incremental dataset updates
  • Pre-built public datasets
  • Plugin-based extractor system
  • Cloud storage outputs (S3, GCS)

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Lint and format
make lint
make format

License

Apache License 2.0

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

git_miner-0.2.1.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

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

git_miner-0.2.1-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file git_miner-0.2.1.tar.gz.

File metadata

  • Download URL: git_miner-0.2.1.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for git_miner-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a1c02c6918248167af64e4f26424853b3fa719f436598d4a8860c26e0531c4e8
MD5 df7cb236ca9ae01fc5f5aa5225e08f8e
BLAKE2b-256 1a8e9032262d62736ab024bf49cd0c0ec2a5b6fd109bdf5ca6da866ff499c409

See more details on using hashes here.

File details

Details for the file git_miner-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: git_miner-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for git_miner-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8e658a553e93a0ece518a8ad2b462baaa881d26fcc0be4d9f4f9743860d3e6ca
MD5 14f148d2f8dc98ac59e61c4c3bc3655f
BLAKE2b-256 d1c1ad625346726bf54e0286d1619b4e5c4eaf0057cadc5cfd217fd05fe24908

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