Ugo Finnendahl
8732beba6c
|
4 years ago | |
---|---|---|
examples | 4 years ago | |
pybindmagic | 4 years ago | |
.gitignore | 4 years ago | |
README.md | 4 years ago | |
setup.py | 4 years ago |
README.md
pybindmagic
An IPython kernel magic library. After import pybindmagic
you can use the cell magic %%cpp
In this cell you can write cpp code.
Requirements
- pybind11
- git
- gcc
- cmake (optional)
Installation
pip install git+https://git.finnendahl.de/Yugon/pybindmagic.git
TODOS
- add options for cmake flags
- add other compilers
- Better exception handling
- Better debugging output
Options
defs
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.
Compiler
Currently only gcc is supported. The default compiler command is c++
. You can change the compiler command with:
pybindmagic.compiler_cmd = "gcc"
CMake
With %%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.
rebuild
With the %cpp -rebuild
flag you can enforce a complete rebuild.