blob: a61e09481d95ae1da25736a77295c5ee816c7f01 [file] [log] [blame]
module(
name = "example_bzlmod",
version = "0.0.0",
compatibility_level = 1,
)
bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "rules_python", version = "0.0.0")
local_path_override(
module_name = "rules_python",
path = "../..",
)
# We next initialize the python toolchain using the extension.
# You can set different Python versions in this block.
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
configure_coverage_tool = True,
# Only set when you have mulitple toolchain versions.
is_default = True,
python_version = "3.9",
)
# We are also using a second version of Python in this project.
# Typically you will only need a single version of Python, but
# If you need a different vesion we support more than one.
# Note: we do not supporting using multiple pip extensions, this is
# work in progress.
python.toolchain(
configure_coverage_tool = True,
python_version = "3.10",
)
# You only need to load this repositories if you are using multiple Python versions.
# See the tests folder for various examples on using multiple Python versions.
# The names "python_3_9" and "python_3_10" are autmatically created by the repo
# rules based on the `python_version` arg values.
use_repo(python, "python_3_10", "python_3_9", "python_aliases")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
# To fetch pip dependencies, use pip.parse. We can pass in various options,
# but typically we pass requirements and the Python version. The Python
# version must have been configured by a corresponding `python.toolchain()`
# call.
# Alternatively, `python_interpreter_target` can be used to directly specify
# the Python interpreter to run to resolve dependencies.
pip.parse(
hub_name = "pip",
python_version = "3.9",
requirements_lock = "//:requirements_lock_3_9.txt",
requirements_windows = "//:requirements_windows_3_9.txt",
)
pip.parse(
hub_name = "pip",
python_version = "3.10",
requirements_lock = "//:requirements_lock_3_10.txt",
requirements_windows = "//:requirements_windows_3_10.txt",
)
# NOTE: The pip_39 repo is only used because the plain `@pip` repo doesn't
# yet support entry points; see https://github.com/bazelbuild/rules_python/issues/1262
use_repo(pip, "pip", "pip_39")
bazel_dep(name = "other_module", version = "", repo_name = "our_other_module")
local_path_override(
module_name = "other_module",
path = "other_module",
)