Publishing to PyPI¶
Index · Publishing Docker Images · Publishing to Artifactory
Overview¶
testo-core is published to PyPI via GitHub Actions using trusted publishing (OIDC). No API tokens are stored in repository secrets.
Prerequisites¶
- PyPI account: register at https://pypi.org (2FA is required to publish). There is no Test PyPI step: the build, metadata and clean-install checks run before the upload instead.
- Pending trusted publisher on PyPI, which reserves the name before the first upload: account menu → "Publishing" → "Add a new pending publisher" → GitHub, with
- PyPI project name:
testo-core - Owner:
taltal-beep - Repository:
testosterone(renamed fromunified-quality-orchestration-reporting-dashboard; a publisher registered under the old name must be updated) - Workflow:
publish.yml - Environment:
pypi - GitHub environment: create
pypiunder the repository's Settings → Environments. Adding yourself as a required reviewer makes the upload wait for a click.
Publishing flow¶
- Create a GitHub Release with a semver tag matching
pyproject.toml(e.g.v1.1.1forversion = "1.1.1"). - The
publish.ymlworkflow triggers automatically. Its one job waits for thepypienvironment's reviewer, then checks out the tag, builds, checks the tag matches the package version, runstwine check --strict, installs the wheel with no extras and runs a cycle (scripts/package_smoke.sh), publishes withpypa/gh-action-pypi-publishover OIDC (no API token), and verifiespip install. - To publish an existing tag whose automatic run failed (for example after fixing the trusted publisher), run the workflow by hand from the Actions tab with that tag as input. PyPI refuses a version that was already uploaded.
- The same Release also triggers
docker-publish.yml(runner image to GHCR; the first push creates a private package, so set its visibility to public once) andartifactory-publish.yml(skipped whileARTIFACTORY_URLis unset).
The package job in ci.yml runs the build and clean-install check on every pull request, so a release should not be the first time they run.
Current state¶
Version 1.1.1 is the first release meant for PyPI; 1.1.0 was never published and its wheel crashed on testo run without the [db] extra (see CHANGELOG.md). It is on PyPI since 2026-10-19 (https://pypi.org/project/testo-core/). The v1.1.1 Release's automatic run stopped at the old Test PyPI step, so 1.1.1 was uploaded with a manual run of the workflow. The moving v1 tag the GitHub Action docs refer to (CI-CD Pipeline Setup § Versioning policy) is moved by move-major-tag.yml on each stable release.
Version management¶
- Version is set in
pyproject.tomlunder[project] version. - Bump version before creating the release tag.
- The release tag should match the version (e.g.
v1.0.0→version = "1.0.0").
Verifying a release¶
pip install testo-core==1.1.1
testo --version
testo run --help
Troubleshooting¶
- OIDC auth failure: Verify trusted publisher configuration matches the workflow filename and GitHub environment name exactly.
- Tag does not match: the job stops when the tag (minus its
v) differs from[project] version. Fix the version or the tag and create a new Release. twine checkfailure: Checkpyproject.tomlfor missing metadata fields (description,readme,requires-python).- Version conflict: PyPI does not allow re-uploading the same version. Bump the version and create a new release.
Related¶
- CI-CD Pipeline Setup — CI workflow overview
- Workflow file:
.github/workflows/publish.yml