bazel-contrib / bazel-contrib/rules_python

FR: add PyInfo.direct_imports

Đang mở
#2,942 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
core-rules type: feature request
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ả

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 )

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

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

Hướng nghiên cứu

Bắt đầu bằng cách xác định provider PyInfo cùng các trường imports và deps hiện có, sau đó đọc hướng dẫn Bazel được liên kết về việc tránh chuyển đổi depset-to-list. Được xem là hoàn tất khi các đường dẫn import trực tiếp được cung cấp mà không làm phẳng các dependency chuyển tiếp, đồng thời vẫn giữ nguyên hành vi imports chuyển tiếp hiện tại; issue không nêu tên file hoặc test cụ thể nào.

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
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
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.