1workspace(name = "rules_python_multi_python_versions") 2 3local_repository( 4 name = "rules_python", 5 path = "../..", 6) 7 8load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_multi_toolchains") 9 10py_repositories() 11 12default_python_version = "3.9" 13 14python_register_multi_toolchains( 15 name = "python", 16 default_version = default_python_version, 17 python_versions = [ 18 "3.8", 19 "3.9", 20 "3.10", 21 "3.11", 22 ], 23 register_coverage_tool = True, 24) 25 26load("@python//:pip.bzl", "multi_pip_parse") 27 28multi_pip_parse( 29 name = "pypi", 30 default_version = default_python_version, 31 python_interpreter_target = { 32 "3.10": "@python_3_10_host//:python", 33 "3.11": "@python_3_11_host//:python", 34 "3.8": "@python_3_8_host//:python", 35 "3.9": "@python_3_9_host//:python", 36 }, 37 requirements_lock = { 38 "3.10": "//requirements:requirements_lock_3_10.txt", 39 "3.11": "//requirements:requirements_lock_3_11.txt", 40 "3.8": "//requirements:requirements_lock_3_8.txt", 41 "3.9": "//requirements:requirements_lock_3_9.txt", 42 }, 43) 44 45load("@pypi//:requirements.bzl", "install_deps") 46 47install_deps() 48