bazel-contrib / bazel-contrib/rules_python

Allow using a locally installed Python runtime as a full toolchain

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

This feature request has come up a few time from different places.

The basic request is to have an option other than the hermetic runtimes, typically a Python runtime that is locally installed. Some of the reasons this is appealing:

* Avoids having to download a remote runtime.
* If you deeply care about supply chain issues, the provenance of the runtimes isn't very compelling.
* The standalone-python-build runtimes have some known limitations
* The hermetic runtimes are expensive to setup: they're inbuild runtimes with a (mostly) full python installation, all of which has to be copied into runfiles
* I think some people like to manage their Python version outside of bazel, e.g. using `pyenv` or venv activation.

Making a local runtime have the same capabilities as a hermetic runtime is _sort of_ possible today, but requires quite a bit of setup, and I think maybe loading a few private bzl files.

PR #2000 lays the ground work for most of it. What's now missing is a public API for it and figuring out what knobs (if any) it needs.

For at least early testing, we're thinking to have a flag control what type of runtime is selected.

But, during our maintainers meeting, two big questions came up:
1. What does the public API for using it look like?
2. What are the use cases? These drive what the public API needs to look like

So, if you have use cases, please post them here. It'll help us figure out what capabilities are needed.

TODO
* [x] Create repo rules to map the local python install into bazel
* [x] Allow setting arbitrary target_compatible_with/target_settings
* [ ] Allow creating an in-build instead of platform runtime

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 việc xem xét PR #2000 và các mục TODO đã hoàn thành để ánh xạ một bản cài đặt Python cục bộ vào Bazel. Xác định API công khai và các tùy chọn bắt buộc dựa trên các trường hợp sử dụng đã được ghi chép, sau đó xác định cách hỗ trợ việc tạo một môi trường in-build thay vì runtime của nền tảng.

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ó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/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.