[Distutils] Wheels and dependent third party dlls on windows

David Genest david.genest at ubisoft.com
Wed Oct 1 18:44:47 CEST 2014


Thank you all for the precious info. 

Here are my observations:

- We are merely writing extension modules with third party dependant code packaged in a dll. In my mind, this use case is not the exception, and would not necessarily warrant the use of a full blown solution like conda. Our deployed environments are self-contained. 

- If you run python setup.py bdist_wheel, the dlls specified in the scripts parameter end up in the wheel archive and does what is needed for our setup. (the dlls are copied to the scripts directory which is on PATH for the activated environment). 

- On the other hand, if you run pip wheel on the same package, the dlls are not placed in the archive. Is this a pip bug ?

In an ideal world, the scripts directory would be called bin, like the unix counter-part, and any dependency, being startup scripts or dlls could be installed in the bin/ "environment global space". This path would be added to the python startup sequence (in order to not rely on the env's activate).

I feel that the current state of affairs is not that far, because setup.py bdist_wheel works now.

Knowing that there are alternatives on the way (in metadata 2.0 ?) and workarounds, we will go with our current wheel solution using setup.py bdist_wheel. 

If the bdist_wheel command ever loses the "package binary files in scripts dir" we have alternatives (listed in order of dependability):

1) add the dependent dlls to every package that needs it (Steve's answer https://mail.python.org/pipermail/distutils-sig/2014-September/024982.html
 concurs that the dependent dll would be loaded only once)
2) use technique to modify path in the first __init__.py (https://mail.python.org/pipermail/distutils-sig/2014-September/024962.html)
3) statically link the dependent library: not very good in the face of sharing code and having multiple copies in different extension modules with its state etc.

Does the community still think this is a "I would not design my solution like yours" use-case ? The extension modules are a really good way to accelerate python, so they are bound to be constructed with other dependent libraries. It is not only a sdist world :-), particularly on Windows.

Once again thanks, 

D.





More information about the Distutils-SIG mailing list