-
Notifications
You must be signed in to change notification settings - Fork 12
How pybind11 is used in MsPASS
There is an decent User's manual for pybind11 that can be found here with copies in other places. The binding code used to create the ccore libraries in MsPASS are in subdirectories (relative to the base of the MsPASS source code tree) ./cxx/python. Each subdirectory contains the code to create a python module with that directory name.
(e.g. the mspasspy.ccore.seismic module binding code can be found in ./cxx/python/seismic.) The examples there in combination with the extensive python documentation provides all the information you will need to get started and then some.
A hidden gem in the pybind11 documentation is this page.. The authors probably properly bury it because you have to know a lot about pybind11 and object oriented programming in general and objects in C++ and python in particular to have it make much sense. Nonetheless, if you see constructs in our examples that look mysterious after reading the basic documentation you can probably find an explanation on that page.
The authors of pybind11 clearly have the perspective of many programmers that if you have the source code, documentation is fluff for the advanced user. Not true for most of us, but we make this point because some features of pybind11 can only be sorted out by looking at the extensive set of example and test code you can find for pybind11 with a google search. The documentation, in fact, often refers directly to test code found here.