| load("@pybind11_bazel//:build_defs.bzl", "pybind_extension") |
| load("@rules_python//python:py_library.bzl", "py_library") |
| load("@rules_python//python:py_test.bzl", "py_test") |
| load("@rules_python//python:packaging.bzl", "py_wheel") |
| |
| pybind_extension( |
| name = "basic", |
| srcs = ["basic.cpp"], |
| ) |
| |
| py_test( |
| name = "basic_pybind_data_test", |
| size="small", |
| srcs = ["basic_test.py"], |
| main = "basic_test.py", |
| data = [":basic"], |
| ) |
| |
| py_test( |
| name = "basic_pybind_deps_test", |
| size="small", |
| srcs = ["basic_test.py"], |
| main = "basic_test.py", |
| deps = [":basic"], |
| ) |
| |
| # this seems to work as expected |
| # the basic.so is in the wheel package |
| py_wheel( |
| name = "basic_pybind_wheel", |
| testonly = True, |
| distribution = "basic_pybind", |
| version = "1.0.0", |
| deps = [":basic"], |
| ) |
| |
| py_library( |
| name = "basic_lib", |
| data = [":basic"], |
| imports = ["."], |
| ) |
| |
| py_test( |
| name = "basic_lib_test", |
| size="small", |
| srcs = ["basic_test.py"], |
| main = "basic_test.py", |
| deps = [":basic_lib"], |
| ) |
| |
| # this won't contains the basic.so native module |
| py_wheel( |
| name = "basic_lib_wheel", |
| testonly = True, |
| distribution = "basic_lib", |
| version = "2.0.0", |
| deps = [":basic_lib"], |
| ) |