bazel-contrib / bazel-contrib/rules_python

Emit RunfilesGroupInfo in py_binary targets

Đang mở
#3,757 18 bình luận 0 reaction 0 người được giao Xem trên GitHub
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

I want `py_binary` to return an additional provider, [`RunfilesGroupInfo`](https://github.com/hermeticbuild/rules_runfiles_group).
`py_library` could contribute by also returning this provider, but that's more of an implementation detail.

I'd be open to work on this if you agree that this is a good idea.

### Description

I'd like to make packaging of `py_binary` targets in container images more efficient. To that end, I have designed a set of providers and described their semantics in [a new Bazel module](https://github.com/hermeticbuild/rules_runfiles_group).

### Describe the solution you'd like

`py_library` targets should forward `RunfilesGroupInfo` and `RunfilesGroupMetadataInfo` from their deps and add their own runfiles (`srcs`, `data`) to a group.
`py_binary` targets should aggregate runfiles groups from their deps and emit `RunfilesGroupInfo` and `RunfilesGroupMetadataInfo` that contain at least:

* A group for the interpreter + standard library
* One group per third party dependency

Additionally, it could also make sense to produce groups for each `py_library` target in the transitive dependency graph.

### Describe alternatives you've considered

Doing nothing would mean we continue creating (very large) container image layers that contain the full runfiles tree of a `py_binary` target.

Writing custom packaging rules just for rules_python is unsustainable in my opinion.

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 đọc các triển khai quy tắc py_library và py_binary cùng ngữ nghĩa của provider trong mô-đun Bazel rules_runfiles_group được liên kết. Xác định cách các dependency được chuyển tiếp và tổng hợp, sau đó xác minh rằng py_binary phát ra các nhóm cho trình thông dịch và thư viện chuẩn, cùng với các dependency của bên thứ ba, với các bài kiểm thử bao quát các provider và metadata được yêu cầu.

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ó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/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.