-
We are migrating from WORKSPACE to MODULE.bazel. Most of modules are now in MODULE.bazel and very few are still in WORKSPACE. We have rules_python still in WORKSPACE because some of our internal custom python codes/rules/builds still need more time to update. We use python version 3.10, eg: in WORKSPACE:
We notice an issue where our external dependencies from MODULE.bazel are using python 3.11 instead of our default 3.10. Since we are still using WORKSPACE and can't set |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
We are using rules_python 0.40.0, and latest bazel 7: |
Beta Was this translation helpful? Give feedback.
-
That might be working as intended - I am not sure if this is something that can be easily fixed. At the same time, I am not sure why you can define your toolchain in bzlmod? You should still be able to use |
Beta Was this translation helpful? Give feedback.
-
Thanks for the suggestion! I just tried this: In MODULE.bazel, I added:
In WORKSPACE, I only have below lines, nothing else:
bazel build gives this error:
Since pip.parse isn't 100% matching pip_parse, it breaks some of our internal custom bazel rules. It will take some time for us to update all those custom rules. In the meantime, we would like to migrate non python stuff into MODULE.bazel. |
Beta Was this translation helpful? Give feedback.
-
Thanks and that gets me further, but it fails when I pin the version to python 3.10 in WORKSPACE
bazel build gives errors:
In the requirement.bzl
The bazel errors says the repo @@python_3_10_x86_64-unknown-linux-gnu doesn't exist. In the bazel cache directory, I do see "external/rules_python~~python~python_3_10_x86_64-unknown-linux-gnu" but don't see "external/python_3_10_x86_64-unknown-linux-gnu". I was using rules_python 0.38 in this test. If I switch to 1.0.0, I get a different error:
|
Beta Was this translation helpful? Give feedback.
python_3_10
is something that points to an interpreter that can only be used in thebuild
context.python_3_10_host
uses the same repositories but resolves/copies the files in therepository_rule
context. The legacyload("@python_3_10_host//:defs.bzl", "interpreter")
has been replaced with@python_3_10_host//:python
.