bazel-contrib / bazel-contrib/rules_python
Support python_version on modules_mapping and/or gazelle_manifest rule
- 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ả
# 🚀 feature request
### Relevant Rules
* [gazelle_python_manifest](https://github.com/bazel-contrib/rules_python/blob/main/gazelle/manifest/defs.bzl)
* [modules_mapping](https://github.com/bazel-contrib/rules_python/blob/main/gazelle/modules_mapping/def.bzl)
### Description
When in the middle of working on a Python version upgrade, it's valuable to generate gazelle manifests with different module maps because you the requirements.in may include additional requirements for the new python version:
```
gradio; python_version >= "3.11"
```
When running the manifest rule with all_whl_requirements, it'll fail with something like:
> No matching wheel for current configuration's Python version.
In order to get the desired behavior, we need to run the gazelle manifest update by specifying a different python version via command line `--@rules_python//python/config_settings:python_version=3.11`.
### Describe the solution you'd like
Adding a `python_version attribute to the manifest or modules_mapping rule, so that we can run it with the expected python_version as needed without a command-line flag.
### Describe alternatives you've considered
We currently customize our scripts so that we add the command line flag, but I don't think this is feasible.
Other alternatives:
* Generate a modules mapping per different environment tag satisfied in the requirements.in . This might be heavy-handed, but could work for all other environment markers beyond python_version . And there's no need to maintain multiple manifest files.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với gazelle/manifest/defs.bzl và gazelle/modules_mapping/def.bzl, sau đó xem xét cách rule manifest sử dụng all_whl_requirements và thiết lập python_version trên dòng lệnh. Được coi là hoàn tất khi một trong hai rule chấp nhận phiên bản Python được yêu cầu và tạo manifest hoặc module map tương ứng mà không cần flag dòng lệnh, với hành vi bao quát các yêu cầu phụ thuộc vào phiên bản.
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
- 35/100