Skip to main content

A tool to scrape code from Git repositories for LLM analysis.

Project description

Below is an example of a README that includes a list of available CLI options for your package:

GitHub Scrap

A tool to scrape code from Git repositories for LLM or other analysis. Below is an example output. This example assumes that your repository contains a file named hello.py with a simple function. When you run the tool, you might see output similar to:

### File: hello.py
def greet():
    print("Hello, world!")

Installation

You can install the package using PyPI

pip install github-scrap

Or, if you use Poetry:

poetry add github-scrap

or directly from GitHub:

pip install git+https://github.com/Pioannid/GitHubScrap.git

Usage

Python Script

from github_scrap import GitHubCodeScraper

repo_url = "https://github.com/Pioannid/GitHubScrapper"
scraper = GitHubCodeScraper(repo_path=repo_url, branch="main")
code_contents = scraper.scrape_repository()
formatted_output = scraper.format_for_llm(code_contents)
print(formatted_output)

CLI

After installation, the CLI tool is available as github-scrap. The basic usage is:

github-scrap [OPTIONS] REPO_PATH

Where REPO_PATH is the path to the Git repository or its URL.

–output, -o: Description: Specify a file path to save the formatted output. Example: --output output.txt

–ignore-dirs, -id: Description: Additional directories to ignore. Accepts one or more directory names. Example: --ignore-dirs venv node_modules

–ignore-files, -if: Description: Specific files to ignore. Accepts one or more filenames. Example: --ignore-files README.md LICENSE

–ignore-file, -c: Description: Path to a configuration file with ignore rules (for both files and directories). Example: --ignore-file .gitignore

–token, -t: Description: GitHub token for private repositories (if REPO_PATH is a URL). Example: --token YOUR_GITHUB_TOKEN

–branch, -b: Description: The branch to scrape from. Default is main. Example: --branch develop

Example Command

To scrape the repository on the main branch and save the output to output.txt:

github-scrap https://github.com/Pioannid/GitHubScrap --branch main --output output.txt

License

This project is licensed under the MIT License.


Feel free to modify the wording or examples to best match your project. This README provides clear instructions on how to install, use, and customize the tool via its available CLI options.

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

github_scrap-0.1.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

github_scrap-0.1.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file github_scrap-0.1.1.tar.gz.

File metadata

  • Download URL: github_scrap-0.1.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for github_scrap-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5c1a24627d67fa114edc21e198b1154b0d7785d74c28b2fc1e84b582b8586288
MD5 9efc2b2a311ecf1a2e62f5c6bfe3097b
BLAKE2b-256 81e3e6c826ca9faf03ee409412f702e723e06ef483ee3073e6d7f6801e53e40f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: github_scrap-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for github_scrap-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 763341e0749664ec5d4c649a39ef474372f55b92befad6e15bb7ee2da6acc452
MD5 8135bc73cac7c235a060439b1bbfdd52
BLAKE2b-256 f96042a9a51b1d830e2324120abef9498036c9d0964348bf7da3d424016b4b66

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