Search code examples
pythonpypipython-packagingpybind11python-wheel

package python module with pybind11 extension that depends on shared libraries


I'm using pybind11 to create cross platform bindings to the c++ library named piper-phonemize. The library depends on 2 native libraries - onnxruntime and espeak-ng. There's cmake file which produce the needed shared libraries. However, I cannot find a simple way to include these shared libraries in Windows/Linux/macOS.

I use pyproject.toml and setup.py

I would like to place the native pybind11 extension along with the shared libraries in the package folder. Is there a simple way to include them in a way that the extension will be able to load them once I import the extension?

Thanks


Solution

  • I used uv to to create the package. for adding shared libraries I simply placed them in src folder of the package and called uv build. And then the shared libraries available after users install the package in the same folder of the package.