Skip to main content

ghir

Search your GitHub repos, cloned or not, across every organization you belong to. Fetch once, then search offline; each hit says where it is cloned on this machine, if anywhere.

pip install ghir
ghir refresh                                   # you + your orgs, through the gh CLI
ghir search "flashcards spaced repetition"     # offline, ranked by ir
 0.032  thorwhalen/tetrachord  /home/me/proj/tt/tetrachord
        Music education with a learner model and scheduler at the architectural centre.
 0.015  thorwhalen/rbxloop  (not cloned)

Requires the GitHub CLI (gh auth login) for refresh only; searching never touches the network.

The four seams

ghir is corpus -> extraction -> ranking, with a cache beside it. Each is one keyword argument with a working default.

Seam Argument Default Alternatives
Locations: which repos refresh(locations) "@me": you and every org you belong to owner logins, "search:<github search query>"
Extraction: what text a repo contributes extract= "description_and_readme" (name, description, topics, README head) "description", or any record -> str callable
Ranking rank= "ir": hybrid dense + BM25 through ir, indexed incrementally "grep" (query terms as word prefixes, no index, no model), or any callable
Cache store= one JSON file per repo under ~/.local/share/ghir/repos/ any MutableMapping (a dol store: S3, a database)

refresh merges: fetched repos overwrite their own entries, and cached repos it did not see this time are kept. A location that fails to fetch is reported in "failed" and its cached repos stay.

import ghir

ghir.refresh(["i2mint", "search:user:thorwhalen topic:education"])
for hit in ghir.search("audio tagging", rank="grep", include_forks=False):
    print(hit.id, hit.local_path or hit.url)

Settings

Machine-specific choices go in ~/.config/ghir/config.json (or $GHIR_CONFIG):

{"locations": ["@me", "otosense"],
 "exclude": ["SomeClientOrg/*", "myorg/private-thing"]}

An owner excluded with owner/* is never queried. Other keys: extract, local_roots (where clones are looked for; default $PP or your home), cache_dir, corpus_name.

Using it from ir

ghir refresh also registers the cache as the ir corpus gh_repos (a records corpus whose fetcher is ghir:records), so ir's own tools see it:

ir discover gh_repos "spaced repetition"
ir discover gh_repos packages "audio tagging"    # federated with the local packages corpus

Why this is a separate package and not part of ir: docs/adr/0001-where-ghir-lives.md.

Metadata

Release files for ghir 0.0.2

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

Source distribution (sdist)

Source distribution for ghir 0.0.2
File Size Uploaded Provenance
ghir-0.0.2.tar.gz 17.0 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 33.6 kB

Release files / ghir-0.0.2.tar.gz

Download URL ghir-0.0.2.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d8dbaa70e5c4d8261cd3a3680e55a06c2ecd18aeadf9338ef2681e229e37ae6c
BLAKE2b-256 checksum
How to use checksums
387e23f832bf6a0ad717e82e223887db8572dc45d857df5ae7f91a81d92f9268
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ghir-0.0.2-py3-none-any.whl

Download URL ghir-0.0.2-py3-none-any.whl
Size 16.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d30e588d3c37ce436cfc8b616637bd810a6368baaec900d0944980dc96079add
BLAKE2b-256 checksum
How to use checksums
269407a054a0ee5061184bf90737bce68ce427580742fb8fcdc3ec8d116588dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for ghir 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

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