bazel-contrib / bazel-contrib/rules_python
Add a new python comment annotation that adds targets to `data`
- Lenguaje dominante
- Starlark
- Estrellas
- 688
- Forks
- 721
- Merge medio
- 15 h 7 min
- PR fusionados (30 d)
- 76
Descripción
# 🚀 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.
Guía de contribución
Línea de trabajo
Comienza leyendo el issue relacionado #1862 y la implementación de Gazelle para las anotaciones existentes en comentarios de Python. Sigue cómo afectan las anotaciones a los targets generados y, a continuación, añade el manejo correspondiente de `# gazelle:include_data` para que el atributo `data` contenga el label solicitado sin generar el target. Se considera terminado cuando el ejemplo produce la salida `py_test` mostrada y el comportamiento existente permanece intacto.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- build-system, tooling
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100