[C++-sig] Distributing a simple boost.python package

Gautham V v.gautham13 at gmail.com
Fri Nov 2 15:00:28 EDT 2018


Hi,

I've written some code using boost.python (accessing numpy arrays) that I
am able to use on my Ubuntu 16.04 system (Boost 1.68.0) . Using GNU make I
am able to compile it into a .so file, and then I import it in Python to
use.

I would like to distribute this as a package. I was wondering what the
easiest way to do this would be. After some time searching, I've found the
following options:

1. Use bjam --- I could not get the tutorial to work

2. Use a CMakelists.txt or a Makefile ---  I used a modification of a file
on Github (
https://github.com/zpoint/Boost-Python-Examples/blob/master/Examples/hello_ext/makefile)
to build the .so file

3. Use setuptools/distutils --- I am trying out a sample package right now.
Should I provide the C++ source, or just a binary?

4. Use conda manager --- It was suggested in the archives (
https://mail.python.org/pipermail/cplusplus-sig/2018-October/017499.html).

5. Use Scons --- this is an alternative that seems simpler than the others,
I am traversing its documentation currently.

My package (essentially) contains the following files:
class1.h, class1.cpp
class2.h, class2.cpp
class3.h, class3.cpp (contains instance of class1 and class2)
wrapper.cpp (contains boost includes, and a wrapper class of class3)
helper.py (contains helper functions to deal with the wrapped objects)

I would prefer to use boost.python as it is very similar to Rcpp (the same
code works seamlessly on all platforms when converted into an R package via
RStudio), but I have not understood the build process for a python package
yet.

Does anyone have any useful tips on how to use the above tools, or a
checklist I can use to mark off steps in this process?


Thank you,

Gautham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20181102/f5afa4e3/attachment.html>


More information about the Cplusplus-sig mailing list