Before you start
- Use a disposable TestPyPI project you can administer and a GitLab.com project. PyPI trusted publishing requires GitLab.com for this workflow.
- Have the repository namespace, project name and top-level pipeline file. If you use a release environment, use its exact name in both the publisher settings and job.
- Check GitLab availability
- Check PyPI availability
Data and access
Who does what
Register the publisher on TestPyPI
Add a trusted publisher in the TestPyPI project settings. Register the GitLab namespace, project name and top-level pipeline file, plus the release environment if the job uses one.
Check. TestPyPI’s project settings list the namespace, project and pipeline file from your test run, plus the environment if configured.
Run the publishing job
Follow PyPI’s GitLab workflow instructions with TestPyPI as the target. Review who can change the pipeline and trigger the publishing job.
Check. The publishing job completes against TestPyPI. The job and pipeline link identify the intended test revision.
Verify the package version
Check that TestPyPI shows the expected version and that the job ran for the intended commit. Review the configuration before applying the same controls to the production project.
Check. The test registry lists the exact version produced by that revision. Open the version page instead of relying on the pipeline status alone.
Check your result
PyPI documents this GitLab publisher for GitLab.com projects. Keep the publishing identity separate from any KeySigner approval used by a maintainer.
If you get stuck
TestPyPI rejects the publishing identity
Confirm that the TestPyPI publisher names the GitLab.com namespace, project, top-level pipeline file and environment that ran. Check that the job requested an identity token for the target registry.