bazel-contrib / bazel-contrib/rules_python

Allow to specific python_version in gazelle generated py_binary and py_test rules

Đang mở
#2,749 2 bình luận 1 reaction 0 người được giao Xem trên GitHub
gazelle type: feature request
Ngôn ngữ chính
Starlark
Star
688
Fork
721
Merge trung bình
15 giờ 7 phút
Pull request đã merge (30 ngày)
76

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách xác định các điểm vào của quá trình tạo mã Python của Gazelle và xử lý chỉ thị cho các rule py_binary và py_test được tạo. Xem xét cách các chỉ thị hiện có ảnh hưởng đến các thuộc tính được tạo, sau đó xác minh rằng một chỉ thị python_version tạo ra thuộc tính được yêu cầu cho cả hai loại rule mà không cần chỉnh sửa thủ công.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
build-system
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.