Registry / http-networking / PyGithub

PyGithub

JSON →
library2.8.1pypypi✓ verified 36d ago

Community-maintained Python library for GitHub REST API v3. Current version is 2.8.1 (Feb 2026). Note: package name on PyPI is 'PyGithub' (capital P and G) but imports as 'github' (lowercase). Not an official GitHub SDK.

http-networkingdevopscrm-productivity
Install & Compatibility
Where this runs
tested against v2.9.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.925 runs
installs and imports cleanly · install 0.0s · import 0.988s · 45.8MB
glibc
py 3.103.925 runs
installs and imports cleanly · install 3.5s · import 0.898s · 46MB
45MB installed
● package 45MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Package installs as PyGithub but imports as github. import PyGithub raises ModuleNotFoundError.

from github import Github, Auth

Minimal authenticated GitHub API call using PyGithub 2.x auth pattern.

from github import Github, Auth auth = Auth.Token("your_token") g = Github(auth=auth) repo = g.get_repo("owner/repo") for issue in repo.get_issues(state='open'): print(issue.title) g.close()
Debug
Known footguns
breakingGithub(login_or_token='token') is the old 1.x pattern. In 2.x use Auth.Token() and pass via auth= argument.
breakingCommit.files used to return list[File], now returns PaginatedList[File]. len(commit.files) raises TypeError.
breakingrepo.compare().commits used to return list[Commit], now returns PaginatedList[Commit]. len() raises TypeError.
breakingdatetime objects returned by the API are now timezone-aware (UTC). Comparing with naive datetime instances breaks.
gotchapip install name is PyGithub (capital P, G) but the import is 'from github import Github'. The casing mismatch trips up agents constantly.
gotchag.close() must be called after use to close the underlying connection pool. Omitting causes ResourceWarning in tests.
gotchaPullRequest.create_review_comment argument renamed from position= to line=. Keyword callers break silently.
gotchaThis is a community SDK, not an official GitHub product. GitHub has no official Python SDK. Agents often assume otherwise.
breakingThe provided GitHub token is invalid, expired, or lacks the necessary permissions (e.g., 'public_repo' for public repos, 'repo' for private). This results in a BadCredentialsException.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
61 hits · last 30 days
petalbot
17
bytedance
6
claudebot
5
gptbot
4
ahrefsbot
3
Resources