bazel-contrib / bazel-contrib/rules_python

Allow to specific python_version in gazelle generated py_binary and py_test rules

オープン
#2,749 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る
gazelle type: feature request
主要言語
Starlark
スター
688
フォーク
721
平均マージ
15時間 7分
マージ済み PR(30日)
76

説明

# 🚀 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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、生成される py_binary ルールと py_test ルールに関する Gazelle の Python 生成およびディレクティブ処理のエントリポイントを特定します。既存のディレクティブが生成される属性にどのように影響するかを確認し、その後、python_version ディレクティブによって、手動で編集せずに両方のルール種別に要求された属性が生成されることを検証します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
build-system
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。