bazel-contrib / bazel-contrib/rules_python

Allow py_wheel to use analysis phase information for attributes

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

説明

# 🚀 feature request

### Relevant Rules

`py_wheel`

### Description

When building a wheel with `py_wheel`, some attributes are closely tied to the Python runtime the wheel is intended for. For example, building a wheel with a C extension can require a `python_tag` value that has the python version as part of the abi tag.

Because e.g. `py_wheel.python_tag` takes a string, the only way to pass a value is to use a select() expression to map some condition to a raw string. This is tedious, to say the least. It's also problematic for constructing the `cp39` string -- there's no flag that captures the runtime implementation name ("cp"), so creating a select for this is tough (though, still possible with some tricks, see below).

I _think_ a workaround here is to combine toolchain lookup with FeatureFlagInfo. Have a custom rule look up the toolchain and return e.g. implementation_name in FeatureFlagInfo. Have a config_setting map that to true/false. Have a select() expression map the config setting to e.g. "cp39". Complicated and verbose, but I think it would work.

### Describe the solution you'd like

It'd be better if py_wheel either inferred the values from the toolchain, or provided a way to feed analysis phase information in for value.

The loose idea I have is to have an label attribute that accepts e.g. PyWheelInfo provider, and then users can populate that with what they choose. We'd provide a default impl that did the common thing.

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

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

調査の方向性

py_wheel ルールから始め、python_tag と、ここで説明されている分析フェーズのツールチェーン情報に焦点を当てます。推論と PyWheelInfo 入力のどちらがランタイムから導出される属性をより適切にサポートするかを判断します。完了の条件は、ユーザーが現在の冗長な select() ワークアラウンドなしで、実装/バージョンタグなどの値を指定できることです。

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

評価

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

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

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