Skip to content

feat: make Python version project scoping opt-in - #4377

Open
Spikhalskiy wants to merge 6 commits into
bazel-contrib:mainfrom
Spikhalskiy:codex/python-project-scope
Open

Spikhalskiy wants to merge 6 commits into
bazel-contrib:mainfrom
Spikhalskiy:codex/python-project-scope

Conversation

@Spikhalskiy

@Spikhalskiy Spikhalskiy commented Oct 28, 2026 •

Copy link
Copy Markdown

Python version transitions also reach native dependencies that don't use Python, so a C++ or Rust library under bindings for several Python versions is configured once per version. Add a root-module config.python_version_scope(scope = "project") tag that gives //python/config_settings:python_version Bazel's project scope. Ownership is delegated to the consumer's //:PROJECT.scl through an actual alias, so targets outside it see the command-line version and share one configuration. Universal scope stays the default, and tags from dependency modules are ignored.

Project scope requires Bazel 9.2 or later, the first release that keeps project-scoped flags across exec transitions (bazelbuild/bazel#28320). Owned exec tools such as the precompiler keep the selected version, which preserves the requirement behind #4335. Older Bazel versions fail with an explicit error.

aspect_rules_py terminals set this flag as well as their own; the matching opt-in there is aspect-build/rules_py#1650.

An integration test covers target and exec propagation, convergence of the native dependency's configuration, the unchanged default, and ignored dependency-module tags.

Fixes #4375

Copilot AI balanced review requested due to automatic review settings October 28, 2026 17:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@Spikhalskiy

Copy link
Copy Markdown
Author

I used an AI coding agent for the implementation and local review, with semi-autonomous execution under my design and scope direction. I will review and approve any AI-assisted responses before they are posted; there is no automatic review-reply bot.

This branch has not been deployed

No deployments
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.

Support consumer-configured project scoping for python_version

3 participants