Releasing point-collocation to PyPI
This document describes how to publish a new version of point-collocation to
PyPI using the automated
GitHub Actions workflow.
Overview
Publishing is fully automated via .github/workflows/publish.yml.
The workflow uses PyPI Trusted Publishing (OIDC) so no API tokens need to
be stored in GitHub Secrets — authentication happens through a short-lived
OIDC token issued by GitHub Actions.
The workflow is triggered whenever a GitHub Release is published.
Step 1 — Bump the version
Edit pyproject.toml and update the version field under [project]:
Commit the change directly to main (or open a PR and merge it first):
Step 2 — Create and push a git tag
Tags must match the version in pyproject.toml and follow the vX.Y.Z format:
Step 3 — Create a GitHub Release
- Open the repository on GitHub.
- Click Releases → Draft a new release.
- Select the tag you just pushed (
v0.2.0). - Fill in the Release title and Release notes.
- Click Publish release.
Publishing the release triggers the workflow automatically.
What the workflow does
- Build — Runs
python -m buildto produce an sdist (.tar.gz) and a wheel (.whl) inside thedist/directory. - Smoke check — Installs the built wheel and runs
import point_collocationto confirm the package is importable. - Publish — Uploads both artifacts to PyPI via
pypa/gh-action-pypi-publishusing Trusted Publishing (no stored token required).
One-time PyPI setup (Trusted Publishing)
Before the workflow can publish for the first time you need to register GitHub as a trusted publisher on PyPI:
- Log in to https://pypi.org and navigate to the
point-collocationproject page (or create the project by uploading a first release manually). - Go to Manage → Settings → Trusted Publishers.
- Click Add a new publisher and fill in:
| Field | Value |
|---|---|
| Owner / organisation | fish-pace |
| Repository name | point-collocation |
| Workflow file name | publish.yml |
| Environment name | (leave blank) |
- Save.
From that point on, every GitHub Release will trigger a fully automated, token-free publish.
Troubleshooting
403 Forbidden — trusted publisher not configured
The PyPI trusted publisher has not been set up yet, or the workflow filename /
repo name does not match what was registered.
Fix: complete the one-time setup described above.
400 File already exists — version already on PyPI
PyPI does not allow re-uploading a version.
Fix: bump the version in pyproject.toml, commit, re-tag, and create a
new GitHub Release.
Metadata validation errors
PyPI rejects packages with missing or invalid metadata.
Fix: check pyproject.toml for required fields (name, version,
requires-python, readme, license) and run python -m build locally to
verify before tagging.
Smoke check fails
The wheel is not importable — likely a packaging misconfiguration.
Fix: confirm [tool.hatch.build.targets.wheel].packages in
pyproject.toml points to ["src/point_collocation"] and run
pip install dist/*.whl && python -c "import point_collocation" locally.