1workspace(name = "pip_repository_annotations_example") 2 3local_repository( 4 name = "rules_python", 5 path = "../..", 6) 7 8load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains") 9 10py_repositories() 11 12python_register_toolchains( 13 name = "python39", 14 python_version = "3.9", 15) 16 17load("@python39//:defs.bzl", "interpreter") 18load("@rules_python//python:pip.bzl", "pip_parse") 19 20# This repository isn't referenced, except by our test that asserts the requirements.bzl is updated. 21# It also wouldn't be needed by users of this ruleset. 22pip_parse( 23 name = "pip", 24 python_interpreter_target = interpreter, 25 requirements_lock = "//:requirements.txt", 26) 27 28# This example vendors the file produced by `pip_parse` above into the repo. 29# This way our Bazel doesn't eagerly fetch and install the pip_parse'd 30# repository for builds that don't need it. 31# See discussion of the trade-offs in the pip_parse documentation 32# and the "vendor_requirements" target in the BUILD file. 33load("//:requirements.bzl", "install_deps") 34 35install_deps() 36