ipybind icon indicating copy to clipboard operation
ipybind copied to clipboard

How to build?

Open evinpinar opened this issue 4 years ago • 1 comments

Hi, how can I build this package to try the notebook example? Thanks

evinpinar avatar Jul 01 '20 14:07 evinpinar

  1. in ipybind-master run jupyter lab or jupyter notebook
  2. just include pybind11 path
import ipybind

%load_ext ipybind
%pybind11_capture
%pybind11_capture
%pybind11_capture on
%pybind11_capture off
%pybind11_capture 1
%pybind11_capture 0
%%pybind11 -f -I="your_path_to_pybind11/include/";

PYBIND11_PLUGIN(test) {
    py::module m("test");
    m.attr("x") = py::cast(1);
    m.attr("_y") = py::cast(2);
    m.attr("__z") = py::cast(3);
    m.def("add", [](int x, int y){return x + y ;});
    return m.ptr();
}
add(3,456)

waxz avatar Jul 08 '20 12:07 waxz