Switch to trusted publishing for package upload to PyPI in CI
@avdivan is already working on this.
Since Jun 18, 2025.
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 1k
- Avg merge
- 22h 17m
- Merged PRs (30d)
- 3
Description
Trusted publishing (with attestations) means I can know for certain that what I download from PyPI is the same artefact which was generated in GitHub CI, meaning that what I see in GitHub is the same as what is installed - handy for auditing (rather than having to manually review all of the installed files on each release).
See the Python packaging documentation, the PyPI documentation, and the official pypi-publish GitHub action documentation on trusted publishing - you'll need to configure an environment in PyPI and GitHub. You will be able to remove the OPENCV_CONTRIB_PYTHON_PASSWORD project secret.
Should be as simple as switching to the pypa/gh-action-pypi-publish action (instead of twine upload ..., setting skip-existing: true) in the "Upload wheels" steps of the Release jobs of all the workflows, and adding environment and permissions to those jobs.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.