xref: /aosp_15_r20/external/bazelbuild-rules_python/examples/multi_python_versions/MODULE.bazel (revision 60517a1edbc8ecf509223e9af94a7adec7d736b8)
1module(
2    name = "multi_python_versions",
3)
4
5bazel_dep(name = "bazel_skylib", version = "1.4.0")
6bazel_dep(name = "rules_python", version = "0.0.0")
7local_path_override(
8    module_name = "rules_python",
9    path = "../..",
10)
11
12python = use_extension("@rules_python//python/extensions:python.bzl", "python")
13python.toolchain(
14    configure_coverage_tool = True,
15    python_version = "3.8",
16)
17python.toolchain(
18    configure_coverage_tool = True,
19    # Only set when you have mulitple toolchain versions.
20    is_default = True,
21    python_version = "3.9",
22)
23python.toolchain(
24    configure_coverage_tool = True,
25    python_version = "3.10",
26)
27python.toolchain(
28    configure_coverage_tool = True,
29    python_version = "3.11",
30)
31use_repo(
32    python,
33    python = "python_versions",
34)
35
36pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
37use_repo(pip, "pypi")
38pip.parse(
39    hub_name = "pypi",
40    python_version = "3.8",
41    requirements_lock = "//requirements:requirements_lock_3_8.txt",
42)
43pip.parse(
44    hub_name = "pypi",
45    python_version = "3.9",
46    requirements_lock = "//requirements:requirements_lock_3_9.txt",
47)
48pip.parse(
49    hub_name = "pypi",
50    python_version = "3.10",
51    requirements_lock = "//requirements:requirements_lock_3_10.txt",
52)
53pip.parse(
54    hub_name = "pypi",
55    python_version = "3.11",
56    requirements_lock = "//requirements:requirements_lock_3_11.txt",
57)
58