bazel-contrib / bazel-contrib/rules_python

Use pip repos with different names between different python versions

Đang mở
#2,530 9 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ả

# 🐞 bug report

### Affected Rule

This seems to be an "issue" when you using py_library and add a dependency to it that is in a pip repo not using your default python version. Hopefully I explained that correctly but I also opened a PR to make it easy to reproduce https://github.com/bazelbuild/rules_python/pull/2529.

### Is this a regression?

I don't think so I have another version of rules python in use 0.32.2 I believe and it has the same issue.

### Description

https://github.com/bazelbuild/rules_python/pull/2529 described better here but when using multiple repos and python versions and trying to use the library that contains a requirement from the non default and building it things blow up and look like this.

```
ERROR: /private/var/tmp/_bazel_schuettm/e053d0eaf0a843e9f76bdb61766af4b7/external/rules_python++pip+pypi_3_10_only/flask/BUILD.bazel:5:12: configurable attribute "actual" in @@rules_python++pip+pypi_3_10_only//flask:pkg doesn't match this configuration: No matching wheel for current configuration's Python version.

The current build configuration's Python version doesn't match any of the Python
wheels available for this distribution. This distribution supports the following Python
configuration settings:
//_config:is_python_3.11

To determine the current configuration's Python version, run:
`bazel config ` (shown further below)

and look for one of:
@@rules_python+//python/config_settings:python_version
@@rules_python+//python/config_settings:pip_whl
@@rules_python+//python/config_settings:pip_whl_glibc_version
@@rules_python+//python/config_settings:pip_whl_muslc_version
@@rules_python+//python/config_settings:pip_whl_osx_arch
@@rules_python+//python/config_settings:pip_whl_osx_version
@@rules_python+//python/config_settings:py_freethreaded
@@rules_python+//python/config_settings:py_linux_libc

If the value is missing, then the default value is being used, see documentation:
https://rules-python.readthedocs.io/en/latest/api/rules_python/python/config_settings

This instance of @@rules_python++pip+pypi_3_10_only//flask:pkg has configuration identifier e62ee83. To inspect its configuration, run: bazel config e62ee83.

For more help, see https://bazel.build/docs/configurable-attributes#faq-select-choose-condition.

Use --verbose_failures to see the command lines of failed build steps.
ERROR: Analysis of target '//tests:my_lib_3_10_only_test' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.197s, Critical Path: 0.02s
INFO: 2 processes: 2 internal.
ERROR: Build did NOT complete successfully
//tests:test_versions NO STATUS

Executed 0 out of 1 test: 1 was skipped.
```

## 🔬 Minimal Reproduction

https://github.com/bazelbuild/rules_python/pull/2529 and just run `bezel test //...` inside `examples/multi_python_versions`.

## 🔥 Exception or Error

See above

## 🌍 Your Environment

**Operating System:**

This is on a Mac but I believe it is independent of OS.

**Output of `bazel version`:**

I have hit this on 7.x and 8..x

**Rules_python version:**

0.32.0 -> main

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 việc tái hiện trong PR #2529 và thư mục examples/multi_python_versions; chạy lệnh kiểm thử đã được báo cáo để quan sát lỗi trên các kho pip của các phiên bản Python được đặt tên khác nhau. Theo dõi cấu hình được chọn cho kho không mặc định và xác minh rằng việc tái hiện thành công khi dependency của nó được sử dụng từ py_library.

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
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/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.