Skip to main content

A CLI tool using gh to rapidly locate and inspect files in remote GitHub repositories without cloning.

Project description

gh-inspector

PyPI version Python 3.10+ License: MIT

A CLI tool that uses the GitHub CLI (gh) to rapidly locate and inspect files in remote GitHub repositories — without cloning them.

Requirements

  • GitHub CLI (gh) — authenticated via gh auth login or GH_TOKEN
  • Python 3.10+

Authentication

gh-inspector delegates authentication entirely to the gh CLI. The recommended approaches:

# Persistent login (recommended for local use)
gh auth login

# Token via environment variable
export GH_TOKEN=ghp_yourtoken

1Password (or any secret manager)

op run needs to know which secrets to inject. Use --env-file with a .env file:

# 1. Copy the example and fill in your 1Password reference
cp .env.example .env

# 2. Edit .env — the format is op://<vault>/<item>/<field>
# Example:
#   GH_TOKEN=op://Personal/GitHub/token

# 3. Find your exact reference if unsure:
op item list | grep -i github
op item get "GitHub" --fields label=token

# 4. Run with secret injection
op run --env-file=.env -- make e2e

Installation

pip install gh-inspector

Or with uv:

uv tool install gh-inspector

Commands

find-python-library

Scan dependency files across all repositories in a GitHub organization and report which version of a library each repo uses.

gh-inspector find-python-library <org> <library> [library2 ...]

Examples:

# Find Django and requests versions across the org
gh-inspector find-python-library myorg django requests

# Scan only uv.lock files
gh-inspector find-python-library myorg typer --file-types uv.lock

# Scan only dev requirements
gh-inspector find-python-library myorg pytest --file-types requirements-dev.txt

# Scan all requirements txt files (use quotes for globs in shell)
gh-inspector find-python-library myorg django --file-types "requirements*.txt"

# Search all repos, not just Python ones
gh-inspector find-python-library myorg pydantic --all-repositories

# List only repo names (no version breakdown)
gh-inspector find-python-library myorg fastapi --format only_repo

Options:

Flag Default Description
--format / -f default Output format: default or only_repo
--file-types / -t all File types to scan (repeatable)
--all-repositories / -a false Include non-Python repos

Supported file types: requirements*.txt, requirements*.in, uv.lock, poetry.lock, Pipfile.lock, setup.cfg


find-python-version

Detect which Python version each repository targets, by scanning Dockerfiles, pyproject.toml, .python-version, GitHub Actions workflows, and more.

gh-inspector find-python-version <org>

Examples:

# Scan all Python repos in the org
gh-inspector find-python-version myorg

# Limit to specific file types
gh-inspector find-python-version myorg --file-types Dockerfile --file-types pyproject.toml

# Include all repos regardless of language
gh-inspector find-python-version myorg --all-repositories

Options:

Flag Default Description
--file-types / -f all File patterns to scan (repeatable)
--all-repositories / -a false Include non-Python repos

Detected file types: Dockerfile, .python-version, pyproject.toml, setup.py, .github/workflows/*.yml, tox.ini, Pulumi.prod.yaml


Shell Completion

gh-inspector --install-completion bash   # or zsh, fish

Restart your shell after installing.

Development

git clone https://github.com/acabelloj/gh-inspector.git
cd gh-inspector
make install   # install deps + pre-commit hooks
Command Description
make install Install deps and set up pre-commit hooks
make lint Run ruff linter
make format Run ruff formatter
make test Run tests
make build Build the package
make clean Remove build artifacts

Commits must follow Conventional Commits — enforced by pre-commit and required to merge.

License

MIT — see LICENSE.

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

gh_inspector-0.2.2.tar.gz (44.1 kB view details)

Uploaded Source

Built Distribution

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

gh_inspector-0.2.2-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file gh_inspector-0.2.2.tar.gz.

File metadata

  • Download URL: gh_inspector-0.2.2.tar.gz
  • Upload date:
  • Size: 44.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gh_inspector-0.2.2.tar.gz
Algorithm Hash digest
SHA256 4ce9eb3aed93b69239d3a6322643365a9f05b0c16206b00a0e093e6d8a8066e6
MD5 cd52603db64ace97de30d7cefc4f8332
BLAKE2b-256 cd22567eac42ac7fb4e9894e2edb8925c3af5a1975d61a13afac5030592cb62b

See more details on using hashes here.

Provenance

The following attestation bundles were made for gh_inspector-0.2.2.tar.gz:

Publisher: release-please.yml on acabelloj/gh-inspector

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gh_inspector-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: gh_inspector-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gh_inspector-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2f2c12b35138e0a722f78e00f941273b7818374fd194f71ec4d2d64ffc0cabb5
MD5 27973778ec8842e0f8f7fe3ae79d3fbc
BLAKE2b-256 39281efe262853d2c978c734bd03652e99e4ebd3758a173bee0b3c996f9e71bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for gh_inspector-0.2.2-py3-none-any.whl:

Publisher: release-please.yml on acabelloj/gh-inspector

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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