You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/kernels.rst
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -121,7 +121,9 @@ The user location takes priority over the system locations, and the case of the
121
121
names is ignored, so selecting kernels works the same way whether or not the
122
122
filesystem is case sensitive.
123
123
Since kernelspecs show up in URLs and other places,
124
-
a kernelspec is required to have a simple name, only containing ASCII letters, ASCII numbers, and the simple separators: ``-`` hyphen, ``.`` period, ``_`` underscore.
124
+
a kernelspec is required to have a simple name, only containing ASCII letters,
125
+
ASCII numbers, and the simple separators: ``-`` hyphen, ``.`` period, ``_``
126
+
underscore.
125
127
126
128
Other locations may also be searched if the :envvar:`JUPYTER_PATH` environment
127
129
variable is set.
@@ -143,7 +145,8 @@ JSON serialised dictionary containing the following keys and values:
143
145
When loading notebooks, if no matching kernelspec key (may differ across machines)
144
146
is found, a kernel with a matching `language` will be used.
145
147
This allows a notebook written on any Python or Julia kernel to be properly associated
146
-
with the user's Python or Julia kernel, even if they aren't listed under the same name as the author's.
148
+
with the user's Python or Julia kernel, even if they aren't listed under the
149
+
same name as the author's.
147
150
- **interrupt_mode** (optional): May be either ``signal`` or ``message`` and
148
151
specifies how a client is supposed to interrupt cell execution on this kernel,
149
152
either by sending an interrupt ``signal`` via the operating system's
The ``content`` dicts of the `debug_request` and `debug_reply` messages respectively follow the specification of the `Request` and `Response` messages from the `Debug Adapter Protocol (DAP) <https://microsoft.github.io/debug-adapter-protocol/>`_ as of version 1.39 or later.
1117
1125
1118
-
Debug requests and replies are sent over the `control` channel to prevent queuing behind execution requests.
1126
+
Debug requests and replies are sent over the `control` channel to prevent
1127
+
queuing behind execution requests.
1119
1128
1120
1129
Additions to the DAP
1121
1130
~~~~~~~~~~~~~~~~~~~~
@@ -1126,7 +1135,9 @@ The Jupyter debugger protocol makes several additions to the DAP:
1126
1135
- the `debugInfo` request and response messages
1127
1136
- the `inspectVariables` request and response messages
1128
1137
1129
-
In order to support the debugging of notebook cells and of Jupyter consoles, which are not based on source files, we need a message to submit code to the debugger to which breakpoints can be added.
1138
+
In order to support the debugging of notebook cells and of Jupyter consoles,
1139
+
which are not based on source files, we need a message to submit code to the
1140
+
debugger to which breakpoints can be added.
1130
1141
1131
1142
Content of the `dumpCell` request::
1132
1143
@@ -1148,7 +1159,10 @@ In order to support the debugging of notebook cells and of Jupyter consoles, whi
1148
1159
}
1149
1160
}
1150
1161
1151
-
In order to support page reloading, or a client connecting at a later stage, Jupyter kernels must store the state of the debugger (such as breakpoints, whether the debugger is currently stopped). The `debugInfo` request is a DAP `Request` with no extra argument.
1162
+
In order to support page reloading, or a client connecting at a later stage,
1163
+
Jupyter kernels must store the state of the debugger (such as breakpoints,
1164
+
whether the debugger is currently stopped). The `debugInfo` request is a DAP
1165
+
`Request` with no extra argument.
1152
1166
1153
1167
Content of the `debugInfo` request::
1154
1168
@@ -1182,7 +1196,9 @@ In order to support page reloading, or a client connecting at a later stage, Jup
1182
1196
1183
1197
The `source_breakpoint` schema is specified by the Debug Adapter Protocol.
1184
1198
1185
-
The `inspectVariables` is meant to retrieve the values of all the variables that have been defined in the kernel. It is a DAP `Request` with no extra argument.
1199
+
The `inspectVariables` is meant to retrieve the values of all the variables
1200
+
that have been defined in the kernel. It is a DAP `Request` with no extra
1201
+
argument.
1186
1202
1187
1203
Content of the `inspectVariables` request::
1188
1204
@@ -1208,7 +1224,8 @@ The `inspectVariables` is meant to retrieve the values of all the variables that
1208
1224
}
1209
1225
}
1210
1226
1211
-
The ``richInspectVariables`` request allows to get the rich representation of a variable that has been defined in the kernel.
1227
+
The ``richInspectVariables`` request allows to get the rich representation of a
1228
+
variable that has been defined in the kernel.
1212
1229
1213
1230
Content of the ``richInspectVariables`` request::
1214
1231
@@ -1598,7 +1615,8 @@ Custom Messages
1598
1615
1599
1616
.. versionadded:: 4.1
1600
1617
1601
-
Message spec 4.1 (IPython 2.0) added a messaging system for developers to add their own objects with Frontend
1618
+
Message spec 4.1 (IPython 2.0) added a messaging system for developers to add
1619
+
their own objects with Frontend
1602
1620
and Kernel-side components, and allow them to communicate with each other.
1603
1621
To do this, IPython adds a notion of a ``Comm``, which exists on both sides,
1604
1622
and can communicate in either direction.
@@ -1623,7 +1641,8 @@ The code handling the message on the receiving side is responsible for maintaini
1623
1641
of target_name keys to constructors.
1624
1642
After a ``comm_open`` message has been sent,
1625
1643
there should be a corresponding Comm instance on both sides.
1626
-
The ``data`` key is always a dict and can be any extra JSON information used in initialization of the comm.
1644
+
The ``data`` key is always a dict and can be any extra JSON information used in
1645
+
initialization of the comm.
1627
1646
1628
1647
If the ``target_name`` key is not found on the receiving side,
1629
1648
then it should immediately reply with a ``comm_close`` message to avoid an inconsistent state.
@@ -1635,7 +1654,8 @@ Comm Messages
1635
1654
Comm messages are one-way communications to update comm state,
1636
1655
used for synchronizing widget state, or simply requesting actions of a comm's counterpart.
1637
1656
1638
-
Essentially, each comm pair defines their own message specification implemented inside the ``data`` dict.
1657
+
Essentially, each comm pair defines their own message specification implemented
1658
+
inside the ``data`` dict.
1639
1659
1640
1660
There are no expected replies (of course, one side can send another ``comm_msg`` in reply).
1641
1661
@@ -1740,12 +1760,14 @@ Kernel info:
1740
1760
1741
1761
Execution:
1742
1762
1743
-
- ``user_variables`` is removed from ``execute_request/reply`` because it is redundant with ``user_expressions``
1763
+
- ``user_variables`` is removed from ``execute_request/reply`` because it is
1764
+
redundant with ``user_expressions``
1744
1765
- ``password`` key added to ``input_request``
1745
1766
1746
1767
Output:
1747
1768
1748
-
- ``data`` key in stream messages renamed to ``text`` for consistency with the notebook format.
1769
+
- ``data`` key in stream messages renamed to ``text`` for consistency with the
1770
+
notebook format.
1749
1771
- ``application/json`` in mimebundles should be unpacked JSON data,
1750
1772
not a double-serialized JSON string.
1751
1773
@@ -1758,7 +1780,8 @@ Inspection:
1758
1780
1759
1781
Completion:
1760
1782
1761
-
- ``complete_request``: ``line``, ``block``, and ``text`` keys are removed in favor of a single ``code`` for context.
1783
+
- ``complete_request``: ``line``, ``block``, and ``text`` keys are removed in
1784
+
favor of a single ``code`` for context.
1762
1785
Lexing is up to the kernel.
1763
1786
- ``complete_reply``:
1764
1787
- ``matched_text`` is removed in favor of ``cursor_start`` and ``cursor_end``.
@@ -1769,7 +1792,8 @@ Completion:
1769
1792
---
1770
1793
1771
1794
- ``comm_open/close/msg`` messages added
1772
-
- ``clear_output``: ``stdout``, ``stderr``, and ``display`` boolean keys for selective clearing are removed,
1795
+
- ``clear_output``: ``stdout``, ``stderr``, and ``display`` boolean keys for
1796
+
selective clearing are removed,
1773
1797
and ``wait`` is added.
1774
1798
The selective clearing keys are ignored in v4 and the default behavior remains the same,
1775
1799
so v4 ``clear_output`` messages will be safely handled by a v4.1 frontend.
@@ -1785,7 +1809,8 @@ Notes
1785
1809
1786
1810
Many frontends, especially those implemented in javascript,
1787
1811
reported cursor_pos as the interpreter's string index,
1788
-
which is not the same as the unicode character offset if the interpreter uses UTF-16 (e.g. javascript or Python 2 on macOS),
1812
+
which is not the same as the unicode character offset if the interpreter uses
1813
+
UTF-16 (e.g. javascript or Python 2 on macOS),
1789
1814
which stores "astral-plane" characters such as ``𝐚 (U+1D41A)`` as surrogate pairs,
1790
1815
taking up two indices instead of one, causing a unicode offset
1791
1816
drift of one per astral-plane character.
@@ -1797,11 +1822,16 @@ for frontends that did the right thing.
1797
1822
1798
1823
For this reason, in protocol versions prior to 5.2, ``cursor_pos``
1799
1824
is officially ambiguous in the presence of astral plane unicode characters.
1800
-
Frontends claiming to implement protocol 5.2 **MUST** identify cursor_pos as the encoding-independent unicode character offset.
1801
-
Kernels may choose to expect the UTF-16 offset from requests implementing protocol 5.1 and earlier, in order to behave correctly with the most popular frontends.
1802
-
But they should know that doing so *introduces* the inverse bug for the frontends that do not have this bug.
1803
-
1804
-
As an example, use a python3 kernel and evaluate ``𨭎𨭎𨭎𨭎𨭎 = 10``. Then type ``𨭎𨭎`` followed by the tab key and see if it properly completes.
1825
+
Frontends claiming to implement protocol 5.2 **MUST** identify cursor_pos as
1826
+
the encoding-independent unicode character offset.
1827
+
Kernels may choose to expect the UTF-16 offset from requests implementing
1828
+
protocol 5.1 and earlier, in order to behave correctly with the most popular
1829
+
frontends.
1830
+
But they should know that doing so *introduces* the inverse bug for the
1831
+
frontends that do not have this bug.
1832
+
1833
+
As an example, use a python3 kernel and evaluate ``𨭎𨭎𨭎𨭎𨭎 = 10``. Then type
1834
+
``𨭎𨭎`` followed by the tab key and see if it properly completes.
Copy file name to clipboardExpand all lines: docs/pending-kernels.rst
+20-7Lines changed: 20 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,14 +3,19 @@ Pending Kernels
3
3
4
4
*Added in 7.1.0*
5
5
6
-
In scenarios where an kernel takes a long time to start (e.g. kernels running remotely), it can be advantageous to immediately return the kernel's model and ID from key methods like ``.start_kernel()`` and ``.shutdown_kernel()``. The kernel will continue its task without blocking other managerial actions.
6
+
In scenarios where an kernel takes a long time to start (e.g. kernels running
7
+
remotely), it can be advantageous to immediately return the kernel's model and
8
+
ID from key methods like ``.start_kernel()`` and ``.shutdown_kernel()``. The
9
+
kernel will continue its task without blocking other managerial actions.
7
10
8
11
This intermediate state is called a **"pending kernel"**.
9
12
10
13
How they work
11
14
-------------
12
15
13
-
When ``.start_kernel()`` or ``.shutdown_kernel()`` is called, a ``Future`` is created under the ``KernelManager.ready`` property. This property can be awaited anytime to ensure that the kernel moves out of its pending state, e.g.:
16
+
When ``.start_kernel()`` or ``.shutdown_kernel()`` is called, a ``Future`` is
17
+
created under the ``KernelManager.ready`` property. This property can be
18
+
awaited anytime to ensure that the kernel moves out of its pending state, e.g.:
14
19
15
20
.. code-block:: python
16
21
@@ -19,18 +24,26 @@ When ``.start_kernel()`` or ``.shutdown_kernel()`` is called, a ``Future`` is cr
19
24
# of its pending state.
20
25
await kernel_manager.ready
21
26
22
-
Once the kernel is finished pending, ``.ready.done()`` will be ``True`` and either 1) ``.ready.result()`` will return ``None`` or 2) ``.ready.exception()`` will return a raised exception
27
+
Once the kernel is finished pending, ``.ready.done()`` will be ``True`` and
28
+
either 1) ``.ready.result()`` will return ``None`` or 2) ``.ready.exception()``
29
+
will return a raised exception
23
30
24
31
Using pending kernels
25
32
---------------------
26
33
27
-
The most common way to interact with pending kernels is through the ``MultiKernelManager``—the object that manages a collection of kernels—by setting its ``use_pending_kernels`` trait to ``True``. Pending kernels are "opt-in"; they are not used by default in the ``MultiKernelManager``.
34
+
The most common way to interact with pending kernels is through the ``
35
+
MultiKernelManager``—the object that manages a collection of kernels—by setting
36
+
its ``use_pending_kernels`` trait to ``True``. Pending kernels are "opt-in";
37
+
they are not used by default in the ``MultiKernelManager``.
28
38
29
-
When ``use_pending_kernels`` is ``True``, the following changes are made to the ``MultiKernelManager``:
39
+
When ``use_pending_kernels`` is ``True``, the following changes are made to the
40
+
``MultiKernelManager``:
30
41
31
-
1. ``start_kernel`` and ``stop_kernel`` return immediately while running the pending task in a background thread.
42
+
1. ``start_kernel`` and ``stop_kernel`` return immediately while running the
43
+
pending task in a background thread.
32
44
2. The following methods raise a ``RuntimeError`` if a kernel is pending:
33
45
* ``restart_kernel``
34
46
* ``interrupt_kernel``
35
47
* ``shutdown_kernel``
36
-
3. ``shutdown_all`` will wait for all pending kernels to become ready before attempting to shut them down.
48
+
3. ``shutdown_all`` will wait for all pending kernels to become ready before
Copy file name to clipboardExpand all lines: docs/provisioning.rst
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -139,7 +139,8 @@ behavior, there's a good chance you can simply extend
139
139
custom functionality.
140
140
141
141
In this example, RBACProvisioner will verify whether the current user is
142
-
in the role meant for this kernel by calling a method implemented within *this* provisioner. If the user is not in the role, an exception will be thrown.
142
+
in the role meant for this kernel by calling a method implemented within *this*
143
+
provisioner. If the user is not in the role, an exception will be thrown.
Copy file name to clipboardExpand all lines: docs/wrapperkernels.rst
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,9 @@ such as bash.
14
14
A simple kernel for bash, written using this machinery
15
15
16
16
The `Metakernel <https://github.com/Calysto/metakernel/#>`_ library makes it easier to
17
-
write a wrapper kernel that includes a base set of line and cell magics. It also has a ``ProcessKernel`` subclass that makes it easy to write kernels that use ``pexpect``.
17
+
write a wrapper kernel that includes a base set of line and cell magics. It
18
+
also has a ``ProcessKernel`` subclass that makes it easy to write kernels that
19
+
use ``pexpect``.
18
20
See `Octave Kernel <https://github.com/Calysto/octave_kernel>`_ as an example.
0 commit comments