@@ -51,7 +51,7 @@ course the ``execute_request_impl`` which executes the code whenever the client
5151.. literalinclude :: ./example/src/custom_interpreter.cpp
5252 :language: cpp
5353 :dedent: 4
54- :lines: 22-49
54+ :lines: 22-57
5555
5656The result and arguments of the execution request are described in the execute_request _ documentation.
5757
@@ -236,6 +236,34 @@ Create info reply
236236
237237 Thorough information about the kernel's infos variables can be found in the Jupyter kernel docs _.
238238
239+ Outputs and display
240+ -------------------
241+
242+ The ``xinterpreter `` class provides several methods for sending data to be displayed
243+ to the frontend(s), that you can call from the implementation of your interpreter class:
244+
245+ - ``publish_stream ``: this method is used to send data that should be print on the standard
246+ output streams (``stdout `` and ``stderr `` in Python, ``std::cout `` and ``std::cerr `` in C++).
247+ The usual way to have it called when executing user code is to redirect standard streams. This
248+ method should not be called when executing code in silent mode (i.e. when ``execute_request_impl ``
249+ is called with a ``config `` argument whose ``silent `` member is ``true ``).
250+ - ``publish_execution_input ``: this method sends the executed code to all the frontends connected
251+ to the kernel. Like ``publish_stream ``, it should not be called when executing code in silent mode.
252+ This method is already called in the ``execute_request `` method of the ``xinterpreter `` class and
253+ there should be no need to call it from your implementation. It is provided for backward compatibility
254+ purpose.
255+ - ``publish_exeuction_result ``: this sends the result of the execution to all the frontends connected
256+ to the kernel. It should be called when the execution is successful, and the code was not executed
257+ in silent mode.
258+ - ``publish_execution_error ``: this method sends an execution error to all the frontends. It should be
259+ called when the code failed to execute and was not executed in silent mode.
260+ - ``display_data ``: this method sends data to be displayed to all the frontends. It should be called
261+ from executing a special function in the user code (``display `` in Python and C++, ``display_data ``
262+ in MatLab). This function should be called even if the code is executed in silent mode.
263+ - ``update_diplay_data ``: when a ``display_id `` is specified for a display, it can be updated later
264+ with a call to this method. Like ``display_data ``, this method should be called even if the code
265+ is executed in silent mode.
266+
239267Implementing the main entry
240268---------------------------
241269
0 commit comments