PyPI Trusted Publishing Handoff
Audience: repository maintainer with admin access to GitHub repo settings and PyPI project settings.
Purpose: complete the manual configuration required for Python package release automation (.github/workflows/release.yml).
Manual setup checklist
1) PyPI project setup
- Create or claim the
anolis-workbenchproject on PyPI. - Confirm the project name matches
pyproject.tomlexactly:name = "anolis-workbench". - Confirm at least one owner/maintainer account is assigned.
2) Configure PyPI trusted publisher (OIDC)
In PyPI project settings, add a trusted publisher with:
- Owner:
anolishq - Repository:
anolis-workbench - Workflow name:
release.yml - Environment name:
pypi
Notes:
- No API token is required when trusted publishing is configured correctly.
- Publish will fail with an OIDC error until this step is complete.
3) Configure GitHub environment
In GitHub repo settings, create environment pypi:
- Name:
pypi - Optional protection rules:
- required reviewers
- branch restrictions
- No PyPI token secret should be added for trusted publishing.
4) Create/update uv.lock
uv.lock is expected by CI/release cache settings.
Run locally in repo root:
bash
uv lockThen commit and push uv.lock.
Fallback if uv is not yet installed locally:
bash
python -m pip install uv
uv lock5) First release dry run
Before publishing a production version:
- Bump
pyproject.tomlversion and push tomain. - Open Actions →
Releaseworkflow. - Run
workflow_dispatchwith matchingversion. - Confirm sequence:
- validate passes
- CI gate passes
- build artifacts created
- PyPI publish succeeds
- tag + GitHub release created
Common failure modes
Version mismatch:- Input version does not match
pyproject.toml.
- Input version does not match
Tag already exists:- Version was already released/tagged.
- PyPI OIDC rejection:
- trusted publisher repo/workflow/environment mismatch.
- Missing
uv.lock:- cache config references lock file not committed yet.
Operational notes
- Release workflow is intentionally
workflow_dispatchonly. - Public GitHub release is created only after successful PyPI publish.
- Clean-install smoke checks should be run post-release:
bash
python -m venv /tmp/smoke-venv
/tmp/smoke-venv/bin/pip install anolis-workbench
/tmp/smoke-venv/bin/anolis-workbench --help
/tmp/smoke-venv/bin/anolis-package --help
/tmp/smoke-venv/bin/anolis-validate --help