Skip to content

refactor(exec_tools): hoist py_exec_tools_toolchain from rules_python, drop min version to 1.0.0#913

Merged
gregmagolan merged 2 commits into
mainfrom
hoist_py_exec_toolchain
Apr 5, 2026
Merged

refactor(exec_tools): hoist py_exec_tools_toolchain from rules_python, drop min version to 1.0.0#913
gregmagolan merged 2 commits into
mainfrom
hoist_py_exec_toolchain

Conversation

@gregmagolan
Copy link
Copy Markdown
Member

@gregmagolan gregmagolan commented Apr 5, 2026

Summary

#903 bumped the minimum rules_python version from 1.0.0 to 1.9.0 to gain access to PyExecToolsInfo.exec_runtime (added in rules_python 1.9.0) and loaded py_exec_tools_toolchain from rules_python's private API. This PR reverses the version bump by hoisting the necessary code into rules_py and removes all imports from rules_python/private.

Changes

New py/private/exec_tools/defs.bzl — hoisted from rules_python:

  • PyExecToolsInfo provider with only an exec_runtime field. We own the provider so we can include exec_runtime (the field added in 1.9.0) regardless of which rules_python version the user has.
  • py_exec_tools_toolchain rule — instantiated in each PBS interpreter repo; derives exec_runtime from exec_interpreter[ToolchainInfo].py3_runtime (the pre-1.9.0 equivalent).
  • current_interpreter_executable rule — resolves PY_TOOLCHAIN to create an exec-configured interpreter symlink; defaults for the above rule.

py/private/toolchain/BUILD.bazel — added exec_tools_toolchain_type toolchain type. We declare our own type rather than reusing @rules_python//python:exec_tools_toolchain_type, so our PyExecToolsInfo never needs to satisfy rules_python's internal interface (e.g. the precompiler field that maybe_precompile checks for).

py/private/toolchain/types.bzlEXEC_TOOLS_TOOLCHAIN now points to @aspect_rules_py//py/private/toolchain:exec_tools_toolchain_type.

py/private/interpreter/repository.bzl — generated interpreter BUILD files now load py_exec_tools_toolchain from @aspect_rules_py//py/private/exec_tools:defs.bzl and register under our own toolchain type instead of @rules_python//python:exec_tools_toolchain_type.

uv/private/whl_install/rule.bzlEXEC_TOOLS_TOOLCHAIN now loaded from our own types.bzl.

MODULE.bazel / e2e/MODULE.bazelrules_python and rules_python_gazelle_plugin dropped back to 1.0.0.

@gregmagolan gregmagolan requested a review from jbedard April 5, 2026 21:46
@gregmagolan gregmagolan force-pushed the hoist_py_exec_toolchain branch from a0fa9cb to 396b640 Compare April 5, 2026 22:08
@aspect-workflows
Copy link
Copy Markdown

aspect-workflows Bot commented Apr 5, 2026

Bazel 8 (Test)

All tests were cache hits

111 tests (100.0%) were fully cached saving 53s.


Bazel 9 (Test)

All tests were cache hits

111 tests (100.0%) were fully cached saving 1m 20s.


Bazel 8 (Test)

e2e

All tests were cache hits

51 tests (100.0%) were fully cached saving 55s.


Bazel 9 (Test)

e2e

All tests were cache hits

51 tests (100.0%) were fully cached saving 43s.


Bazel 8 (Test)

examples/uv_pip_compile

All tests were cache hits

1 test (100.0%) was fully cached saving 444ms.

@gregmagolan gregmagolan force-pushed the hoist_py_exec_toolchain branch 3 times, most recently from 486cc59 to 0194a3d Compare April 5, 2026 22:34
…, drop min version to 1.0.0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gregmagolan gregmagolan force-pushed the hoist_py_exec_toolchain branch from 0194a3d to 38d049a Compare April 5, 2026 22:36
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@gregmagolan gregmagolan merged commit 0ef96a0 into main Apr 5, 2026
1 of 2 checks passed
@gregmagolan gregmagolan deleted the hoist_py_exec_toolchain branch April 5, 2026 22:45
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