Skip to content

Commit 7c3a325

Browse files
JohanMabilleminrk
andauthored
Update messaging spec (#1095)
* Added missing info aobut Debug Adapter Protocol * Added XPUB related changes to the kernel message specification * Added support for kernel_info messages to the Control channel in the kernel message specification * Specified that the debugger is an optional feature * Specified that copyToGlobals debug request is optional * linter * Update docs/messaging.rst Co-authored-by: Min RK <[email protected]> * Fixed linter --------- Co-authored-by: Min RK <[email protected]>
1 parent 9589ed8 commit 7c3a325

File tree

1 file changed

+64
-4
lines changed

1 file changed

+64
-4
lines changed

docs/messaging.rst

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ kernel has dedicated sockets for the following functions:
8484
5. **Heartbeat**: This socket allows for simple bytestring messages to be sent
8585
between the frontend and the kernel to ensure that they are still connected.
8686

87+
.. versionchanged:: 5.5
88+
The **IOPub** PUB socket is replaced with an XPUB socket,
89+
to enable the ``iopub_welcome`` message.
90+
There is no other difference between kernel PUB and XPUB sockets from the client perspective.
91+
8792
The actual format of the messages allowed on each of these channels is
8893
specified below. Messages are dicts of dicts with string keys and values that
8994
are reasonably representable in JSON.
@@ -1136,12 +1141,21 @@ Message type: ``interrupt_reply``::
11361141

11371142
.. versionadded:: 5.3
11381143

1144+
Kernel info
1145+
-----------
1146+
1147+
This is the same :ref:`kernel info <msging_kernel_info>` message as that received on the Shell channel.
1148+
1149+
.. versionadded:: 5.5
1150+
11391151
Debug request
11401152
-------------
11411153

11421154
This message type is used with debugging kernels to request specific actions
11431155
to be performed by the debugger such as adding a breakpoint or stepping into
11441156
a code.
1157+
Kernels supporting subshells must include ``'debugger'`` in ``'supported_features'``
1158+
in :ref:`kernel info <msging_kernel_info>` reply messages.
11451159

11461160
Message type: ``debug_request``::
11471161

@@ -1158,6 +1172,8 @@ specification of the ``Request`` and ``Response`` messages from the
11581172
Debug requests and replies are sent over the ``control`` channel to prevent
11591173
queuing behind execution requests.
11601174

1175+
.. versionadded:: 5.5
1176+
11611177
Additions to the DAP
11621178
~~~~~~~~~~~~~~~~~~~~
11631179

@@ -1196,6 +1212,8 @@ debugger to which breakpoints can be added.
11961212
}
11971213
}
11981214

1215+
.. versionadded:: 5.5
1216+
11991217
debugInfo
12001218
#########
12011219

@@ -1231,11 +1249,14 @@ whether the debugger is currently stopped). The ``debugInfo`` request is a DAP
12311249
'stoppedThreads' : list(int), # threads in which the debugger is currently in a stopped state
12321250
'richRendering' : bool, # whether the debugger supports rich rendering of variables
12331251
'exceptionPaths' : list(str), # exception names used to match leaves or nodes in a tree of exception
1252+
'copyToGlobals' : bool, # whether the debugger supports supports the copyToGlobals request
12341253
}
12351254
}
12361255

12371256
The ``source_breakpoint`` schema is specified by the Debug Adapter Protocol.
12381257

1258+
.. versionadded:: 5.5
1259+
12391260
inspectVariables
12401261
################
12411262

@@ -1267,6 +1288,8 @@ argument.
12671288
}
12681289
}
12691290

1291+
.. versionadded:: 5.5
1292+
12701293
richInspectVariables
12711294
####################
12721295

@@ -1297,11 +1320,15 @@ variable that has been defined in the kernel.
12971320
}
12981321
}
12991322

1323+
.. versionadded:: 5.5
1324+
13001325
copyToGlobals
13011326
#############
13021327

13031328
The ``copyToGlobals`` request allows to copy a variable from the local variable panel
13041329
of the debugger to the ``global`` scope to inspect it after debug session.
1330+
The support for this request is optional and should be indicated to the client via
1331+
the ``copyToGlobals`` boolean field in the debugInfo reply.
13051332

13061333
Content of the ``copyToGlobals`` request::
13071334

@@ -1414,8 +1441,39 @@ Message type: ``list_subshell_reply``::
14141441

14151442
.. versionadded:: 5.5
14161443

1417-
Messages on the IOPub (PUB/SUB) channel
1418-
=======================================
1444+
Messages on the IOPub (XPUB/SUB) channel
1445+
========================================
1446+
1447+
Welcome message
1448+
---------------
1449+
1450+
This message is sent to a client SUB socket the first time it connects to the
1451+
XPUB kernel socket, to notify the client that the connection is established.
1452+
1453+
message type: ``iopub_welcome``::
1454+
1455+
content = {
1456+
# The topic the SUB has subscribed to. Can be empty string if
1457+
# the client has subscribed to all topics.
1458+
'subscription' : str,
1459+
}
1460+
1461+
.. note::
1462+
1463+
This message has no parent header.
1464+
1465+
.. note::
1466+
1467+
Welcome messages do not and cannot identify the client whose subscription is being received.
1468+
Receiving an iopub_welcome message with your subscription does not mean it is in response to
1469+
your own subscription. However, receiving a message does mean that a matching subscription has
1470+
been registered for your client, otherwise no message will be received. So if only one
1471+
subscription is registered, as is normally the case, receiving any welcome message is sufficient
1472+
to indicate that your client's subscription is fully established. The gist is that receiving a
1473+
welcome message is a sufficient condition to establish the subscription-propagation event, and
1474+
additional welcome messages should be expected and ignored.
1475+
1476+
.. versionadded:: 5.5
14191477

14201478
Streams (stdout, stderr, etc)
14211479
------------------------------
@@ -1854,12 +1912,14 @@ Changelog
18541912
5.5 (draft)
18551913
-----------
18561914

1857-
- Added ``debug_request/reply`` messages
1858-
- Added ``debug_event`` message
1915+
- Added ``debug_request/reply`` and ``debug_event`` messages.
1916+
- Replaced **IOPUB** PUB socket with an XPUB socket.
1917+
- Added support for :ref:`kernel info <msging_kernel_info>` request on the Control channel.
18591918
- Added ``supported_features`` in :ref:`kernel info <msging_kernel_info>` reply messages.
18601919
- Deprecated ``debugger`` in :ref:`kernel info <msging_kernel_info>` reply messages as
18611920
replaced with ``supported_features``.
18621921
- Added ``create_subshell``, ``delete_subshell`` and ``list_subshell`` messages.
1922+
- Added ``copyToGlobals`` debug request
18631923

18641924
5.4
18651925
---

0 commit comments

Comments
 (0)