bazel-contrib / bazel-contrib/rules_python
importlib.metadata.files() doesn't work because RECORD is missing
- 主要语言
- Starlark
- 星标
- 688
- 派生
- 721
- 平均合并
- 15 小时 7 分钟
- 30 天内合并 PR
- 76
描述
It appears that `importlib.metadata.files()` is broken with the pypi integration because the RECORD file gets ommited.
Per docs at https://docs.python.org/3/library/importlib.metadata.html#distribution-files
> In the case where the metadata file listing files (RECORD or SOURCES.txt) is missing, files() will return
This came to my attention via @mering trying to use the rtree package, which tries to use its distribution metadata to find some C libraries to load.
Excluding RECORD seems somewhat intentional, though? The code has this comment:
https://github.com/bazel-contrib/rules_python/blob/main/python/private/pypi/whl_library_targets.bzl#L315-L318
> RECORD is known to contain sha256 checksums of files which might include the checksums
> of generated files produced when wheels are installed. The file is ignored to avoid
> Bazel caching issues.
What's the caching issue, exactly? For a downloaded whl, what generated files is it referring to? If a whl is built at repo time from an sdist, then files shouldn't be changing, and the hash should be stable, so how does a cache issue come up?
贡献指南
调研方向
先从 python/private/pypi/whl_library_targets.bzl 中约第 315-318 行附近关于省略 RECORD 的注释开始,然后将其与 importlib.metadata.files() 文档以及此处描述的 rtree 使用场景进行比较。确定缓存方面的问题,以及 PyPI 集成是否应保留 RECORD 以使 files() 正常工作;当行为和解决方案已记录下来,或已通过验证实现时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- build-system
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 需要澄清
- 新手友好度
- 42/100