Skip to content

Commit 2a43817

Browse files
authored
Merge pull request #464 from SylvainCorlay/debug-messages
Document debug_[request|reply] and debug_event
2 parents 2b1beeb + 0bfcaeb commit 2a43817

File tree

1 file changed

+54
-20
lines changed

1 file changed

+54
-20
lines changed

docs/messaging.rst

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ kernel has dedicated sockets for the following functions:
4848
each frontend and the kernel.
4949

5050
2. **IOPub**: this socket is the 'broadcast channel' where the kernel publishes all
51-
side effects (stdout, stderr, etc.) as well as the requests coming from any
52-
client over the shell socket and its own requests on the stdin socket. There
53-
are a number of actions in Python which generate side effects: :func:`print`
54-
writes to ``sys.stdout``, errors generate tracebacks, etc. Additionally, in
55-
a multi-client scenario, we want all frontends to be able to know what each
56-
other has sent to the kernel (this can be useful in collaborative scenarios,
57-
for example). This socket allows both side effects and the information
58-
about communications taking place with one client over the shell channel
59-
to be made available to all clients in a uniform manner.
51+
side effects (stdout, stderr, debugging events etc.) as well as the requests
52+
coming from any client over the shell socket and its own requests on the
53+
stdin socket. There are a number of actions in Python which generate side
54+
effects: :func:`print` writes to ``sys.stdout``, errors generate tracebacks,
55+
etc. Additionally, in a multi-client scenario, we want all frontends to be
56+
able to know what each other has sent to the kernel (this can be useful in
57+
collaborative scenarios, for example). This socket allows both side effects
58+
and the information about communications taking place with one client over
59+
the shell channel to be made available to all clients in a uniform manner.
6060

6161
3. **stdin**: this ROUTER socket is connected to all frontends, and it allows
6262
the kernel to request input from the active frontend when :func:`raw_input` is called.
@@ -72,8 +72,9 @@ kernel has dedicated sockets for the following functions:
7272
which ones are from other clients, so they can display each type
7373
appropriately.
7474

75-
4. **Control**: This channel is identical to Shell, but operates on a separate socket,
76-
to allow important messages to avoid queueing behind execution requests (e.g. shutdown or abort).
75+
4. **Control**: This channel is identical to Shell, but operates on a separate
76+
socket to avoid queueing behind execution requests. The control channel is
77+
used for shutdown and restart messages, as well as for debugging messages.
7778

7879
5. **Heartbeat**: This socket allows for simple bytestring messages to be sent
7980
between the frontend and the kernel to ensure that they are still connected.
@@ -837,8 +838,6 @@ Message type: ``comm_info_reply``::
837838

838839
.. versionadded:: 5.1
839840

840-
``comm_info`` is a proposed addition for msgspec v5.1.
841-
842841
.. _msging_kernel_info:
843842

844843
Kernel info
@@ -943,6 +942,9 @@ and `codemirror modes <http://codemirror.net/mode/index.html>`_ for those fields
943942

944943
``language`` moved to ``language_info.name``
945944

945+
Messages on the Control (ROUTER/DEALER) channel
946+
===============================================
947+
946948
.. _msging_shutdown:
947949

948950
Kernel shutdown
@@ -988,8 +990,6 @@ Message type: ``shutdown_reply``::
988990

989991
Sending a ``shutdown_request`` message on the ``shell`` channel is deprecated.
990992

991-
992-
993993
.. _msging_interrupt:
994994

995995
Kernel interrupt
@@ -1011,11 +1011,31 @@ Message type: ``interrupt_reply``::
10111011

10121012
.. versionadded:: 5.3
10131013

1014+
Debug request
1015+
-------------
10141016

1015-
Messages on the IOPub (PUB/SUB) channel
1016-
=======================================
1017+
This message type is used with debugging kernels to request specific actions
1018+
to be performed by the debugger such as adding a breakpoint or stepping into
1019+
a code.
1020+
1021+
Message type: ``debug_request``::
1022+
1023+
content = {}
1024+
1025+
Message type: ``debug_reply``::
1026+
1027+
content = {}
1028+
1029+
The ``content`` dict can be any JSON information used by debugging frontends
1030+
and kernels.
10171031

1032+
Debug requests and replies are sent over the `control` channel to prevent queuing
1033+
behind execution requests.
10181034

1035+
.. versionadded:: 5.5
1036+
1037+
Messages on the IOPub (PUB/SUB) channel
1038+
=======================================
10191039

10201040
Streams (stdout, stderr, etc)
10211041
------------------------------
@@ -1284,6 +1304,22 @@ Message type: ``clear_output``::
12841304
The selective clearing keys are ignored in v4 and the default behavior remains the same,
12851305
so v4 clear_output messages will be safely handled by a v4.1 frontend.
12861306

1307+
.. _debug_event:
1308+
1309+
Debug event
1310+
-----------
1311+
1312+
This message type is used by debugging kernels to send debugging events to the
1313+
frontend.
1314+
1315+
Message type: ``debug_event``::
1316+
1317+
content = {}
1318+
1319+
The ``content`` dict can be any JSON information used by debugging frontends.
1320+
1321+
.. versionadded:: 5.5
1322+
12871323
.. _stdin_messages:
12881324

12891325
Messages on the stdin (ROUTER/DEALER) channel
@@ -1355,7 +1391,6 @@ Heartbeat for kernels
13551391
Clients send ping messages on a REQ socket, which are echoed right back
13561392
from the Kernel's REP socket. These are simple bytestrings, not full JSON messages described above.
13571393

1358-
13591394
Custom Messages
13601395
===============
13611396

@@ -1367,8 +1402,7 @@ To do this, IPython adds a notion of a ``Comm``, which exists on both sides,
13671402
and can communicate in either direction.
13681403

13691404
These messages are fully symmetrical - both the Kernel and the Frontend can send each message,
1370-
and no messages expect a reply.
1371-
The Kernel listens for these messages on the Shell channel,
1405+
and no messages expect a reply. The Kernel listens for these messages on the Shell channel,
13721406
and the Frontend listens for them on the IOPub channel.
13731407

13741408
Opening a Comm

0 commit comments

Comments
 (0)