when using bzlmod, py_library always uses the default python toolchain for figuring out dependencies
🐞 bug report
Affected Rule
py_library
Is this a regression?
yes, it didnt use to work like this
Description
We have a use case where we try to recreate the AWS GLUE environments, we have a pip.parse for every version of glue. Each glue env runs on a specific version of python, for example glue v2 & v3 run on 3.8 and v4 runs on 3.10.
The problem is that when defining a py_library for glue v2 code, py_library will yield an error telling me that there is no wheel for version 3.10 (this is the default toolchain that we choose for some other stuff). If i set the default python version to 3.8 then py_library will build. My conclusion was that py_library uses the default python version for figuring out where a dependency is
This is fine but I think we should atleast have the option to specify a python version to py_library like we do for py_binary and py_test.
🔬 Minimal Reproduction
🔥 Exception or Error
🌍 Your Environment
Operating System:
Output of bazel version:
Rules_python version:
Anything else relevant?
See the multi-version example to force a particular Python version. In bzlmod the version-aware toolchain is used by default specifically for this usecase. Let me know if that works for you. If not, please consider posting a minimal reproduction example.
Cleaning up old issues.