aboutsummaryrefslogtreecommitdiff
path: root/examples/multi_python_versions/MODULE.bazel
blob: 1e5d32ebc0a7ea2216fcc920e3ba541aeb2daa0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
module(
    name = "multi_python_versions",
)

bazel_dep(name = "bazel_skylib", version = "1.4.0")
bazel_dep(name = "rules_python", version = "0.0.0")
local_path_override(
    module_name = "rules_python",
    path = "../..",
)

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
    configure_coverage_tool = True,
    python_version = "3.8",
)
python.toolchain(
    configure_coverage_tool = True,
    # Only set when you have mulitple toolchain versions.
    is_default = True,
    python_version = "3.9",
)
python.toolchain(
    configure_coverage_tool = True,
    python_version = "3.10",
)
python.toolchain(
    configure_coverage_tool = True,
    python_version = "3.11",
)
use_repo(
    python,
    python = "python_versions",
)

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
use_repo(pip, "pypi")
pip.parse(
    hub_name = "pypi",
    python_version = "3.8",
    requirements_lock = "//requirements:requirements_lock_3_8.txt",
)
pip.parse(
    hub_name = "pypi",
    python_version = "3.9",
    requirements_lock = "//requirements:requirements_lock_3_9.txt",
)
pip.parse(
    hub_name = "pypi",
    python_version = "3.10",
    requirements_lock = "//requirements:requirements_lock_3_10.txt",
)
pip.parse(
    hub_name = "pypi",
    python_version = "3.11",
    requirements_lock = "//requirements:requirements_lock_3_11.txt",
)