packaging code with compiled libraries

Tim jtim.arnold at gmail.com
Tue Oct 6 11:40:23 EDT 2015


On Tuesday, October 6, 2015 at 5:51:48 AM UTC-4, Oscar Benjamin wrote:
> On 5 October 2015 at 20:43, Tim <jtimDOTarnoldATgmail.com> wrote:
> >
> > I have a package I want to share but have a question about packaging.
> >
> > Mostly the package is pure python code, but it also requires some binary libraries (*.so, *.dll, *.dylib).  I want to bundle these libs so users don't have to compile. The package will run on *nix/windows/mac platforms.

> The idea of a wheel is that you want to distribute your code fully
> precompiled to end users who will be able to install it without
> needing any C compilers etc. Of course this requires you to supply
> wheels for each platform of interest. If this is what you want to do
> then yes absolutely use wheels. Note that if you have installed
> setuptools and wheel and you use setuptools in your setup.py then
> building a wheel is as simple as running "python setup.py bdist_wheel"
> (once your setup.py is complete).
> 
> If the binary libraries in question are extension modules then you
> should just declare them as such in your setup.py and
> distutils/setuptools/wheel will take care of bundling them into the
> wheel.
> 
> If the binary libraries are not extension modules and you are building
> them separately (not using distutils) then you can declare them as
> "datafiles" [1] so that they will be bundled into your wheel and
> installed alongside your python code.
> 
> [1] https://packaging.python.org/en/latest/distributing/#package-data
> 
> --
> Oscar

Thanks for that description. I read through the recent archives on distutils-sig and it's pretty much over my head. These libs are built separately (not extension modules) so I will use wheels with the 'datafiles' approach.
--Tim



More information about the Python-list mailing list