Skip to main content

asyncgh

A minimal async GitHub API transport — the plumbing an account-wide config tool needs before any of its domain logic: authentication, a shared connection, retrying error handling, REST pagination, and GraphQL.

There is no client object to construct and no config. It reads the token gh auth login already stored, keeps one process-wide httpx2.AsyncClient, and exposes plain functions.

Why not PyGithub / githubkit / gidgethub / fast.ai's ghapi?

Library Async Shape Trade-off vs asyncgh
PyGithub no typed objects sync-only — a poor fit for anything doing concurrent, fan-out API calls
githubkit yes Pydantic models, generated from GitHub's OpenAPI spec full, typed surface, but pulls in codegen'd models and pydantic; heavier than most scripts need
gidgethub yes sans-I/O, bring-your-own HTTP client closest in spirit, but leaves auth, retry, and the client itself to the caller
ghapi (fast.ai) no OpenAPI-generated, dynamic attribute access lightweight like this package, but sync-only
asyncgh yes plain dicts, ~200 lines no generated models, no schema — you read GitHub's own docs and index the JSON; retry and GraphQL are built in, not bolted on

If you want typed responses and full API coverage, use githubkit. If you want an async client with almost no code between you and the wire — a script firing dozens of concurrent calls that reads a handful of fields per response — that's what this is for.

API

Full API reference, generated from the docstrings: hugoh.github.io/gh-workflows/asyncgh (rebuilt on every push that touches this package -- see .github/workflows/docs.yml).

Auth

Authorization: Bearer $(gh auth token), resolved lazily on the first request and cached for the process. gh must be installed and logged in.

Retries

api_request retries transport errors (DNS, timeout, reset) and transient statuses — 429, 500, 502, 503, 504 — via stamina. A Retry-After header sets the exact wait; otherwise exponential backoff with jitter. GH_MAX_RETRIES (default 3) caps the retries; there is no wall-clock timeout, so a minute-long Retry-After is honoured in full. When the retries are spent the last response is returned unchanged for the caller to judge.

graphql() reuses that same retry for transport errors and 429/5xx, plus one addition: GitHub answers GraphQL rate limiting with HTTP 200 and an errors[].type == "RATE_LIMITED" body, which api_request's status-based retry never sees -- graphql() retries that case itself, on the same backoff. Any other GraphQL error (bad query, not found) is not transient and raises immediately.

Consumers

repo-admin/ (in this repo) uses it for every account-wide GitHub command -- repo_admin.py's sync subcommands and activity.py via api_request/ api_json/pagination; digest.py (wrapped by ../digest-action/) is the one driving graphql().

Metadata

Release files for asyncgh 0.1.0

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

Source distribution (sdist)

Source distribution for asyncgh 0.1.0
File Size Uploaded
asyncgh-0.1.0.tar.gz 10.2 kB Details

Built distribution (wheel)

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

Total release size: 19.2 kB

Release files / asyncgh-0.1.0.tar.gz

Download URL asyncgh-0.1.0.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2f4c9221c8220d0248f765c9bf112514052055ff36ca00117c81493a35bf7a4d
BLAKE2b-256 checksum
How to use checksums
784d136ce61384eead17183f24da598c3a14b4fd926ed28d12eba5aff2debdfa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / asyncgh-0.1.0-py3-none-any.whl

Download URL asyncgh-0.1.0-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5583afb198c90b3cae6cd6af9022e7a5317bfc233d900c204b3c6c36f8417ac
BLAKE2b-256 checksum
How to use checksums
254a60410e6599ef44413edf2cb26045ab0bf72b04f93371baf28826c6db5c89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

This release

0.1.0 This release

2 release files

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