Skip to main content

ghminer

A library and toolkit for MSR research.

Mining software repository has been a popular research method for quite long time. Although github offers convenient public REST and GraphQL API, collecting large scale dataset with long history of information such as repository, author, bot, issues, pull request, comment is still a non-trivial task. There are three major challenges to be solved in order to retrieve large search results from github:

  • 1000-limit issue: github API discards records beyond 1000 in the result set of a particular query.

  • rate-limit issue: github API prevents authenticated personal accounts from invoking API more than 5000 times per hour.

  • pagination: User has to issue multiple API calls to retrieve the complete query results over 100 records.

When the client exceeds the rate limit, it is disconnected with HTTP status code 503. Without proper recover handling, data collection process is subject to frequent interruptions.

This library and assoicated scripts are intended to help solve the three challenges so that you can focus on the data mining rather than data collection.

Requirements

  • Python 3.7 over

Features

  • Search Github repositories based on stars, fork, language and topic

  • Search a large number of repositories by dividing creation time into small time window

  • Support multiple topics with OR relation

  • Build dataset in .csv and .parquet format

  • Retrieve commit, issue comments

  • Golang miner with go.mod retrieval and parsing

Setup

$ python -m venv /path/to/venv
$ /path/to/venv/bin/python -m pip install ghminer

Usage

To identify repositories for your MSR research, please refer to the script identify-repos.py. To retrieve commits, use the script retrieve-commits.py. To mine golang projects, use the script golang-miner.

>>> from ghminer.retriever import collect_data
>>> collect_data(
        2022, 2023, None, True, 100, 15,
        "repo.d", "java", trace=trace
    )

Metadata

Release files for ghminer 0.1.8

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

Source distribution (sdist)

Source distribution for ghminer 0.1.8
File Size Uploaded
ghminer-0.1.8.tar.gz 24.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ghminer 0.1.8
File Interpreter ABI Platform
ghminer-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 42.2 kB

Release files / ghminer-0.1.8.tar.gz

Download URL ghminer-0.1.8.tar.gz
Size 24.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f62fce3b4f3c37cb55bd2b078aceb9f4b4badfa47977e13986863b74de4755ab
BLAKE2b-256 checksum
How to use checksums
96e0b1b1322d35f63728c86dae9b0e9d7a7093db24793cca035eac1890bcf425
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / ghminer-0.1.8-py3-none-any.whl

Download URL ghminer-0.1.8-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
33c83ec4da10dbc87a7b9b6146bef1ccadea925b3d80b4bb182bf7cacad83a7f
BLAKE2b-256 checksum
How to use checksums
65e8cd968b36cde319999b5c31d9f2ccadd653966333b78137d37174d6fca43a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.1.8 This release

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