How do I package a Python module together with a precompiled .so
library? Specifically, how do I write setup.py
so that when I do this in Python
What I ended up doing is:
setup(
name='py_my_lib',
version=version, # specified elsewhere
packages=[''],
package_dir={'': '.'},
package_data={'': ['py_my_lib.so']},
)
This way I get to import the lib by its name, and don't have another level of nestedness:
import py_my_lib
and not
from py_my_lib_wrapper import py_my_lib
As is mentioned in setupscript.html#installing-package-data:
setup(
...
package_data={'top_secret_wrapper': ['top_secret.so']},
)
If that library should also be compiled during install you can describe this as an extension module. If you just want to ship it add it as package_data