Start from a clean checkout at main.
Before running through the release it's good to run the build and the tests locally, and make sure CI is passing. You can also test-drive the commit in an existing Bazel workspace to sanity check functionality.
Releases are managed using a semi-automated process centered around a GitHub Release Tracking Issue and automated workflows triggered by comments or issue edits.
[!NOTE] Comment-based commands must be posted by project maintainers (Owner, Member, or Collaborator) and must be on their own line (leading and trailing whitespace is ignored).
Prepare the Release: Run the Release: Prepare workflow manually. You can trigger it from the GitHub Actions UI or using the GitHub CLI:
gh workflow run release_prepare.yaml --repo bazel-contrib/rules_python
This will automatically determine the next version, create a release tracking issue, and send a preparation PR.
Approve and Merge: Approve and merge the PR. Once merged, a release branch will be created automatically.
Add Backports (if needed): If there are backports, add them following the How to add backports steps.
Create an RC: Comment /create-rc on the tracking issue. This will automatically process pending backports before creating the RC. If any backport fails, the RC creation will abort.
Iterate: Repeat steps 3 and 4 until backports and RCs are no longer needed.
Finalize the Release: Comment /promote on the tracking issue to finalize the release.
The release workflow can be manually triggered using the GitHub CLI (gh). This is useful for re-running a release or for creating a release from a specific commit.
To trigger the workflow, use the gh workflow run command:
gh workflow run release_publish.yaml --ref <TAG>
By default, the workflow will publish the wheel to PyPI. To skip this step, you can set the publish_to_pypi input to false:
gh workflow run release_publish.yaml --ref <TAG> -f publish_to_pypi=false
If PyPI publishing failed or was skipped during the main release, the PyPI publishing workflow can be triggered manually using the GitHub CLI (gh) or via the GitHub Actions UI:
gh workflow run publish_pypi.yaml --ref <TAG> -f tag_name=<TAG>
rules_python uses semantic version, so releases with API changes and new features bump the minor, and those with only bug fixes and other minor changes bump the patch digit.
The release tool will automatically determine the next version number based on the VERSION_NEXT_* placeholders in the codebase. To see what changes are being accumulated for the next release, review the pending news entries in the news/ directory.
To add backports to an active release, you can use one of the following methods:
Comment /backport on the PR you wish to backport. This will automatically add the PR to the active release's backports checklist. Once the PR is merged, the backports will be automatically processed.
[!NOTE] Commenting
/backporton an open PR will block further release publishing (like creating RCs or promoting) until the PR is merged or manually set to status=ignore in the checklist.
Comment /add-backports <PR_REF> [<PR_REF> ...] (space or comma separated) on the tracking issue. The <PR_REF> can be a PR number (optionally prefixed with #) or a PR URL (strictly for the configured repository). This will automatically add the PRs to the checklist and trigger processing.
## Backports section of the Release Tracking Issue. The format must be: - [ ] #<PR_NUMBER> (e.g., - [ ] #1234)./process-backports on the tracking issue to trigger processing.You can use the release tool to add backports from your local checkout:
bazel run //tools/private/release -- add-backports <PR_REF> [<PR_REF> ...]
The <PR_REF> can be:
124 or #124)https://github.com/bazel-contrib/rules_python/pull/124 or https://github.com/bazel-contrib/rules_python/pull/124/files)If a backport fails to process (e.g., due to cherry-pick conflicts):
status=error-<reason>.status=done metadata.If you need to backport a PR to multiple older active release branches (e.g., backporting a fix to 1.7, 1.8, and 1.9 when the latest release is 2.2.0), you can automate the creation of release tracking issues and verification of cherry-picks using a Backport Tracking Issue.
Create a Backport Tracking Issue: Create a new issue on GitHub with the label type: backport-pr.
Backport: #1234 (referencing the PR to backport).* PR: #1234 * From version: 1.7 * To version: 2.2This tells the tool to target all active release branches between
release/1.7 and release/2.2 inclusive.Prepare the Backports: Trigger the preparation by commenting /prepare on the backport tracking issue, or by manually running the Backport: Prepare workflow with the issue number.
Verify apply <minor_version>: Automatically checked if the cherry-pick succeeded, or left unchecked with status=failed-conflict or status=failed-changelog if it failed.Release issue <next_version>: A task to initiate the release for each target version.Resolve Conflicts (if any): If any Verify apply task failed:
Verify apply task box on the tracking issue and set its metadata to status=success (e.g., - [x] Verify apply 1.8 | status=success).Initiate Releases: Once all Verify apply tasks are successful (either automatically or after manual resolution), comment /create-releases on the backport tracking issue, or manually run the Backport: Create Releases workflow.
Release 1.7.1, Release 1.8.1, etc.).Tag RC tasks automatically removed, as release candidates are not required for patch releases.Execute Releases: Follow the standard release process for each created release tracking issue. Since these are patch releases, you can skip the /create-rc step and comment /promote directly to tag and publish the release from the release branch head.
If a patch release from head would contain changes that aren't appropriate for a patch release, then the patch release needs to be based on the original release tag and the patch changes cherry-picked into it.
In this example, release 0.37.0 is being patched to create release 0.37.1. The fix being included is commit deadbeef.
git checkout release/0.37git cherry-pick -x deadbeefgit cherry-pick --continue (if applicable)git push upstreamIf multiple commits need to be applied, repeat the git cherry-pick step for each.
Once the release branch is in the desired state, comment /create-rc on the tracking issue to tag it, as done with a release from head.
We announce releases in the #python channel in the Bazel slack (bazelbuild.slack.com). Here's a template:
Greetings Pythonistas, rules_python X.Y.Z-rcN is now available Changelog: https://rules-python.readthedocs.io/en/X.Y.Z-rcN/changelog.html#vX-Y-Z It will be promoted to stable next week, pending feedback.
It's traditional to include notable changes from the changelog, but not required.
Re-releasing a version (i.e. changing the commit a tag points to) is sometimes possible, but it depends on how far into the release process it got.
The two points of no return are:
If release steps fail prior to those steps, then its OK to change the tag. You may need to manually delete the GitHub release.
You can manually edit the Release Tracking Issue to control the release flow. The checklist items use metadata suffix: | key=value key2=value2.
- [ ] Prepare Release | status=awaiting-preparation.- [x] and add appropriate metadata (e.g. status=done).Part of the release process uploads packages to PyPI as the user rules-python. This account is managed by rickeylev. Note that Google also has recovery access and can be contacted at rules-python-pypi@google.com if something needs to be done with the PyPI account.