Imported from GitHub PR https://github.com/tensorflow/tensorflow/pull/102891
See #62598.
Add basic bzlmod support on Linux x86 CPU. Most of the incompatibilities have been resolved.
Running tests with:
```
env TFCI=py311,linux_x86,rbe,bzlmod,no_docker ci/official/pycpp.sh
```
should pass except for those in tensorflow/tools/pip_package
A known issue is with building the wheels. The issues are two fold:
1. In particular, in WORKSPACE setup an old version of pybind11_abseil is used. I can't find a version of pybind11_abseil with bzlmod support that works.
The reason is that TensorFlow implicitly requires the `ImportStatusModule(bypass_regular_import = true)` which is not supported in latest version of pybind11_abseil.
2. The wheel building script packages some headers and python modules from external repos (XLA, TSL, local_config_cuda). Under bzlmod they will be in a different path.
pcloudy@ suggested some tricks to handle this for a single directory by passing the path as environment variable, but considering many are used for building wheels, we should find a better way.
Reasons for duplicating the patches on absl/grpc: bzlmod does not support applying patches across module boundary.
Copybara import of the project:
--
99f6ec365e83b2a188399e050ac67865888e91c2 by Yicheng Luo <ethanluoyc@gmail.com>:
Support bzlmod
Merging this change closes#102891
COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/tensorflow/pull/102891 from ethanluoyc:bzlmod aa56a78ea1adce56262937ee79bcf61db530ba05
PiperOrigin-RevId: 885201845