bazel-contrib / bazel-contrib/rules_python

Support python_version on modules_mapping and/or gazelle_manifest rule

Aperta
#3,120 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub
gazelle
Lingua principale
Starlark
Stelle
688
Fork
721
Merge medio
15h 7m
PR unite (30g)
76

Descrizione

# 🚀 feature request

### Relevant Rules

* [gazelle_python_manifest](https://github.com/bazel-contrib/rules_python/blob/main/gazelle/manifest/defs.bzl)
* [modules_mapping](https://github.com/bazel-contrib/rules_python/blob/main/gazelle/modules_mapping/def.bzl)

### Description

When in the middle of working on a Python version upgrade, it's valuable to generate gazelle manifests with different module maps because you the requirements.in may include additional requirements for the new python version:

```
gradio; python_version >= "3.11"
```

When running the manifest rule with all_whl_requirements, it'll fail with something like:
> No matching wheel for current configuration's Python version.

In order to get the desired behavior, we need to run the gazelle manifest update by specifying a different python version via command line `--@rules_python//python/config_settings:python_version=3.11`.

### Describe the solution you'd like

Adding a `python_version attribute to the manifest or modules_mapping rule, so that we can run it with the expected python_version as needed without a command-line flag.

### Describe alternatives you've considered

We currently customize our scripts so that we add the command line flag, but I don't think this is feasible.

Other alternatives:
* Generate a modules mapping per different environment tag satisfied in the requirements.in . This might be heavy-handed, but could work for all other environment markers beyond python_version . And there's no need to maintain multiple manifest files.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start with gazelle/manifest/defs.bzl and gazelle/modules_mapping/def.bzl, then review how the manifest rule uses all_whl_requirements and the command-line python_version setting. Done means either rule accepts the requested Python version and generates the matching manifest or module map without the command-line flag, with behavior covering version-conditioned requirements.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
build-system
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.