bazel-contrib / bazel-contrib/rules_python

Expose `sysconfig` variables in `PyRuntimeInfo` provider

Offen
#2,631 3 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

# 🚀 feature request

Downstream rules are potentially interested in the selected toolchains configuration.
Specifically, building C extension modules depends on things like `EXT_SUFFIX` to create proper extensions supporting the chosen interpreter.
Because that suffix ends up in file names, downstream rules may need that value at configure time, when they can't query the interpreter.
But the `@rules_python` `repository_rule` can easily determine these variables before configure time, for each registered toolchain.

This is related to:
- https://github.com/bazelbuild/rules_python/issues/824
- https://github.com/nicholasjng/nanobind-bazel/issues/61
- I'm sure other downstream bazel tooling related to C extensions would like this as-well

### Relevant Rules

This feature would ultimately need changes to:
- `PyRuntimeInfo` (basic schema)
- `py_runtime` (so that third party toolchains/interpreters can provide that information too)
- the internal pluming providing the `@rules_python` provided internal toolchains

### Description

`PyRuntimeInfo` needs a field `ext_suffix`, or alternatively `sysconfig_variables` (for future extension).
At extension instantiation time, when setting up the toolchain repos, the respective interpreters should be queried for their `ext_suffix`; alternatively, that information could be determined offline.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginnen Sie mit dem PyRuntimeInfo-Schema und der in diesem Issue genannten py_runtime-Regel und verfolgen Sie anschließend die Einrichtung des internen Toolchain-Repositorys, über die registrierte Interpreter bereitgestellt werden. Lesen Sie zur Einordnung die Issues #824 und nanobind-bazel#61; abgeschlossen ist die Aufgabe, wenn sysconfig-Daten wie ext_suffix für nachgelagerte Regeln verfügbar sind und von Toolchains von Drittanbietern bereitgestellt werden können.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

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

Neue Issues direkt in Ihr Postfach

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