An IPython kernel magic library. After
import pybindmagic you can use the cell magic
In this cell you can write cpp code.
- cmake (optional)
pip install git+https://git.finnendahl.de/Yugon/pybindmagic.git
- add options for cmake flags
- add other compilers
- Better exception handling
- Better debugging output
You need to specify all functions or classes you want to expose to python. Either by
%%cpp -f funcname or by pybind11 syntax at the end of the cell. There is a shortcut by inserting a
defs in the end of the cell that will add the correct module name. For an example take a look at the example notebook.
Currently only gcc is supported. The default compiler command is
c++. You can change the compiler command with:
pybindmagic.compiler_cmd = "gcc"
%%cpp -c path/to/folder/with/CMakeList.txt/in you can specify cmake compilation. After evaluation pybind11 will be downloaded and moved to this folder, a build folder is generated and the cell is compiled in this folder.
Makesure that you add pybind11 to your cmake file.
%cpp -rebuild flag you can enforce a complete rebuild.