4 Commits
Author SHA1 Message Date
Peter Hawkins 2cc70fff1e Bump rules_python to v2.2.0.
PiperOrigin-RevId: 962699045
2026-08-11 04:29:20 -07:00
Ezekiel Calubaquib 0fa15d76e6 Update rules_python to latest 1.8.4 for tensorflow and xla. Doing so would enable us to use latest feature which includes a venv layout. This latest version also introduce stricter hermeticity which was first introduce in 1.7.0 as seen in logs:
- https://rules-python.readthedocs.io/en/latest/changelog.html#v1-7.0 (see sys.path order change and bootstraping)
- pipstar flag default has been flipped to be on by default. It can be disabled through RULES_PYTHON_ENABLE_PIPSTAR=0 environment variable

1. Replace native bazel py_binary/py_library rules with rules_python's py_binary and py_library to selected BUILD files affected with updated to avoid %interpreter% error
2. Export PYTHONPATH build_pip_package.py
3. Add new commit sha and version for rules_python 1.8.4. Rules_python 1.8.4 added "scope" params to bool_flag and string_flag which is incompatible with bazel 7.7.0 used by TF, for now we can patch it
5. add flags RULES_PYTHON_ENABLE_PIPSTAR=0
6. Update patches for rules_python

NOTE: below are important

7. Due to rules_python 1.8.4 not differentiating between freethread and non-freethread see: https://github.com/bazel-contrib/rules_python/blob/1.8.4/python/private/pypi/pip_repository.bzl#L111 we need to inject --abi and cp<version>t to --extra_pip_args for rules_python to download specific packages used for freethreaded if HERMETIC_PYTHON_VERSION=<version>-ft is used.

8. Update the _get_injected_local_wheels custom rule to inject a --find-links rather than <package_name> @ <local prefix> as rules_python 1.8.4 seems to drop the package causing it to not find the wheels

PiperOrigin-RevId: 878583333
2026-03-04 11:30:20 -08:00
A. Unique TensorFlower 94e89d1103 Fix freethreaded builds by passing HERMETIC_PYTHON_VERSION_KIND in repository rules.
The problem was that `@python_<>_host` repository wasn't aware of the python type (controlled by the build flag `@rules_python//python/config_settings:py_freethreaded`) and selected the first candidate, e.g. GIL version of the python.

PiperOrigin-RevId: 808825370
2025-09-18 18:54:36 -07:00
A. Unique TensorFlower 3eae65361b Update rules_python to v1.6 in XLA and TensorFlow projects.
`com_google_protobuf` and `rules_cc` initialization was moved to `python_init_rules` macros.

The JAX repository update will be done [in the next step](https://github.com/jax-ml/jax/pull/31709)

PiperOrigin-RevId: 808689003
2025-09-18 12:30:45 -07:00