bazel-contrib / bazel-contrib/rules_python

Emit RunfilesGroupInfo in py_binary targets

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

説明

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

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

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

調査の方向性

Start by reading the py_library and py_binary rule implementations and the provider semantics in the linked rules_runfiles_group Bazel module. Define how dependencies are forwarded and aggregated, then verify that py_binary emits groups for the interpreter and standard library plus third-party dependencies, with tests covering the requested providers and metadata.

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

評価

技術スタック
python
領域
build-system
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

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

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