• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
12# This toolchain is explicitly 3.10 while `rules_python` is 3.9 to act as
13# a regression test, ensuring 3.10 is functional
14python_register_toolchains(
15    name = "python310",
16    python_version = "3.10",
17)
18
19load("@python310//:defs.bzl", "interpreter")
20load("@rules_python//python:pip.bzl", "pip_install", "pip_parse")
21
22# For a more thorough example of `pip_parse`. See `@rules_python//examples/pip_parse`
23pip_parse(
24    name = "pip_parsed",
25    python_interpreter_target = interpreter,
26    requirements_lock = "//:requirements.txt",
27    requirements_windows = "//:requirements_windows.txt",
28)
29
30load("@pip_parsed//:requirements.bzl", install_pip_parse_deps = "install_deps")
31
32install_pip_parse_deps()
33
34# For a more thorough example of `pip_install`. See `@rules_python//examples/pip_install`
35pip_install(
36    name = "pip_installed",
37    python_interpreter_target = interpreter,
38    requirements = "//:requirements.txt",
39    requirements_windows = "//:requirements_windows.txt",
40)
41
42load("@pip_installed//:requirements.bzl", install_pip_install_deps = "install_deps")
43
44install_pip_install_deps()
45