Repository navigation
fix: transition --stamp only for the build data dependency - #4484
Merged
rickeylev merged 1 commit intoNov 12, 2026
Merged
Conversation
The `stamp` attribute of `py_binary` and `py_test` transitions the `--stamp` flag for the whole target. `py_test` defaults to `stamp = 0`, so under `--stamp` every test builds its entire dependency tree in a second configuration, apart from the binaries that share those dependencies. The transition exists so that the `_uncachable_version_file` dependency is conditional on stamping. Move it onto that attribute edge. The edge sets `--stamp` only for `stamp = 1`. With `stamp = 0` the file is never read, and `stamp = -1` follows the flag, so neither changes the configuration. `is_stamping_enabled()` already reads the attribute directly, so the build data contents are unchanged. In a downstream repo that builds with `--stamp`, analyzing one `py_binary` and its `py_test` dropped from 633 to 448 configured targets. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
|
This PR was prepared with Claude Code, an AI coding agent, on behalf of the author. Claude Code may draft replies to review comments and follow-up commits. The author reviews and approves each one before it is posted or pushed. Agent-generated comment (Claude Code, Claude Opus 5.5), reviewed and approved by the author. |
rickeylev
approved these changes
Nov 12, 2026
rickeylev
left a comment
Collaborator
There was a problem hiding this comment.
Ohhh, good find. Thanks!
rickeylev
enabled auto-merge
November 12, 2026 17:49
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 12, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 12, 2026
Merged
via the queue into
bazel-contrib:main
with commit Nov 12, 2026
288b004
22 of 23 checks passed
Contributor
|
Created release tracking issue #4499 (Release 2.5.1) with this PR added to the backports checklist. |
github-actions Bot
pushed a commit
that referenced
this pull request
Nov 13, 2026
The `stamp` attribute of `py_binary` and `py_test` transitions the `--stamp` flag for the whole target. `py_test` defaults to `stamp = 0`, so under `--stamp` every test builds its entire dependency tree in a second configuration, apart from the binaries that share those dependencies. The transition exists so that the `_uncachable_version_file` dependency is conditional on stamping. Move it onto that attribute edge. The edge sets `--stamp` only for `stamp = 1`. With `stamp = 0` the file is never read, and `stamp = -1` follows the flag, so neither changes the configuration. `is_stamping_enabled()` already reads the attribute directly, so the build data contents are unchanged. Co-authored-by: Claude <noreply@anthropic.com> (cherry picked from commit 288b004) Work towards #4499
rickeylev
pushed a commit
to rickeylev/rules_python
that referenced
this pull request
Nov 13, 2026
Updates CHANGELOG.md and removes news files for backports: - bazel-contrib#4484 Work towards bazel-contrib#4499 Release-Tracking-Issue: bazel-contrib#4499 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
stampattribute ofpy_binaryandpy_testtransitions the--stampflag for the whole target.py_testdefaults tostamp = 0, so under--stampevery test builds its entire dependency tree in a second configuration, apart from the binaries that share those dependencies.The transition exists so that the
_uncachable_version_filedependency is conditional on stamping. Move it onto that attribute edge. The edge sets--stamponly forstamp = 1. Withstamp = 0the file is never read, andstamp = -1follows the flag, so neither changes the configuration.is_stamping_enabled()already reads the attribute directly, so the build data contents are unchanged.