Conversation
|
f537878 to
ba2de0e
Compare
| "_helper": attr.label(allow_single_file = True, default = Label(":build_helper.py")), | ||
| }, | ||
| toolchains = [ | ||
| # TODO: Py toolchain needs to be in the `host` configuration, not the |
There was a problem hiding this comment.
why host? That feels like almost always the wrong thing?
| def _transition_to_target_impl(settings, attr): | ||
| return { | ||
| # String conversion is needed to prevent a crash with Bazel 6.x. | ||
| "//command_line_option:extra_execution_platforms": [ |
There was a problem hiding this comment.
uhhh this is super sketch. Is it possible to use exec_compatible_with constraints to guide it to a platform matching the target instead?


As https://peps.python.org/pep-0720/ explains in frustrating detail, there isn't currently a good way to do crossbuilds from one Python platform to another. While many relevant compiled languages (C, Rust, Fortran) can support crossbuilding, the only really sound thing to do is to let
python3 -m builddo its thing on the target.So we need to adapt the
sdist_buildrepository rule so that the underlyingsdist_buildrule is transitioned so that the execution platform matches the target platform.However we don't want to transition all sdist builds to the target, since most[^1] Python libraries are purelib and doing so would force users of the
uvmachinery to deploy RBE when they don't strictly need to do so. As a temporary measure, extend the annotations file schema so that individual requirements can be opted into being built on the target.In the future, we likely want to distribute a standard "database" of such annotations so that users don't have to, and/or adapt the
sdist_buildrepository rule to use a hermetic tar to unzip the downloaded sdist at repo configuration time and check the sdist content for obvious signs of containing C, Cython, Rust or Fortran code.[^1] Citation needed
Changes are visible to end-users: yes
The
uvextension now allows for requirements to be opted into platform-dependent builds in support of native extensions.Test plan
TBD