[Rcpp-devel] advice on sharing C++ code across R and Python

2018-04-27 Thread Simon Barthelmé
Dear list, I have an R package that's mostly C++ code (using Eigen, but no other dependencies) and some glue. We wish to re-use the C++ code for a Python package. Most of the external-facing C++ functions are pretty simple: essentially they're all variants of: NumericVector some_matrix_calcu

Re: [Rcpp-devel] advice on sharing C++ code across R and Python

2018-04-27 Thread David Bellot
In my experience, it's usually much easier to have a stand-alone C++ library and add the Rcpp and Boost.Python layer on top of it. As you said, NumericVector and other classes are not known in the Python world. You can always hook in into them from Boost.Python to expose them to Python but a clear

Re: [Rcpp-devel] advice on sharing C++ code across R and Python

2018-04-27 Thread Dirk Eddelbuettel
Some folks told me that pybind11, ie at https://github.com/pybind/pybind11 is the one to use as Boost Python is stagnant. I have no personal experience with pybind11 though. The question is a good. This (old) CRAN package has been doing both R and Python from a joint C++ basis for years:

Re: [Rcpp-devel] advice on sharing C++ code across R and Python

2018-04-27 Thread Kevin Thornton
Hi all, pybind11 is the best choice here. It goes quite a bit beyond what Boost Python did, including nice support for Numpy arrays, the buffer protocol more generally, and an Eigen interface. I've used it quite a bit. But the real issue will be separating out the guts of your code from the Rcp