ghget

Download single files or folders from a github repository without cloning its entire contents.


Keywords
command-line, download, github
License
MIT
Install
pip install ghget==0.3.1

Documentation

ghget logo

PyPI version PyPI - Downloads Build Status Code Style pre-commit Contributor Covenant GitHub

Description

Download single files or directories from a GitHub repository without cloning its entire contents.

Features

  • No need to manually create a raw GitHub url for individual files, just provide the web url.
  • Recursively download entire directories.
  • Download from private repos by setting a GITHUB_TOKEN environment variable.
  • Lightweight, easy to install, and easy to use.

Installation

The ghget package can be installed directly using pip.

pip install ghget

Usage

  • Easily download single files given the GitHub url:
$ ghget https://github.com/naiquevin/pipdeptree/blob/master/pipdeptree.py
Downloading 'pipdeptree.py'...
Done!
  • Recursively download a specific directory from a GitHub repo:
$ ghget https://github.com/pandas-dev/pandas/tree/master/scripts
Downloading 'scripts'...
Done!

$ tree
.
└── scripts
    ├── __init__.py
    ├── generate_pip_deps_from_conda.py
    ├── list_future_warnings.sh
    ├── no_bool_in_generic.py
    ├── pandas_errors_documented.py
    ├── sync_flake8_versions.py
    ├── tests
    │   ├── __init__.py
    │   ├── conftest.py
    │   ├── test_no_bool_in_generic.py
    │   ├── test_sync_flake8_versions.py
    │   ├── test_use_pd_array_in_core.py
    │   └── test_validate_docstrings.py
    ├── use_pd_array_in_core.py
    ├── validate_docstrings.py
    └── validate_rst_title_capitalization.py

Options

usage: ghget [-h] url

positional arguments:
  url         The url for the file or directory you want to download.

optional arguments:
  -h, --help  show this help message and exit