xeus-python icon indicating copy to clipboard operation
xeus-python copied to clipboard

Starting a python-kernel in a C++ application

Open MaximilienNaveau opened this issue 3 years ago • 1 comments

Dear all,

I am new to xeus and I am not sure it is done for my purpose. I am developing a C++ application with an embedded python interpreter (currently taken from boost::python). The idea it to interact remotely with this embedded python-interpreter.

Hence at first we use ROS but it is less than convenient as we have to re-implement the interpreter as ROS only give us a way to call simple function remotely.

What I would like to do is to depend on a C++ library (xeus-python?) in order to spawn 2 things:

  • a python-kernel from C++
  • a communication channel compatible with tools like jupyter console --existing
  • a way to send python commands and python scripts to be executed remotely into the C++ python-kernel

Do you think that your tool is the right choice? And where to look for the C++ API. Thank you very much.

MaximilienNaveau avatar Jul 20 '22 14:07 MaximilienNaveau

Hi,

I think xeus-python can help you ;) The API is split between xeus-python, specific to python, and xeus, a native implementation of the jupyter protocol).

Most f the time, when building a kernel, you want to put together the different blocks provided by these libraries, that is: a server (for the remote communication), an interpreter, and optional things such as an history manager, a debugger, etc.

You can have a look at the main file to see how these pieces are put together to instantiate a python kernel, I think you may want to do soimething similar.

Also notice that if you only need a remote python kernel in C++, then you can just use xeus-python as is.

JohanMabille avatar Jul 21 '22 07:07 JohanMabille