Follow the steps in this document to release a new version of matplotlylib.
- The
versionfield inpyproject.tomlsets the package version. Update that field for each release. The release tag is the same version with avprefix, for examplev0.2.0for version0.2.0. - The
publish-pypiworkflow builds the package, uploads it to PyPI with trusted publishing (OIDC), and then creates the GitHub release. A maintainer starts the workflow by hand. PyPI trusts the workflow itself, so no API token is necessary.
- Create a release branch titled
release-vX.Y.Z- We try to follow semantic versioning guidelines as much as possible
- Update the version:
- Set
versioninpyproject.tomltoX.Y.Z - PyPI never accepts a version number twice, even after you delete a release. Thus, each release needs a new version.
- Set
- Update the changelog:
- Review the items in
CHANGELOG.mdunder the "Unreleased" header. We try to follow the keepachangelog guidelines. - Put each item under the matching subheader:
### Added,### Changed,### Deprecated,### Removed,### Fixed, or### Security - Make sure that all items follow this format:
- Description of change [[#XXXX](https://github.com/plotly/matplotlylib/pull/XXXX)]- ...followed by
with thanks to @username for the contribution!if the PR is from a community contributor
- Add any missing items for PRs that merged since the last release
- Leave out PRs that do not change the built package, for example a README change or a minor dependency upgrade
- Add a header
## [X.Y.Z] - YYYY-MM-DDabove the unreleased items, under## Unreleased. Leave## Unreleasedin place, with nothing under it. - The
publish-pypiworkflow copies this section into the GitHub release notes. The second word of the header must be exactly the version in brackets, without thevprefix of the tag. If it is not, the workflow stops before it creates the release. - Commit and push the
pyproject.tomlandCHANGELOG.mdupdates
- Review the items in
- Open a PR into
main. Wait for the tests to pass, get approval, and then merge intomain. - On your local machine, check out
main, pull, and tag the merge commit of the release branch with the version number:git checkout main git pull git tag vX.Y.Z git push origin vX.Y.Z - Release on PyPI and GitHub:
- Open the Actions tab and select
publish-pypi - Select "Run workflow". Leave the branch at
main, enter the tag (for examplevX.Y.Z), and start the run. - The
buildjob makes sure that the tag exists and points to a commit onmain. Then the job builds the package and makes sure that the built version matches the tag. If the version inpyproject.tomldoes not match the tag, the job stops before anything reaches PyPI. - Open the run and approve the deployment under "Review deployments". The
pypienvironment needs a review from theplotly/libraries_adminteam. - The
pypi-publishjob uploads the files from thebuildjob. The upload usesskip-existing, so a second run of the same tag skips the files that PyPI holds already. - After the upload, the
github-releasejob creates the GitHub release for the tag. The job uses the tag as the title and the matchingCHANGELOG.mdsection as the notes. The job attaches the same.whland.tar.gzfiles that went to PyPI. A tag that containsrcbecomes a pre-release. - If the release exists already, the job keeps the existing notes and uploads only the files that the release does not hold yet. Thus, you can run the workflow again after a partial failure.
- Open the Actions tab and select
- Confirm the release:
- Open the PyPI project page to make sure that the new package version is available
- Open the GitHub release page and make sure that the release has the correct notes and two attached files
- If everything looks correct, the release is complete