@@ -97,7 +97,7 @@ Message Header
97
97
--------------
98
98
99
99
The message ``header `` contains information about the message,
100
- such as unique identifiers for the originating session and the actual message id ,
100
+ such as unique identifiers for the originating session and the actual message ID ,
101
101
the type of message, the version of the Jupyter protocol,
102
102
and the date the message was created.
103
103
In addition, there is a username field, e.g. for the process that generated the
@@ -118,27 +118,34 @@ so that frontends can label the various messages in a meaningful way.
118
118
"msg_type": str,
119
119
# the message protocol version
120
120
"version": "5.0",
121
+ # Optional subshell_id
122
+ "subshell_id": str | None,
121
123
}
122
124
123
125
.. note ::
124
126
125
- The ``session `` id in a message header identifies a unique entity with state,
127
+ The ``session `` ID in a message header identifies a unique entity with state,
126
128
such as a kernel process or client process.
127
129
128
- A client session id , in message headers from a client, should be unique among
130
+ A client session ID , in message headers from a client, should be unique among
129
131
all clients connected to a kernel. When a client reconnects to a kernel, it
130
- should use the same client session id in its message headers. When a client
131
- restarts, it should generate a new client session id .
132
+ should use the same client session ID in its message headers. When a client
133
+ restarts, it should generate a new client session ID .
132
134
133
- A kernel session id , in message headers from a kernel, should identify a
134
- particular kernel process. If a kernel is restarted, the kernel session id
135
+ A kernel session ID , in message headers from a kernel, should identify a
136
+ particular kernel process. If a kernel is restarted, the kernel session ID
135
137
should be regenerated.
136
138
137
- The session id in a message header can be used to identify the sending entity.
139
+ The session ID in a message header can be used to identify the sending entity.
138
140
For example, if a client disconnects and reconnects to a kernel, and messages
139
- from the kernel have a different kernel session id than prior to the disconnect,
141
+ from the kernel have a different kernel session ID than prior to the disconnect,
140
142
the client should assume that the kernel was restarted.
141
143
144
+ The ``subshell_id `` is only used in shell messages of kernels that support
145
+ subshells (:ref: `kernel_subshells `). If it is not included or is ``None `` then the
146
+ shell message is handled by the parent subshell (main shell), if it is a string
147
+ subshell ID then it is handled by the subshell with that ID.
148
+
142
149
.. versionchanged :: 5.0
143
150
144
151
``version `` key added to the header.
@@ -150,6 +157,10 @@ so that frontends can label the various messages in a meaningful way.
150
157
so implementers are strongly encouraged to include it.
151
158
It will be mandatory in 5.1.
152
159
160
+ .. versionchanged :: 5.5
161
+
162
+ ``subshell_id `` added to the header.
163
+
153
164
Parent header
154
165
-------------
155
166
@@ -913,7 +924,7 @@ Message type: ``comm_info_reply``::
913
924
# 'ok' if the request succeeded or 'error', with error information as in all other replies.
914
925
'status' : 'ok',
915
926
916
- # A dictionary of the comms, indexed by uuids .
927
+ # A dictionary of the comms, indexed by UUIDs .
917
928
'comms': {
918
929
comm_id: {
919
930
'target_name': str,
@@ -997,14 +1008,20 @@ Message type: ``kernel_info_reply``::
997
1008
'banner': str,
998
1009
999
1010
# A boolean flag which tells if the kernel supports debugging in the notebook.
1000
- # Default is False
1011
+ # Default is False.
1012
+ # Deprecated as replaced by 'supported_features'=['debugger'] (see below).
1001
1013
'debugger': bool,
1002
1014
1003
1015
# Optional: A list of dictionaries, each with keys 'text' and 'url'.
1004
1016
# These will be displayed in the help menu in the notebook UI.
1005
1017
'help_links': [
1006
1018
{'text': str, 'url': str}
1007
1019
],
1020
+
1021
+ # Optional: A list of optional features such as 'debugger' and
1022
+ # 'kernel subshells'. Introduced by Jupyter Enhancement Proposal 92
1023
+ # https://github.com/jupyter/enhancement-proposals/pull/92
1024
+ 'supported_features': [str]
1008
1025
}
1009
1026
1010
1027
Refer to the lists of available `Pygments lexers <http://pygments.org/docs/lexers/ >`_
@@ -1031,6 +1048,10 @@ and `codemirror modes <http://codemirror.net/mode/index.html>`_ for those fields
1031
1048
1032
1049
``language `` moved to ``language_info.name ``
1033
1050
1051
+ .. versionchanged :: 5.5
1052
+
1053
+ ``supported_features `` added and ``debugger `` deprecated.
1054
+
1034
1055
Messages on the Control (ROUTER/DEALER) channel
1035
1056
===============================================
1036
1057
@@ -1313,6 +1334,86 @@ of the debugger to the ``global`` scope to inspect it after debug session.
1313
1334
1314
1335
.. versionadded :: 5.5
1315
1336
1337
+ .. _kernel_subshells :
1338
+
1339
+ Kernel subshells
1340
+ ----------------
1341
+
1342
+ Kernel subshells are separate threads of execution within the same kernel process that
1343
+ were introduced by
1344
+ `Jupyter Enhancement Proposal 91 <https://github.com/jupyter/enhancement-proposals/pull/91 >`_.
1345
+ Kernels supporting subshells must include ``'kernel subshells' `` in ``'supported_features' ``
1346
+ in :ref: `kernel info <msging_kernel_info >` reply messages.
1347
+
1348
+ Create subshell
1349
+ ~~~~~~~~~~~~~~~
1350
+
1351
+ In a kernel that supports subshells, this creates a new subshell (running in a separate thread)
1352
+ and returns its unique ID. In a kernel that does not support subshells an error is logged and
1353
+ no reply is sent.
1354
+
1355
+ Message type: ``create_subshell_request ``::
1356
+
1357
+ content = {
1358
+ }
1359
+
1360
+ Message type: ``create_subshell_reply ``::
1361
+
1362
+ content = {
1363
+ # 'ok' if the request succeeded or 'error', with error information as in all other replies.
1364
+ 'status' : 'ok',
1365
+
1366
+ # The ID of the subshell, unique within the kernel.
1367
+ 'subshell_id': str,
1368
+ }
1369
+
1370
+ .. versionadded :: 5.5
1371
+
1372
+ Delete subshell
1373
+ ~~~~~~~~~~~~~~~
1374
+
1375
+ In a kernel that supports subshells, this deletes a subshell identified by its unique ID.
1376
+ In a kernel that does not support subshells an error is logged and no reply is sent.
1377
+
1378
+ Message type: ``delete_subshell_request ``::
1379
+
1380
+ content = {
1381
+ # The ID of the subshell.
1382
+ 'subshell_id': str
1383
+ }
1384
+
1385
+ Message type: ``delete_subshell_reply ``::
1386
+
1387
+ content = {
1388
+ # 'ok' if the request succeeded or 'error', with error information as in all other replies.
1389
+ 'status': 'ok',
1390
+ }
1391
+
1392
+ .. versionadded :: 5.5
1393
+
1394
+ List subshell
1395
+ ~~~~~~~~~~~~~
1396
+
1397
+ In a kernel that supports subshells, this returns a list of the IDs of all subshells that exist
1398
+ in that kernel. In a kernel that does not support subshells an error is logged and no reply is sent.
1399
+
1400
+ Message type: ``list_subshell_request ``::
1401
+
1402
+ content = {
1403
+ }
1404
+
1405
+ Message type: ``list_subshell_reply ``::
1406
+
1407
+ content = {
1408
+ # 'ok' if the request succeeded or 'error', with error information as in all other replies.
1409
+ 'status': 'ok',
1410
+
1411
+ # A list of subshell IDs.
1412
+ 'subshell_id': [str]
1413
+ }
1414
+
1415
+ .. versionadded :: 5.5
1416
+
1316
1417
Messages on the IOPub (PUB/SUB) channel
1317
1418
=======================================
1318
1419
@@ -1755,6 +1856,10 @@ Changelog
1755
1856
1756
1857
- Added ``debug_request/reply `` messages
1757
1858
- Added ``debug_event `` message
1859
+ - Added ``supported_features `` in :ref: `kernel info <msging_kernel_info >` reply messages.
1860
+ - Deprecated ``debugger `` in :ref: `kernel info <msging_kernel_info >` reply messages as
1861
+ replaced with ``supported_features ``.
1862
+ - Added ``create_subshell ``, ``delete_subshell `` and ``list_subshell `` messages.
1758
1863
1759
1864
5.4
1760
1865
---
0 commit comments