bazel-contrib / bazel-contrib/rules_python

importlib.metadata.files() doesn't work because RECORD is missing

Đang mở
#3,024 9 bình luận 0 reaction 0 người được giao Xem trên GitHub
type: bug type: pip
Ngôn ngữ chính
Starlark
Star
688
Fork
721
Merge trung bình
15 giờ 7 phút
Pull request đã merge (30 ngày)
76

Mô tả

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?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với chú thích về việc bỏ qua RECORD trong python/private/pypi/whl_library_targets.bzl, khoảng các dòng 315-318, sau đó so sánh với tài liệu về importlib.metadata.files() và trường hợp sử dụng rtree được mô tả ở đây. Xác định mối lo ngại về caching và liệu tích hợp PyPI có nên giữ lại RECORD để files() hoạt động hay không; được coi là hoàn tất khi hành vi và cách giải quyết được ghi lại hoặc được triển khai kèm xác thực.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
build-system
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.