I have a project depending on a shared library. To make it clear from the beginning: the shared library is a pure C library and not a Python library. For reasons of simplici
package_data
is for data. setup
can do the compilation into an *.so
.
Following my solution in python setup.py build ctypes.CDLL: cannot open shared object file: No such file or directory, I think your setup
could employ ext_modules
and py_modules
, something like
setup(name='pkgtest',
py_modules=['pkgtest'],
ext_modules=[Extension('src.libhello', ['src/libhello.c'])]
)
You can create a Python package which includes shared libraries and works on (almost) any linux distro using manylinux.
The goal of the manylinux project is to provide a convenient way to distribute binary Python extensions as wheels on Linux. This effort has produced PEP 513 which defines the
manylinux1_x86_64
andmanylinux1_i686
platform tags.
The general procedure is:
See .travis.yml and build-wheels.sh in the python-manylinux-demo
repo for an example.