1module( 2 name = "other_module", 3) 4 5# This module is using the same version of rules_python 6# that the parent module uses. 7bazel_dep(name = "rules_python", version = "") 8 9# The story behind this commented out override: 10# This override is necessary to generate/update the requirements file 11# for this module. This is because running it via the outer 12# module doesn't work -- the `requirements.update` target can't find 13# the correct file to update. 14# Running in the submodule itself works, but submodules using overrides 15# is considered an error until Bazel 6.3, which prevents the outer module 16# from depending on this module. 17# So until 6.3 and higher is the minimum, we leave this commented out. 18# local_path_override( 19# module_name = "rules_python", 20# path = "../../..", 21# ) 22 23PYTHON_NAME_39 = "python_3_9" 24 25PYTHON_NAME_311 = "python_3_11" 26 27python = use_extension("@rules_python//python/extensions:python.bzl", "python") 28python.toolchain( 29 configure_coverage_tool = True, 30 python_version = "3.9", 31) 32python.toolchain( 33 configure_coverage_tool = True, 34 # In a submodule this is ignored 35 is_default = True, 36 python_version = "3.11", 37) 38 39# created by the above python.toolchain calls. 40use_repo( 41 python, 42 "python_versions", 43 PYTHON_NAME_39, 44 PYTHON_NAME_311, 45) 46 47pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") 48pip.parse( 49 hub_name = "other_module_pip", 50 # NOTE: This version must be different than the root module's 51 # default python version. 52 # This is testing that a sub-module can use pip.parse() and only specify 53 # Python versions that DON'T include whatever the root-module's default 54 # Python version is. 55 python_version = "3.11", 56 requirements_lock = ":requirements_lock_3_11.txt", 57) 58use_repo(pip, "other_module_pip") 59