WIP: Making a Python package using Cython to call the CPP #14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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,