Quickstart¶
from ocx_mirror_sdk import IndexBuilder, github
releases = github.list_releases("shellcheck/shellcheck")
builder = IndexBuilder()
for r in releases:
if r.prerelease or r.draft:
continue
builder.add_version(
r.tag_name.lstrip("v"),
assets={a.name: a.browser_download_url for a in r.assets},
)
builder.emit() # writes JSON to stdout
That's a complete, valid generator. It:
- Fetches all releases from
koalaman/shellcheckvia REST. - Skips prereleases and drafts.
- Adds each remaining release to an
IndexBuilderkeyed by the tag withvstripped. - Emits the JSON document to stdout.
The first run hits GitHub's API; the second is served from
~/.cache/ocx-mirror-sdk/github/. Local iteration is free.
On big repos¶
shellcheck is small. If the REST API 504s on yours, opt into the
GraphQL backend:
releases = github.list_releases(
"astral-sh/python-build-standalone",
backend=github.Backend.GRAPHQL,
)
GraphQL requires GITHUB_TOKEN; REST works anonymously (5 000 req/h).
See Fetching releases for the decision table.