I am trying to generate a wheel file using bazel, for a target that has pybind dependencies. The package by itself works fine (though testing), but when I'm packing it, the .so file is missing from the site_packges
folder.
This is my build file:
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
load("@python_pip_deps//:requirements.bzl", "requirement")
load("@rules_python//python:defs.bzl", "py_library", "py_test")
load("@rules_python//python:packaging.bzl", "py_wheel", "py_package")
# wrapper for so file
py_library(
name = "example",
srcs = ["example.py","__init__.py"],
deps = [
],
data = [":pyexample_inf"],
imports = ["."],
)
# compile pybind cpp
pybind_extension(
name = "pyexample_inf",
srcs = ["pyexample_inf.cpp"],
deps = [],
linkstatic = True,
)
# test wrapper
py_test(
name = "pyexample_test",
srcs = ["tests/pyexample_test.py"],
deps = [
":example",
],
)
# Use py_package to collect all transitive dependencies of a target,
# selecting just the files within a specific python package.
py_package(
name = "pyexample_pkg",
visibility = ["//visibility:private"],
# Only include these Python packages.
deps = [":example"],
)
# using pip, this copies the files to the site_packges, but not the so file
py_wheel(
name = "wheel",
abi = "cp311",
author = "me",
distribution = "example",
license = "Apache 2.0",
platform = select({
"@bazel_tools//src/conditions:linux_x86_64": "linux_x86_64",
}),
python_requires = ">=3.9.0",
python_tag = "cpython",
version = "0.0.1",
deps = [":example"],
)
How can I make the py_wheel copy the so file?
try deps = [":example.so"]