bazel-contrib / bazel-contrib/rules_python

Override a requirement with a Bazel target

未关闭
#385 15 条评论 14 个 reaction 已指派 0 人 在 GitHub 查看
type: feature request
主要语言
Starlark
星标
688
派生
721
平均合并
15 小时 7 分钟
30 天内合并 PR
76

描述

# 🚀 feature request

### Relevant Rules

`load("@rules_python//python:pip.bzl", "pip_install")`

### Description

We'd like to be able to override a `requirement` with a Bazel target. This is basically the `rules_python` equivalent of `rules_jvm_external`'s [`override_targets` directive](https://github.com/bazelbuild/rules_jvm_external#overriding-generated-targets).

Consider the case where we're using grpc and protobuf from Bazel, and an external python library depends on `protobuf==3.13.0` (or whatever). I'd like to replace that dependency with `"@com_google_protobuf//:protobuf_python"` instead, so I'm not mixing pypi and Bazel versions of `protobuf`.

### Describe the solution you'd like

I like the way that `rules_jvm_external` has done it.

### Describe alternatives you've considered

ø

贡献指南

打开贡献指南

调研方向

Start with the pip_install rule described in the issue and compare its dependency handling with rules_jvm_external's override_targets directive. The change is done when a Python requirement can be replaced by the specified Bazel target without mixing the corresponding PyPI and Bazel dependencies.

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
build-system
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。