- 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
A custom runtime can be specified by setting the `HERMETIC_PYTHON_URL`, which
may point to a mostly arbitrary URL, i.e. one not following the same format
as python-build-standalone URLs, such e.g. `file:///__w/jax/jax/python-tsan.tgz`.
Internally, some rules_python code assumes the python-build-standalone URL
format and eventually errors.
To fix, the python version is used to determine the URL build suffix.
This also patches the rule_python versions URL generation logic to add musl
to the list of platforms it generates freethreaded runtime urls for.
Work around for https://github.com/bazel-contrib/rules_python/issues/3285, https://github.com/bazel-contrib/rules_python/issues/3286
PiperOrigin-RevId: 810132685