| load("@bazel_skylib//rules:build_test.bzl", "build_test") |
| load("@pip//:requirements.bzl", "all_requirements", "all_whl_requirements", "requirement") |
| load("@python3_9//:defs.bzl", py_test_with_transition = "py_test") |
| load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test") |
| load("@rules_python//python:pip.bzl", "compile_pip_requirements") |
| |
| compile_pip_requirements( |
| name = "requirements", |
| extra_args = ["--allow-unsafe"], |
| requirements_in = "requirements.in", |
| requirements_txt = "requirements_lock.txt", |
| requirements_windows = "requirements_windows.txt", |
| ) |
| |
| py_library( |
| name = "lib", |
| srcs = ["lib.py"], |
| deps = [ |
| requirement("pylint"), |
| requirement("tabulate"), |
| requirement("python-dateutil"), |
| ], |
| ) |
| |
| py_binary( |
| name = "bzlmod", |
| srcs = ["__main__.py"], |
| main = "__main__.py", |
| visibility = ["//:__subpackages__"], |
| deps = [ |
| ":lib", |
| ], |
| ) |
| |
| py_test( |
| name = "test", |
| srcs = ["test.py"], |
| main = "test.py", |
| deps = [":lib"], |
| ) |
| |
| py_test_with_transition( |
| name = "test_with_transition", |
| srcs = ["test.py"], |
| main = "test.py", |
| deps = [":lib"], |
| ) |
| |
| build_test( |
| name = "all_wheels", |
| targets = all_whl_requirements, |
| ) |
| |
| build_test( |
| name = "all_requirements", |
| targets = all_requirements, |
| ) |