Skip to main content

Tool to search and fetch code from GitHub

Project description

# bigcode-fetcher

A utility to search and fetch code from GitHub. This tool was build to easily create datasets for repository analysis.

The tool works in two phases, search finds repositories using the GitHub API, and saves the result in a JSON file. download fetch all the repositories inside the JSON file.

## Install

This tool can be installed by running

` pip install bigcode-fetcher `

or by fetching this repository and running

` pip install . `

in this directory.

## Usage

### search command

By default, the utility searches for repositories fulfilling the following conditions

  • size between 1M and 100M

  • stars count > 10

  • non-viral license (MIT,Apache-2.0,MPL-2.0,BSD-2-Clause,BSD-3-Clause,BSD-4-Clause,MS-PL)

and retrieves the first 100 projects, ordered by number of stars.

To avoid API rate limiting, an access token can be provided either with the –token CLI argument or with the GITHUB_TOKEN environment variable.

See the help to see all the options:

` bigcode-fetcher search -h `

#### Example

Search for all Apache commons projects written in Java

` mkdir -p apache-common-projects bigcode-fetcher search --language Java --user apache --stars '>0' --keyword commons --max-repos 500 -o apache-common-projects/apache-commons.json `

### download command

This commands will simply git clone all the repositories in the JSON generated by the search command.

To reduce the download size, only the latest revision is fetched by default (i.e. git clone –depth 1). This can be disabled by passing in the –full flag.

USERNAME/REPO will be fetched in OUTPUT_DIR/USERNAME/REPO, where OUTPUT_DIR is set by the –output option.

The command will ignore the project if the directory already exists, so running the command multiple times is safe, and recommended to make sure all repositories have been fetched.

See the help for more information:

` bigcode-fetcher download -h `

#### Example

Download all the Apache commons project generated above

` mkdir -p apache-common-projects/repositories bigcode-fetcher download -i apache-common-projects/apache-commons.json -o apache-common-projects/repositories `

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

bigcode-fetcher-0.1.1.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

bigcode_fetcher-0.1.1-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file bigcode-fetcher-0.1.1.tar.gz.

File metadata

File hashes

Hashes for bigcode-fetcher-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e592a609946b5d4b58e46cb3b9bcae06ec2872dbff0f7537e0c7b0e44a19a88c
MD5 2258cfb9d930aa804414195e6cc03456
BLAKE2b-256 9c8ba15a8b107d48b4c99fdc1b1d40bd3bb7ffdf8c8b08ec25ccaf014730aa62

See more details on using hashes here.

File details

Details for the file bigcode_fetcher-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for bigcode_fetcher-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c0227a6a7307fb0842c9e920c282a6a96089e4ecf5c726454dfc230337485b55
MD5 8014e5928325461e3c273562af1e450a
BLAKE2b-256 389aae5e183c7a88ffb3ca17a88faa435ba17b52dc48e9c42890807ddc52b05f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page