bazel-contrib / bazel-contrib/rules_python
FR: add PyInfo.direct_imports
- 主要语言
- Starlark
- 星标
- 688
- 派生
- 721
- 平均合并
- 15 小时 7 分钟
- 30 天内合并 PR
- 76
描述
Currently, the PyInfo's imports field returns all imports paths defined in a target, combined with the ones from its transitive dependencies, as defined here
There's no way to retrieve the direct import paths. It would be useful for IDE support, where we typically read data about a large number of targets and dependencies between them. In that case, we pessimistically would end up in n^2 import entries when reading that, because of depset expansion.
Alternatively IDEs could read just direct_imports and deps fields, and map them to their internal graph. Full transitive imports could still be resolved on demand, based on deps
What underlying problem are you trying to solve with this feature?
Avoid depset flattening when reading both imports and deps from PyInfo, according to https://bazel.build/rules/performance#avoid-depset-to-list
(originally from https://github.com/bazelbuild/bazel/issues/20449 by @tpasternak )
贡献指南
调研方向
首先定位 PyInfo provider 以及现有的 imports 和 deps 字段,然后阅读链接的 Bazel 指南,了解如何避免 depset-to-list 转换。完成的标准是:在不展平传递依赖的情况下暴露直接导入路径,同时保留现有的传递 imports 行为;issue 中没有指定具体文件或测试。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- build-system
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100