Publishing to PyPI¶
Quick reference for publishing repo-ctx and repo-ctx-agent to pypi.org.
One-time Setup¶
Create API tokens at https://pypi.org/manage/account/token/ (one per project recommended).
Configure ~/.pypirc:
Or pass the token per upload:
repo-ctx (Automated via GitHub Actions)¶
Publishing is automated. When you bump the version in pyproject.toml and push to main, the GitHub Action workflow handles everything:
- Detects the version change
- Builds the package
- Publishes to PyPI
- Creates a git tag (
v0.9.0) - Creates a GitHub Release with changelog
Release Steps¶
# 1. Bump version in pyproject.toml
# version = "0.9.0"
# 2. Commit and push
git add pyproject.toml
git commit -m "release: v0.9.0"
git push origin main
# 3. Monitor at: https://github.com/repo-ctx/repo-ctx/actions
The workflow skips if the tag already exists (safe to push other pyproject.toml changes).
Manual Trigger¶
You can also trigger the workflow manually from the Actions tab (workflow_dispatch).
repo-ctx-agent (Manual)¶
cd /home/os/development/repo_ctx_agent
# 1. Bump version in pyproject.toml
# 2. Clean, build, upload
rm -rf dist/ build/ *.egg-info
python -m build
twine check dist/*
twine upload dist/*
# 3. Verify
pip install repo-ctx-agent==0.1.1
Test PyPI (dry run)¶
twine upload --repository testpypi dist/*
pip install --index-url https://test.pypi.org/simple/ repo-ctx
Checklist¶
- [ ] Version bumped in pyproject.toml
- [ ] All tests pass
- [ ] For repo-ctx: push to main (automated)
- [ ] For repo-ctx-agent:
python -m build && twine upload dist/* - [ ] Verify install:
pip install <package>==<version>