bazel-contrib / bazel-contrib/rules_python

pip.override in upstream modules but got "overrides are only supported in root modules"

Aperta
#2,513 3 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
Starlark
Stelle
688
Fork
721
Merge medio
15h 7m
PR unite (30g)
76

Descrizione

# 🐞 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?**

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start at python/private/pypi/extension.bzl around lines 404-406, where pip.override in an upstream module triggers the reported failure. Reproduce the WORKSPACE-to-bzlmod migration with library A and project B using Bazel 7.4.1 and rules_python 0.34.0. Done means the dependency scenario is resolved or the supported limitation is clearly documented.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
build-system
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
32/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.