Skip to content

Conversation

mai93
Copy link
Contributor

@mai93 mai93 commented Oct 10, 2025

Add starlark flags for --python_path, --build_python_zip and --incompatible_default_to_explicit_init_py.

  • The transitions logic is updated to set both the native and starlark versions of the flags to allow alternating between them until the native ones are removed.
  • --build_python_zip is changed to boolean instead of Tristate with default value set to True on windows and False otherwise.
  • scope = universal attribute is added to the starlark flags so they can be propagated to exec config on Bazel 9. This required upgrading bazel_skylib version to have scope attribute defined.

Work towards: #3252

cc @gregestren

@mai93 mai93 marked this pull request as ready for review October 10, 2025 19:16
Copy link
Collaborator

@dougthor42 dougthor42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One gazelle-specific comment, otherwise the Gazelle stuff LGTM.

I'll leave final approval to Richard or Aignas

Copy link
Collaborator

@aignas aignas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a note in Changes section of the changelog to note that bazel_skylib has been upgraded to 1.8.2? See the previous mentions for bazel_skylib for an example.

@aignas aignas mentioned this pull request Oct 11, 2025
10 tasks
Copy link
Collaborator

@rickeylev rickeylev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

impl mostly looks good, though the logic for checking python_path i'm not sure of. Various nits about project-local styles.

@rickeylev
Copy link
Collaborator

@gemini-code-assist /review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request continues the effort to migrate native Python flags to Starlark flags, which is a great improvement for the maintainability and future-proofing of rules_python. The changes introduce Starlark flags for --python_path, --build_python_zip, and --incompatible_default_to_explicit_init_py, and correctly update the transition logic to support both native and Starlark versions during the migration period. The upgrade of bazel_skylib to support the scope = universal attribute is also a necessary and well-executed change.

The implementation is solid and covers all the required aspects, including updating tests and examples. I have a couple of minor suggestions to improve the usability of the new flags by adding help text and making an error message more descriptive. Overall, this is a high-quality contribution.

@rickeylev rickeylev enabled auto-merge (squash) October 15, 2025 17:57
@rickeylev rickeylev disabled auto-merge October 15, 2025 18:04
@rickeylev rickeylev merged commit 7cf098e into bazel-contrib:main Oct 15, 2025
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants