I need some answers on how to setup my project correctly, including the setup.py, in order to make it include the dlls it depends on, but wheel doesn't seem to be getting them right from my configuration, and I'm not able to find a good example/documentation on how to do this the right way.
I have a project with the following structure:
myproj/
__init__.py <--this only does an import of proj.pyd
lib/
proj.pyd <--the pyd is compiled, so it depends on the python version
dep1.dll
dep2.dll
dep3.dll
setup.py
In setup.py I have
from setuptools import setup
# this is the package data (non - python files)
_package_data = ['lib/*.*']
setup(
name='myproj',
version='1.0.0',
packages=['myproj'],
url='an url',
license='some license',
author='author',
description='description',
package_data={'myproj': _package_data},
platforms='win',
python_requires='~=3.8',
)
The configuration above actually builds myproj and I'm able to use it, but the wheel name does not reflect the platform nor the python version (myproj-1.0.0-py3-none-any.whl), presumably because the only code it finds (in the init.py) is pure python. I can manually change the name, but doing it feels wrong.
I'm certainly doing something wrong, maybe building the pyd in a different process, for example, but I can't find a good reference on how to do all this the right way.
At minimum, I'd like to understand why python setup.py bdist_wheel
is ignoring my "python_requires" and "platforms" settings
I had the same issue, but managed to solve it using the answer and comments here: https://stackoverflow.com/a/24793171
You can tell setup to be distribution specific by either passing distclass
with a setuptools.Distribution
object or has_ext_modules=lambda : True
as arguments to setup()
. The latter is simpler in this case.
Your setup.py
would be:
from setuptools import setup
# this is the package data (non - python files)
_package_data = ['lib/*.*']
setup(
name='myproj',
version='1.0.0',
packages=['myproj'],
url='an url',
license='some license',
author='author',
description='description',
package_data={'myproj': _package_data},
platforms='win',
python_requires='~=3.8',
has_ext_modules=lambda : True, # <-- This line is added
)