Skip to main content

asyncgh

PyPI

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

GitHubClient is the actual client. For a script that only ever talks to one account, module-level functions (api_json, graphql, fetch_repos, ...) wrap one shared default instance, so there's nothing to construct -- they read the token gh auth login already stored and go. Construct a GitHubClient directly to talk to a second account in the same process, use your own retry budget, or as an async context manager.

How this compares

Library Async Shape
PyGithub no typed objects
githubkit yes Pydantic models, generated from GitHub's OpenAPI spec
gidgethub yes sans-I/O, bring-your-own HTTP client
ghapi (fast.ai) no OpenAPI-generated, dynamic attribute access
asyncgh yes plain dicts, ~550 lines

githubkit gives you typed responses and full API coverage, at the cost of codegen'd models and a pydantic dependency. gidgethub is closest in spirit -- sans-I/O, no models -- but leaves auth, retry, and the client itself to the caller. asyncgh picks a specific point in that space: an async client with almost no code between you and the wire, no generated models or schema (you read GitHub's own docs and index the JSON), retry and GraphQL built in rather than bolted on.

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 client's lifetime. gh must be installed and logged in -- or pass GitHubClient(token=...) to skip the gh dependency entirely and use your own.

Retries

api_raw 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. max_retries (default from GH_MAX_RETRIES, else 3) caps the retries per GitHubClient instance; 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() retries the same cases (transport errors, 429/5xx) plus one more, in the same single retry loop: GitHub answers GraphQL rate limiting with HTTP 200 and an errors[].type == "RATE_LIMITED" body, invisible to a status-based retry. Any other GraphQL error (bad query, not found) is not transient and raises immediately, with the failing error's type on GhError.error_type.

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_raw/ api_json/pagination; digest.py (wrapped by ../digest-action/) is the one driving graphql().

Metadata

Release files for asyncgh 0.3.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 asyncgh 0.3.2
File Size Uploaded
asyncgh-0.3.2.tar.gz 13.8 kB Details

Built distribution (wheel)

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

Total release size: 25.1 kB

Release files / asyncgh-0.3.2.tar.gz

Download URL asyncgh-0.3.2.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
879f1a4dc18dbcf5febd3c70ed081c39916ca7bd0d2fed6e169a4624dd2bac92
BLAKE2b-256 checksum
How to use checksums
210364f098a6311f398c77879bd1ccb7dace25ce788a4b24147aaa8dea2677ff
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.3.2-py3-none-any.whl

Download URL asyncgh-0.3.2-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9a190835dbb73aca10f6bb601ba45fa90607c8a27daa6dbf1122e584f8752b7
BLAKE2b-256 checksum
How to use checksums
2a5044bda565b62c9bcaa2e26210bdd4bbdbbd049c903ccca32b0a99bb8dae57
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

This release

0.3.2 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

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