| commit | 1b85ec8f89fb8968349cbc1c6354e88d5bb493fb | [log] [tgz] |
|---|---|---|
| author | Richard Levasseur <richardlev@gmail.com> | Sun Nov 23 07:51:19 2025 -0800 |
| committer | GitHub <noreply@github.com> | Sun Nov 23 15:51:19 2025 +0000 |
| tree | 8e8448b79aae0dd91847657c5179d24b856721e9 | |
| parent | 5bc7ba363a81da9c6cb03058bc3741b3ec84a5d3 [diff] |
fix: add runfiles root for system_python bootstrap (#3423) When the system_bootstrap code was changed to using the site init for adding to sys.path, importing `bazel_tools.tools.python.runfiles` stopped working. This is because the runfiles root was no longer being added to sys.path. This is somewhat WAI because: 1. Always adding the runfiles root to sys.path is a deprecated legacy behavior because it can interfere with Python imports (a repo name can mask a legitimate import). 2. Under bzlmod, repo directory names aren't importable Python names, so having the runfiles root on sys.path doesn't do much. An exception to (2) is bazel_tools: this is special cased to use the directory name `bazel_tools` in runfiles. This is where the legacy runfiles library for Python is. In any case, forgetting the runfiles root on sys.path for the system_python bootstrap was an oversight, as the intention was to be a more no-op refactoring. Fixes https://github.com/bazel-contrib/rules_python/issues/3422 --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This repository is the home of the core Python rules -- py_library, py_binary, py_test, py_proto_library, and related symbols that provide the basis for Python support in Bazel. It also contains package installation rules for integrating with PyPI and other indices.
Documentation for rules_python is at https://rules-python.readthedocs.io and in the Bazel Build Encyclopedia.
Examples live in the examples directory.
The core rules are stable. Their implementation is subject to Bazel's backward compatibility policy. This repository aims to follow semantic versioning.
The Bazel community maintains this repository. Neither Google nor the Bazel team provides support for the code. However, this repository is part of the test suite used to vet new Bazel releases. See How to contribute page for information on our development workflow.
For detailed documentation, see https://rules-python.readthedocs.io
See Bzlmod support for more details.