rules_python icon indicating copy to clipboard operation
rules_python copied to clipboard

Make MODULE.bazel.lock file have the same contents no matter the platform bazel is executed on

Open aignas opened this issue 2 years ago • 0 comments

This is a ticket to tidy up and do feature work to ensure that the pip bzlmod extension can generate a lock file that is os,arch independent. The rough list of steps that we need to take are:

  • Create a host toolchain that can be passed to the python_interpreter_target. We need to ensure that the label that is passed to the whl_library repo rule is the same no matter the platform.
  • Introduce a way to handle multiple requirements files and generate the wheel repositories similar to how it is done in #1625.
  • Remove the requirement file selection based on the host platform and instead generate the repos for all available requirement files. Because the platform specific requirements files may have different versions of packages, we have to go all the way through and go with the approach outlined in #1625 in the general case to be fully correct.

To make the pip extension more maintainable we might also need to have:

  • config_setting values for (pyXY, os, cpu) triples so that we can more easily create the required aliases in the hub repository.
  • Making the dependency resolution aware of the python abi.

The above would make the number of layers of indirection fewer and hopefully make it easier to extend the code in general.

~This general work may be related fix some aspects of #310 for bzlmod.~

Original issue that spurred a feature on bazel itself: https://github.com/bazelbuild/bazel/issues/19154. The motivation for restarting the effort is the fact that maintaining a lock file that has os,arch specific sections is hard and requires updating the lock file by running bazel on a number of platforms and this just does not scale in the long term.

aignas avatar Dec 21 '23 00:12 aignas