ISoirar / pypp11

Py++ for generating pybind11 code
http://pypp11.readthedocs.org/
Boost Software License 1.0
14 stars 4 forks source link

Requirement to make pypp11 #1

Open ghost opened 8 years ago

ghost commented 8 years ago

Hello,

Can you expose the needs to make pypp11 works ? The strategy and module to develop ?

Thanks

ISoirar commented 8 years ago

Sure! :smile:

I'm currently in testing of minimum requirements for a hack that will make Py++ generate pybind11 code (for most of the needed features). Once I have this list of required code alterations, which should be any time soon, I will upload a file into the repository and probably open up appropriate issues.

I will furthermore provide an outlining for the next steps to take, since I plan to work on Py++11 in stages.

ISoirar commented 8 years ago

Continuation of #2.

Stage I, as presented in the development stage plan, is in a sense already split up into smaller parts, as you have the distinct subprojects. However, I do understand your concern that I mixed porting the underlying code with some additions that would make the project work (better). I will think of a way to change that, maybe, as you suggested, splitting it up further.

As for your questions:

1) No, the C++ parsing is done by pygccxml and is independent of the switch from Boost.Python to pybind11 2) Have a look at module_body.py. Clearly, the Boost.Python code is hard-coded into the Python source file. Nonetheless, simply changing this line to

result.append( "PYBIND11_PLUGIN(%s){" % self.name )

doesn't seem to suffice. The actual required changes seem to be more subtle, at least for this particular piece of code.This is the reason why I would love to have others helping out on this task.

To address a certain lack of detailed description of required changes (in source code), for example in port_to_pybind11.md:

I have identified what would make Py++ generated files work for pybind11 (for a set of features). How to actually port the code is a little more difficult to say and I will leave it for each feature to be worked out individually. This is the main work that has to be done on the project right now: finding where to change bits and pieces in the code to make it generate pybind11. Once that is done, actually performing the changes isn't that hard.

Time is scarce and setting the focus on porting the source files is absolutely legitimate and help I wouldn't wanna miss! After all, I will be working on this project too. :wink:

ghost commented 8 years ago

Hello,

Thanks for your comments.

Think we need to into the code line by line and comment it.....

Do you know Cloud 9 ? This is an online IDE where people can code + add comment into.

Think it would be useful for adding comment into the code by different members...

What do you think ?

Thanks

ISoirar commented 8 years ago

Follow up on me stating that the required changes may be more subtle: I managed to apply three changes from port_to_pybind11.md to the source code.

The first two deal with the namespace alias at the top of the file. 4f4283091397d325501da0e32b6469975b3bed44 shows that I added a new module builder for pybind11, disguised as the default module_builder_t, which is in fact something Py++ did with the Boost.Python module builder.

The third change was to port the enum_ class invocation. As can be seen in 60614c9cb148e90edee871f1f4f1700e6d7baaa7, this was in fact just a string replacement. Note, however, that without the changes in 4f4283091397d325501da0e32b6469975b3bed44, this one would not have been applied to the source properly.

I did also try to change the class_ invocation, but it seems to be a bit different than the enum_ one.

Baby steps, but I think these changes demonstrate the nature of the work on Py++11 right now pretty well. It also shows that yes, simple string replacements do in fact suffice, but not unconditionally, as other parts of the code may have to be changed as well.

ghost commented 8 years ago

https://ide.c9.io/arita291/pybind11plus#openfile-README.md

I upload into cloud 9