diff options
Diffstat (limited to 'examples/bzlmod/other_module/MODULE.bazel')
-rw-r--r-- | examples/bzlmod/other_module/MODULE.bazel | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/examples/bzlmod/other_module/MODULE.bazel b/examples/bzlmod/other_module/MODULE.bazel index cc23a51..959501a 100644 --- a/examples/bzlmod/other_module/MODULE.bazel +++ b/examples/bzlmod/other_module/MODULE.bazel @@ -6,10 +6,20 @@ module( # that the parent module uses. bazel_dep(name = "rules_python", version = "") -# It is not best practice to use a python.toolchian in -# a submodule. This code only exists to test that -# we support doing this. This code is only for rules_python -# testing purposes. +# The story behind this commented out override: +# This override is necessary to generate/update the requirements file +# for this module. This is because running it via the outer +# module doesn't work -- the `requirements.update` target can't find +# the correct file to update. +# Running in the submodule itself works, but submodules using overrides +# is considered an error until Bazel 6.3, which prevents the outer module +# from depending on this module. +# So until 6.3 and higher is the minimum, we leave this commented out. +# local_path_override( +# module_name = "rules_python", +# path = "../../..", +# ) + PYTHON_NAME_39 = "python_3_9" PYTHON_NAME_311 = "python_3_11" @@ -29,6 +39,20 @@ python.toolchain( # created by the above python.toolchain calls. use_repo( python, + "python_versions", PYTHON_NAME_39, PYTHON_NAME_311, ) + +pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") +pip.parse( + hub_name = "other_module_pip", + # NOTE: This version must be different than the root module's + # default python version. + # This is testing that a sub-module can use pip.parse() and only specify + # Python versions that DON'T include whatever the root-module's default + # Python version is. + python_version = "3.11", + requirements_lock = ":requirements_lock_3_11.txt", +) +use_repo(pip, "other_module_pip") |