concaveman-cpp icon indicating copy to clipboard operation
concaveman-cpp copied to clipboard

WIP: Making a Python package using Cython to call the CPP

Open ChrisBarker-NOAA opened this issue 5 years ago • 0 comments

NOTE: this is NOT ready to merge -- at least not to master.

This looks pretty nice, and I'd really like to have it as a simple to build Python package.

cffi is great for calling external libraries, but as long as you have the cpp code, and need to build it anyway, calling it from Cython should make it easy to build in one step, the same way on all platforms.

I figured it would be totally straightforward, I've done a number of these before, but, well turns out not so much, but it is working now -- not massibly tested, but it works, and no segfaults, and no memory leaks.

After I got it working, I realized that I didn't need to call the C code in the cpp file, as Cython should be able to call C++ templates directly. But that's getting pretty out of my depth, so I thought I'd do it the "easy" way first. And it works. Given the simple interface, this is probably fine.

Anyway, I thought I'd do this PR now, to see if you have an interest in moving this forward. If not, I'll fork it if need be. But I think a ready-to-install Python package of this would be really nice to have.

Note: since I started this I discovered:

https://github.com/cubao/concave_hull/

which is maybe the way to go.

Thanks for your work,

ChrisBarker-NOAA avatar Aug 26 '20 23:08 ChrisBarker-NOAA