Releasing¶
A release is a version bump, a tag, and one automated workflow. PyPI is published with trusted publishing: GitHub proves its identity to PyPI, so no API token is stored anywhere.
Where things stand¶
qmatbridgeis on PyPI: 0.1.0 was published by hand on 2026-06-04, and later releases (0.2.0, 0.2.1) with this workflow. Versions cannot be re-uploaded, so the next release must be higher than the latest.- The PyPI and TestPyPI trusted publishers are registered and both have been exercised.
- TestPyPI's
0.1.0was used by the dry run, so a dry run of a later version needs that version to be unused there (for example0.3.0rc1).
One-time setup¶
- PyPI trusted publisher. On pypi.org open the
qmatbridgeproject → Manage → Publishing → add a GitHub publisher with: ownerq-matsuite, repositoryqmatbridge, workflowrelease.yml, environmentpypi. - TestPyPI (optional dry run). On test.pypi.org → Account → Publishing, add a pending
publisher for project
qmatbridgewith the same owner, repository and workflow, environmenttestpypi. - GitHub environments. In the repository: Settings → Environments, create
pypiandtestpypi. Forpypi, add yourself as a required reviewer, so no tag can publish to PyPI without your explicit approval. - Zenodo DOI (optional). Sign in at zenodo.org with GitHub, open GitHub settings, grant
access to the
q-matsuiteorganisation if asked, and switchq-matsuite/qmatbridgeon. Every GitHub release is then archived and gets a DOI.
Cutting a release¶
- Make sure
mainis green, including the nightly live tests (see workflows). - In one pull request:
- set
versioninpyproject.toml; - rename
## [Unreleased]inCHANGELOG.mdto## [X.Y.Z] — date, add a fresh empty## [Unreleased]above it, and update the compare links at the bottom; - update
versionanddate-releasedinCITATION.cffand the version in the README BibTeX. - Optional dry run: Actions → Release → Run workflow. This builds, checks and publishes to TestPyPI only.
- After the pull request merges, tag the merge commit and push the tag:
git checkout main && git pull
git tag vX.Y.Z
git push origin vX.Y.Z
- The workflow then: verifies the tag equals the
pyproject.tomlversion, builds the sdist and wheel, runstwine check, installs the wheel in a clean environment as a smoke test, waits for your approval of thepypienvironment, publishes to PyPI, and creates a GitHub release whose notes are the matchingCHANGELOG.mdsection. - Verify in a fresh virtual environment:
pip install --no-cache-dir "qmatbridge==X.Y.Z"
python -c "import qmatbridge; print(qmatbridge.__version__)"
- Zenodo archives the release automatically.
CITATION.cffand the README badge use the concept DOI (10.5281/zenodo.23192772), which always resolves to the latest version, so no per-release edit is needed. Each release also gets its own version DOI, shown on its Zenodo record; cite that one when you need to point at an exact version.
If something goes wrong¶
- Tag does not match the version: the first job fails before anything is published. Fix the
version, delete the tag (
git push --delete origin vX.Y.Z), and retag. - Published a bad version: PyPI cannot overwrite files. Yank the release on pypi.org and publish a higher version.
- Trusted publishing is rejected: the publisher's owner, repository, workflow file name and environment must match exactly what is configured on PyPI.