bazel-contrib / bazel-contrib/rules_python
pip.override in upstream modules but got "overrides are only supported in root modules"
- 主要言語
- Starlark
- スター
- 688
- フォーク
- 721
- 平均マージ
- 15時間 7分
- マージ済み PR(30日)
- 76
説明
# 🐞 bug report
### Affected Rule
The issue is caused by the rule: https://github.com/bazelbuild/rules_python/blob/66a8b5b595710bd107c31ad5d449593536effb76/python/private/pypi/extension.bzl#L404
### Is this a regression?
No
### Description
I'm migrating from WORKSPACE to bzlmod.
There is a library `A`, in which it has patches like
```
pip.override(
file = "torch-2.3.0-cp311-cp311-manylinux1_x86_64.whl",
patch_strip = 1,
patches = [
# FIXME: https://github.com/pytorch/pytorch/issues/117350
"//bazel/patches:pytorch.patch",
"//bazel/patches:pytorch_record.patch",
],
)
```
And I have another project `B`, which depends on A, however after adding deps like
`bazel_dep(name = "A", version = "x.y.z")`
I got the error
```
ERROR: /xxxx/df5a01bdd2671083bb14bf68b19a3f38/external/rules_python~/python/private/pypi/extension.bzl:406:21: Traceback (most recent call last):
File "/xx/.cache/bazel/xxxxx/df5a01bdd2671083bb14bf68b19a3f38/external/rules_python~/python/private/pypi/extension.bzl", line 406, column 21, in _pip_impl
fail("overrides are only supported in root modules")
Error in fail: overrides are only supported in root modules
ERROR: Analysis of target '//xxx' failed; build aborted: error evaluating module extension pip in @@rules_python~//python/extensions:pip.bzl
```
## 🔬 Minimal Reproduction
## 🔥 Exception or Error
## 🌍 Your Environment
**Operating System:**
Ubuntu 24.04.1 LTS
**Output of `bazel version`:**
7.4.1
**Rules_python version:**
0.34.0
**Anything else relevant?**
コントリビューションガイド
調査の方向性
python/private/pypi/extension.bzl の 404-406 行付近から始めます。ここでは、upstream モジュール内の pip.override が報告された失敗を引き起こします。Bazel 7.4.1 と rules_python 0.34.0 を使用し、ライブラリ A とプロジェクト B で WORKSPACE から bzlmod への移行を再現します。依存関係のシナリオが解決されるか、サポート対象の制限事項が明確に文書化されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- build-system
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 32/100