bazel-contrib / bazel-contrib/rules_python

py_runtime does not consume root_symlinks from the interpreter attr (hermetic toolchain)

Offen
#3,564 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Starlark
Sterne
688
Forks
721
Ø Merge
15 Std. 7 Min.
Gemergte PRs (30 T.)
76

Beschreibung

# 🐞 bug report

### Affected Rule

`py_runtime` is affected.

For example
```starlark
py_runtime(
name = "hermetic_runtime",
files = ["extracted_toolchain"],
interpreter = "extracted_toolchain",
interpreter_version_info = {
"major": "3",
"minor": "9",
"micro": "21",
},
python_version = "PY3",
visibility = ["//BazArTest/py_toolchain:__pkg__"],
)
```

### Is this a regression?

No. It was discovered when upgrading to bazel 9.0.0, however, because `@bazel_tools//tools/bash/runfiles` is now an alias that uses `root_symlinks`.

### Description

The `py_runtime` `interpreter` from the example makes use of `runfiles.bash`, but if it is only present in the `Runfiles.root_symlinks` of `interpreter` / `files`, then it does not exist in the runfiles directory when executing python actions.

You can see here:
https://github.com/bazel-contrib/rules_python/blob/393dcfd194615ab4d3393d29145842c186597e0e/python/private/py_runtime_rule.bzl#L54-L58

that it does not consider the `root_symlinks` in the `interpreter` runfiles.

## 🔬 Minimal Reproduction

It is pretty involved, so I'm hoping the description makes the issue readily apparent. I can work on a reproducer if that is not the case.

## 🌍 Your Environment

**Operating System:**

  

AlmaLinux 9.7 (Moss Jungle Cat)

**Output of `bazel version`:**

  

Bazelisk version: v1.26.0
INFO: Invocation ID: decd4a2d-e400-43ca-8558-5e818e7da8d1
Build label: 9.0.0
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Tue Jan 20 18:16:47 2026 (1768933007)
Build timestamp: 1768933007
Build timestamp as int: 1768933007

**Rules_python version:**

  

bazel_dep(name = "rules_python", version = "1.7.0")

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start in python/private/py_runtime_rule.bzl at lines 54-58, where the issue reports that the interpreter's runfiles are handled. Trace how the interpreter and files contribute runfiles, including root_symlinks, and verify that a hermetic py_runtime exposes those links when Python actions execute; the issue does not name a test or reproducer.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
build-system
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.