Skip to content

Commit 9263e49

Browse files
committed
update wrapper kernel docs
1 parent f1ad17d commit 9263e49

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

docs/wrapperkernels.rst

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ Making simple Python wrapper kernels
22
====================================
33

44
You can re-use IPython's kernel machinery to easily make new kernels.
5-
This is useful for languages that have Python bindings, such as `Octave
6-
<http://www.gnu.org/software/octave/>`_ (via
7-
`Oct2Py <https://blink1073.github.io/oct2py/#>`_), or languages
5+
This is useful for languages that have Python bindings, such as `Hy
6+
<https://github.com/hylang/hy/>`_ (see
7+
`Calysto Hy <https://github.com/Calysto/calysto_hy/#>`_), or languages
88
where the REPL can be controlled in a tty using `pexpect <https://pexpect.readthedocs.io/en/latest/>`_,
99
such as bash.
1010

@@ -13,6 +13,11 @@ such as bash.
1313
`bash_kernel <https://github.com/takluyver/bash_kernel>`_
1414
A simple kernel for bash, written using this machinery
1515

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``.
18+
See `Octave Kernel <https://github.com/Calysto/octave_kernel>`_ as an example.
19+
20+
1621
Required steps
1722
--------------
1823

@@ -24,7 +29,7 @@ following methods and attributes:
2429
.. attribute:: implementation
2530
implementation_version
2631
banner
27-
32+
2833
Information for :ref:`msging_kernel_info` replies. 'Implementation' refers
2934
to the kernel (e.g. IPython), rather than the language (e.g. Python).
3035
The 'banner' is displayed to the user in console
@@ -43,9 +48,9 @@ following methods and attributes:
4348
Other keys may be added to this later.
4449

4550
.. method:: do_execute(code, silent, store_history=True, user_expressions=None, allow_stdin=False)
46-
51+
4752
Execute user code.
48-
53+
4954
:param str code: The code to be executed.
5055
:param bool silent: Whether to display output.
5156
:param bool store_history: Whether to record this code in history and
@@ -55,7 +60,7 @@ following methods and attributes:
5560
after the code has run. You can ignore this if you need to.
5661
:param bool allow_stdin: Whether the frontend can provide input on request
5762
(e.g. for Python's :func:`raw_input`).
58-
63+
5964
Your method should return a dict containing the fields described in
6065
:ref:`execution_results`. To display output, it can send messages
6166
using :meth:`~ipykernel.kernelbase.Kernel.send_response`.
@@ -131,25 +136,25 @@ relevant section of the :doc:`messaging spec <messaging>`.
131136
.. method:: do_complete(code, cursor_pos)
132137

133138
Code completion
134-
139+
135140
:param str code: The code already present
136141
:param int cursor_pos: The position in the code where completion is requested
137-
142+
138143
.. seealso::
139-
144+
140145
:ref:`msging_completion` messages
141146

142147
.. method:: do_inspect(code, cursor_pos, detail_level=0)
143148

144149
Object introspection
145-
150+
146151
:param str code: The code
147152
:param int cursor_pos: The position in the code where introspection is requested
148153
:param int detail_level: 0 or 1 for more or less detail. In IPython, 1 gets
149154
the source code.
150-
155+
151156
.. seealso::
152-
157+
153158
:ref:`msging_inspection` messages
154159

155160
.. method:: do_history(hist_access_type, output, raw, session=None, start=None, stop=None, n=None, pattern=None, unique=False)
@@ -159,27 +164,27 @@ relevant section of the :doc:`messaging spec <messaging>`.
159164
for all the arguments shown with defaults here.
160165

161166
.. seealso::
162-
167+
163168
:ref:`msging_history` messages
164169

165170
.. method:: do_is_complete(code)
166-
171+
167172
Is code entered in a console-like interface complete and ready to execute,
168173
or should a continuation prompt be shown?
169-
174+
170175
:param str code: The code entered so far - possibly multiple lines
171-
176+
172177
.. seealso::
173-
178+
174179
:ref:`msging_is_complete` messages
175180

176181
.. method:: do_shutdown(restart)
177182

178183
Shutdown the kernel. You only need to handle your own clean up - the kernel
179184
machinery will take care of cleaning up its own things before stopping.
180-
185+
181186
:param bool restart: Whether the kernel will be started again afterwards
182-
187+
183188
.. seealso::
184-
189+
185190
:ref:`msging_shutdown` messages

0 commit comments

Comments
 (0)