diff options
Diffstat (limited to 'examples/pip_repository_annotations/BUILD.bazel')
-rw-r--r-- | examples/pip_repository_annotations/BUILD.bazel | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/examples/pip_repository_annotations/BUILD.bazel b/examples/pip_repository_annotations/BUILD.bazel new file mode 100644 index 0000000..84089f7 --- /dev/null +++ b/examples/pip_repository_annotations/BUILD.bazel @@ -0,0 +1,44 @@ +load("@pip_installed//:requirements.bzl", "requirement") +load("@rules_python//python:defs.bzl", "py_test") +load("@rules_python//python:pip.bzl", "compile_pip_requirements") + +exports_files( + glob(["data/**"]), + visibility = ["//visibility:public"], +) + +# This rule adds a convenient way to update the requirements file. +compile_pip_requirements( + name = "requirements", + extra_args = ["--allow-unsafe"], +) + +py_test( + name = "pip_parse_annotations_test", + srcs = ["pip_repository_annotations_test.py"], + env = { + "REQUESTS_PKG_DIR": "pip_parsed_requests", + "WHEEL_PKG_DIR": "pip_parsed_wheel", + }, + main = "pip_repository_annotations_test.py", + deps = [ + "@pip_parsed_requests//:pkg", + "@pip_parsed_wheel//:pkg", + "@rules_python//python/runfiles", + ], +) + +py_test( + name = "pip_install_annotations_test", + srcs = ["pip_repository_annotations_test.py"], + env = { + "REQUESTS_PKG_DIR": "pip_installed_requests", + "WHEEL_PKG_DIR": "pip_installed_wheel", + }, + main = "pip_repository_annotations_test.py", + deps = [ + requirement("wheel"), + requirement("requests"), + "@rules_python//python/runfiles", + ], +) |