bazel-contrib / bazel-contrib/rules_python
Add a new python comment annotation that adds targets to `data`
- Lingua principale
- Starlark
- Stelle
- 688
- Fork
- 721
- Merge medio
- 15h 7m
- PR unite (30g)
- 76
Descrizione
# 🚀 feature request
### Relevant Rules
+ gazelle
### Description
This is the same as #1862, but for the `data` attribute on generated targets.
### Describe the solution you'd like
```python
# foo/bar/baz_test.py
import pathlib
# gazelle:include_data //foo/bar:test_data
TEST_DATA_DIR = pathlib.Path(__file__).parent / "test_data"
def test_main():
assert TEST_DATA_DIR.exists()
```
Running Gazelle generates:
```starlark
py_test(
name = "baz_test",
srcs = ["baz_test.py"],
data = ["//foo/bar:test_data"],
)
```
Note that Gazelle does _**not**_ generate the `test_data` target - it's still on the user to do that themselves.
### Describe alternatives you've considered
The current method is to manually add `data` attributes.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Start by reading the related issue #1862 and the Gazelle implementation for existing Python comment annotations. Trace how annotations affect generated targets, then add the corresponding handling for `# gazelle:include_data` so the `data` attribute contains the requested label without generating the target. Done means the example produces the shown `py_test` output and existing behavior remains intact.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- build-system, tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100