Reputation: 145
I have created a Python module that wraps some C functionality. My potential users are using MS Windows, and I'm using distutils to build the c functionality into a .pyd file.
I created a manifest file which includes the .pyd file in the Python package, and everything, including the .pyd file, gets checked into version control. Users then can check it out of version control and install the module.
Most users of the module will not have the ability to rebuild the .pyd file from source code, because they don't have Visual Studio installed, and they don't necessarily have access to the libraries required to link the source code. So I want them to be able to to use the .pyd file that I'm including in the package.
The problem is when a user does python setup.py install
, it sometimes tries to rebuild the .pyd file, depending on the relative timestamps of the .pyd file and the source files. I can't control which timestamp is later, I think it depends on what order they files are fetched from version control.
What is the correct way to handle this situation?
Upvotes: 2
Views: 418
Reputation: 362826
The correct way to handle this situation is to build and distribute a wheel tagged for windows. You would do this, in addition to (or instead of) releasing a source distribution.
pip install --upgrade setuptools wheel
python setup.py build bdist_wheel
This will generate a .whl
file under ./dist/
subdirectory, which you then upload to an index (or you can send users the distribution file directly).
Your users will not do python setup.py install
, they will do pip install yourmodule
and pip will resolve the correct binary distribution i.e. .whl
file to download and install based upon the runtime platform. Compatibility tags are present in the wheel's filename.
If you wish to support multiple platforms, you may need to build separate wheels tagged for different platforms.
Upvotes: 2