bazel-contrib / bazel-contrib/rules_python
Add a new python comment annotation that adds targets to `data`
- 主要言語
- Starlark
- スター
- 688
- フォーク
- 721
- 平均マージ
- 15時間 7分
- マージ済み PR(30日)
- 76
説明
# 🚀 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.
コントリビューションガイド
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- build-system, tooling
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100