I am packaging a Python package with around 20 Python modules and one shared library[1]. I have create the following setup.py file:
from setuptools import setup, find_packages
setup(
name = "mypack",
version = "1.0",
author = "Bill Coder",
author_email = "bill.coder@email.com",
description = ("My Code"),
packages=find_packages(),
long_description="Long description",
)
And the filesystem looks like this:
mypack/
__init__.py
sub_pack1/
__init__.py
module1.py
module2.py
sub_pack2
__init__.py
moduleA.py
shared_library.so
I have tried the commands:
bash% python -m build --wheel
and
bash% python setup.py bdist_wheel
in both cases a wheel package is assembled but the shared library mypack/subpack2/shared_library.so is not included in the final product.
[1]: The shared library comes from cythonize on a pyx file. Ideally I would like to build the extension as part of the setup.py– but for now I settle for the more moderate ambition of an external build process and then packaging everything up into a package which I can install myself. The purpose of the package is just to serve as a temporary step between CI and target – the package will not be published beyond that.
>Solution :
Add include_package_data=True to your setup.py.
You may need to include a MANIFEST.in file to your project root that points to the additional file:
include mypack/sub_pack2/shared_library.so
more about this here