refactor(toolchain): replace resolved_venv_toolchain with venv_exec_toolchain_type#911
Merged
gregmagolan merged 12 commits intomainfrom Apr 6, 2026
Merged
refactor(toolchain): replace resolved_venv_toolchain with venv_exec_toolchain_type#911gregmagolan merged 12 commits intomainfrom
gregmagolan merged 12 commits intomainfrom
Conversation
|
|
|
jbedard
reviewed
Apr 5, 2026
jbedard
reviewed
Apr 5, 2026
jbedard
approved these changes
Apr 5, 2026
55d2c29 to
1286ed6
Compare
…oolchain_type Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
e40a2ec to
675e6f5
Compare
656eb9f to
2747426
Compare
495f3de to
70e3062
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
6e4e7d5 to
895ddd6
Compare
a6406f6 to
1450218
Compare
10dd601 to
4b325ba
Compare
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.

Summary
resolved_venv_toolchainwas a workaround: a regulardepwithcfg = "exec"used to pull the venv binary into exec config for the build action inpy_venv.bzl. This PR replaces it with a proper toolchain type, and takes the opportunity to clean up the overall toolchain design.Changes
PrebuiltToolConfigredesign —cfgis now mandatory and accepts"target","exec", or"both". Tools withcfg = "both"(likevenv) register under two toolchain types from a single downloaded binary:target_compatible_withfor runfiles (runs on the user's machine) andexec_compatible_withfor build actions (runs on the exec host). The struct exposestoolchain_typeandexec_toolchain_typefields derived fromcfg; callers no longer pass types explicitly.TOOL_CFGSsimplified —venv_execentry removed;venvnow carriescfg = "both". The separatepy/private/toolchain/venv_exec/directory is gone.source_toolchainsimplified — takes onlynameandbin; derives everything else fromTOOL_CFGS. Creates{name}_tool/{name}_source_toolchainfor target-cfg tools and{name}_exec_tool/{name}_exec_source_toolchainfor exec-cfg tools.Toolchain type renames for consistency:
unpack_toolchain_type→unpack_exec_toolchain_typetarget_exec_toolchain_type→native_build_toolchain_type(self-documenting: forces exec platform to match target for native wheel builds)TARGET_EXEC_TOOLCHAIN→NATIVE_BUILD_TOOLCHAINNew —
VENV_EXEC_TOOLCHAINconstant andvenv_exec_toolchain_typetoolchain type for the exec-cfg venv binary used bypy_venvbuild actions.py_venv.bzl— replacesctx.attr._venv(private dep withcfg = "exec") withctx.toolchains[VENV_EXEC_TOOLCHAIN]. Removesresolved_venv_toolchainrule and target entirely.repo.bzl—_toolchains_repo_implemitstarget_compatible_withorexec_compatible_withtoolchain declarations based on which types are present, with no string-interpolatedcfgvalues._prebuilt_tool_repo_impldownloads once per tool regardless of how many toolchain types it serves.