bazel-contrib / bazel-contrib/rules_python

Generate one Bazel repo per dependency

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

説明

# 🚀 feature request

### Relevant Rules

`pip.parse()` module extension

### Description

When the same pip package is (transitively) depended upon multiple times from different `requirements.txt` files, it is undefined which version will be chosen (both are added to the PYTHONPATH and the order of deps decides which one takes precedence).
This is especially problematic for transitive dependencies of module dependencies where one only has limited to no influence of which version is chosen. This is especially problematic for fundamental libraries like Protobuf which gets pulled in transitively in many `requirements.txt`.
The way this is handled in golang, is that every dependency is its own Bazel repo and as such takes part in version resolution. This makes sure that every package only exists once within a given Bazel workspace.

### Describe the solution you'd like

Generate one Bazel repo per pip dependency.

### Describe alternatives you've considered

For the transition period, `rules_python` could generate both, one repo for all of `requirements.txt` and one repo per dependency. This way, users can easily migrate from one approach to another. In a future major version, the old functionality could be removed.

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

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

調査の方向性

Start with the `pip.parse()` module extension and trace how multiple `requirements.txt` files become repositories and PYTHONPATH entries. Compare the current all-dependencies repository model with the requested per-dependency model, including the proposed transition period; done means each pip dependency has its own Bazel repository and version selection is no longer determined by dependency order.

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

評価

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

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

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