The sources of the scala kernel have such an example demo kernel under this directory.
See the sources for its dependencies. Currently, these are only
"sh.almond" %% "kernel" % "0.6.0"
"com.github.alexarchambault" %% "case-app" % "2.0.0-M2"
Note that case-app can be replaced by the command-line parsing library of your choice.
The demo kernel mainly consists in
EchoInterpreter, an implementation of
almond.interpreter.Interpreter, and in
EchoKernel, a small application that either installs the kernel, or actually runs it when it is launched by Jupyter.
When implementing a custom kernel, you may want to re-use almost as is
EchoKernel, instantiating your own
Interpreter instead of
EchoInterpreter. You may optionally handle command-line arguments differently, or add extra command-line options to pass to your
For the kernel installation to work out-of-the-box, the kernel should to be launched via coursier in one way or another. (It is possible nonetheless to rely on e.g. uber JARs, by tweaking the
command fields of
InstallOptions). To test your kernel locally, publish it locally via a
publishLocal from sbt. Note its organization, module name, and version. Then create a launcher for your kernel with
$ coursier bootstrap --embed-files=false \ organization:module-name_2.1?:version \ -o kernel
and install your kernel with
$ ./kernel --install