fix(whl_install): use exec-configured interpreter for pyc compilation#881
Merged
fix(whl_install): use exec-configured interpreter for pyc compilation#881
Conversation
whl_install's compile_pyc uses `py_toolchain.interpreter` which is resolved in target configuration. In cross-arch builds, the target interpreter is not runnable on the build host. Add a `resolved_py_toolchain` rule (analogous to `resolved_unpack_toolchain`) that re-exports the Python toolchain, and reference it via `cfg="exec"` so compileall gets a host-runnable interpreter. This is safe because .pyc bytecode depends on Python version, not architecture. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
5820ab8 to
7965f5f
Compare
arrdem
added a commit
that referenced
this pull request
Mar 20, 2026
…#880) > **Stacked on #881** — merge that first. Takes over #618. The PEX builder previously required a target-configured Python interpreter, which fails in cross-arch builds since the target interpreter isn't runnable on the build host. The fix removes the `--python` argument entirely — `PEXBuilder(interpreter=None)` works because rules_py already controls dependency resolution hermetically; PEX doesn't need to probe the interpreter for platform compatibility. Also adds cross-arch `build_test` targets validating PEX builds for both `linux_arm64` and `linux_amd64` via `platform_transition_filegroup`. Closes #618. ### Changes are visible to end-users: yes - Searched for relevant documentation and updated as needed: no - Breaking change (forces users to change their own code or config): no - Suggested release notes appear below: yes `py_pex_binary` now supports cross-architecture builds (e.g. building an arm64 PEX on an x86 host). ### Test plan - New cross-arch `build_test` targets added - Existing `py-pex-binary` e2e tests pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Peter Lobsinger <peter@tecton.ai>
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.

When
compile_pycis enabled,whl_installinvokescompileallusingpy_toolchain.interpreterwhich is resolved in target configuration. In cross-arch builds (e.g. x86 host building for arm64), the target interpreter isn't runnable on the build host, causing the action to fail.This adds a
resolved_py_toolchainrule (following the existingresolved_unpack_toolchainpattern) and references it viacfg="exec"so compileall gets a host-runnable interpreter. This is safe because.pycbytecode depends on Python version, not architecture.Changes are visible to end-users: no
Test plan
🤖 Generated with Claude Code