|
| 1 | +module( |
| 2 | + name = "multi_python_versions", |
| 3 | +) |
| 4 | + |
| 5 | +bazel_dep(name = "bazel_skylib", version = "1.4.0") |
| 6 | +bazel_dep(name = "rules_python", version = "0.0.0") |
| 7 | +local_path_override( |
| 8 | + module_name = "rules_python", |
| 9 | + path = "../..", |
| 10 | +) |
| 11 | + |
| 12 | +python = use_extension("@rules_python//python/extensions:python.bzl", "python") |
| 13 | +python.toolchain( |
| 14 | + configure_coverage_tool = True, |
| 15 | + python_version = "3.8", |
| 16 | +) |
| 17 | +python.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 | +) |
| 23 | +python.toolchain( |
| 24 | + configure_coverage_tool = True, |
| 25 | + python_version = "3.10", |
| 26 | +) |
| 27 | +python.toolchain( |
| 28 | + configure_coverage_tool = True, |
| 29 | + python_version = "3.11", |
| 30 | +) |
| 31 | +use_repo( |
| 32 | + python, |
| 33 | + python = "python_versions", |
| 34 | +) |
| 35 | + |
| 36 | +pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") |
| 37 | +use_repo(pip, "pypi") |
| 38 | +pip.parse( |
| 39 | + hub_name = "pypi", |
| 40 | + python_version = "3.8", |
| 41 | + requirements_lock = "//requirements:requirements_lock_3_8.txt", |
| 42 | +) |
| 43 | +pip.parse( |
| 44 | + hub_name = "pypi", |
| 45 | + python_version = "3.9", |
| 46 | + requirements_lock = "//requirements:requirements_lock_3_9.txt", |
| 47 | +) |
| 48 | +pip.parse( |
| 49 | + hub_name = "pypi", |
| 50 | + python_version = "3.10", |
| 51 | + requirements_lock = "//requirements:requirements_lock_3_10.txt", |
| 52 | +) |
| 53 | +pip.parse( |
| 54 | + hub_name = "pypi", |
| 55 | + python_version = "3.11", |
| 56 | + requirements_lock = "//requirements:requirements_lock_3_11.txt", |
| 57 | +) |
0 commit comments