From a66bd117ba52b60581f853bc3996d573b8fdbd9a Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 4 Mar 2024 09:58:58 -0600 Subject: [PATCH] Add docs about packaging kernels (#1013) --- docs/kernels.rst | 17 +++++++++++++++++ docs/wrapperkernels.rst | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/kernels.rst b/docs/kernels.rst index 60b1edd0..ca042c99 100644 --- a/docs/kernels.rst +++ b/docs/kernels.rst @@ -184,3 +184,20 @@ To start the terminal console or the Qt console with a specific kernel:: The notebook offers you the available kernels in a dropdown menu from the 'New' button. + + +.. _packaging-kernels: + +Packaging +========= + +To release your kernel as a Python package, we recommend following the pattern +used in the :ref:`echo_kernel`, which uses the `hatch`_ build backend and +a build file that creates the kernel directory with the ``kernel.json`` and +kernel icons, which is included as ``shared-data``, ending up in the +``share/jupyter/kernels/`` folder in the user's installed environment. +See `pyproject.toml`_ and `hatch_build.py`_ for more details. + +.. _hatch: https://hatch.pypa.io/latest/ +.. _pyproject.toml: https://github.com/jupyter/echo_kernel/blob/main/pyproject.toml +.. _hatch_build.py: https://github.com/jupyter/echo_kernel/blob/main/hatch_build.py diff --git a/docs/wrapperkernels.rst b/docs/wrapperkernels.rst index 1dd9fd41..46931099 100644 --- a/docs/wrapperkernels.rst +++ b/docs/wrapperkernels.rst @@ -19,6 +19,7 @@ also has a ``ProcessKernel`` subclass that makes it easy to write kernels that use ``pexpect``. See `Octave Kernel `_ as an example. +If releasing a wrapper kernel as a Python package, see the steps in :ref:`packaging-kernels`. Required steps -------------- @@ -86,7 +87,7 @@ Example .. seealso:: - `echo_kernel `__ + `echo_kernel `_ A packaged, installable version of the condensed example below. ``echokernel.py`` will simply echo any input it's given to stdout::