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.
Not ready to merge
Still needs some changes before we can merge, but getting it out there to start the discussion and share the code. When we do merge, I can fix the merge conflict.
Description
This pull request adds a Python wrapper to PBNJ that is 1-1 with the original API (aka it's not very Pythonic and could be cleaned up a lot, but this gives the base Python module). The bulk of this builds on top of SWIG, which can auto-generate a Python wrapper around code in C/C++, and only required a couple of small changes to the C++ code.
In order to test everything out, first you need to make sure to have OSPRay, Embree, and PBNJ installed normally (i.e. all of them
sudo make install
ed). Then, you need to generate the bindings using SWIG, from the root of the repo (notbuild
).Left to do
I don't think this is quite ready to merge, because there's still some quality-of-life changes that need to be made. In no particular order:
Generating the swig bindings should be automatic and included in the CMake file. I don't know CMake well enough to do it, but I can give an equivalent Makefile to base the CMake one off of, just let me know.
While compiling PBNJ, it should go ahead and create a Python egg/wheel so that pip installing the code is easier. If we ever want to push this to PyPI, then we'll need this.
A lot of the contact/documentation stuff in the
setup.py
is very oversimplified. We should change it to be the most up-to-date (for instance, we probably don't want me listed as the point of contact and instead use something @seelabutk or similar).Ideally, the
pbnj.i
file (that SWIG uses to generate all the Python stuff) should be located either: in the main source tree or in its own directory. i.e. eithersrc/pbnj.i
orpython/pbnj.i
. I think thesetup.py
should still stay at the root though.Testing
$ swig -c++ -python pbnj.i
Then you can pip install the module:
$ pip install --verbose .
And if all goes well, then you should now be able to run a test script, like the following: