bazel-contrib / bazel-contrib/rules_python

Allow to specific python_version in gazelle generated py_binary and py_test rules

Aperta
#2,749 2 commenti 1 reazione 0 assegnatari Vedi su GitHub
gazelle type: feature request
Lingua principale
Starlark
Stelle
688
Fork
721
Merge medio
15h 7m
PR unite (30g)
76

Descrizione

# 🚀 feature request

### Relevant Rules

### Description

Currently I am using bazel and gazelle to manage a mono repo with multiple python projects.

Some of them using python 3.10 and others are using python 3.11.

When using gazelle with rules_python, I need to manually append `python_version=3.11` to generated py_test rule.

For example

```bazel
# generated by gazelle

py_test(
name = "test_module_a",
srcs = ["module-a/tests/test_module_a.py"],
python_version = "3.11", # manually edit line
deps = [
"//module-a/src/module_a"
],
)
```

### Describe the solution you'd like

We should have a new directive such as `gazelle:python_version` to allow user to override `python_version` attribute in generated `py_test` and `py_binary` rules.

### Describe alternatives you've considered

Gemini also suggested to use a `build_arg` to override default generated rules but it doesn't work.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start by locating the Gazelle Python generation and directive-handling entry points for generated py_binary and py_test rules. Review how existing directives affect generated attributes, then verify that a python_version directive produces the requested attribute for both rule types without manual edits.

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
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.