Jupyter JVM Base Kernel

An abstract kernel implementation for Jupyter kernels running on the Java virtual machine.

License

License

GroupId

GroupId

io.github.spencerpark
ArtifactId

ArtifactId

jupyter-jvm-basekernel
Last Version

Last Version

2.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

Jupyter JVM Base Kernel
An abstract kernel implementation for Jupyter kernels running on the Java virtual machine.
Project URL

Project URL

https://github.com/SpencerPark/jupyter-jvm-basekernel
Source Code Management

Source Code Management

https://github.com/SpencerPark/jupyter-jvm-basekernel.git

Download jupyter-jvm-basekernel

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.spencerpark/jupyter-jvm-basekernel/ -->
<dependency>
    <groupId>io.github.spencerpark</groupId>
    <artifactId>jupyter-jvm-basekernel</artifactId>
    <version>2.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.spencerpark/jupyter-jvm-basekernel/
implementation 'io.github.spencerpark:jupyter-jvm-basekernel:2.3.0'
// https://jarcasting.com/artifacts/io.github.spencerpark/jupyter-jvm-basekernel/
implementation ("io.github.spencerpark:jupyter-jvm-basekernel:2.3.0")
'io.github.spencerpark:jupyter-jvm-basekernel:jar:2.3.0'
<dependency org="io.github.spencerpark" name="jupyter-jvm-basekernel" rev="2.3.0">
  <artifact name="jupyter-jvm-basekernel" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.spencerpark', module='jupyter-jvm-basekernel', version='2.3.0')
)
libraryDependencies += "io.github.spencerpark" % "jupyter-jvm-basekernel" % "2.3.0"
[io.github.spencerpark/jupyter-jvm-basekernel "2.3.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.zeromq : jeromq jar 0.5.1
com.google.code.gson : gson jar 2.8.5

test (3)

Group / Artifact Type Version
junit : junit jar 4.12
org.hamcrest : hamcrest-all jar 1.3
com.google.jimfs : jimfs jar 1.1

Project Modules

There are no modules declared in this project.

Jupyter JVM BaseKernel

This project is a Java implementation of the Jupyter kernel messaging spec. Consumers of this project need to simply extend the BaseKernel and implement the things specific to the language that the kernel is working for. A simple example using the Nashorn JS engine can be found in the examples folder.

All communication with the Jupyter client is done via JSON messages over ZMQ sockets and therefore this project is made possible by the pure Java ZeroMQ implementation, jeromq. Likewise for JSON serialization and deserialization the project is powered gson. These transitive dependencies should be included when distributing a kernel that depends on this base kernel but both have a nice license (MPL-2.0 and Apache-2.0 respectively) so this should not be an issue.

Adding as a dependency

Currently snapshots are being published to https://oss.sonatype.org/#nexus-search;quick~jupyter-jvm-basekernel. Release version are published to maven central.

Gradle users

Edit your build.gradle to include the following:

repositories {
    // If using a SNAPSHOT version, otherwise maven central is fine
    maven { url = 'https://oss.sonatype.org/content/repositories/snapshots/' }

    // If using a release version (no SNAPSHOT suffix)
    mavenCentral()
}

dependencies {
    compile group: 'io.github.spencerpark', name: 'jupyter-jvm-basekernel', version: '2.3.0'
}
Maven users

Edit your pom.xml to include the following:

<repositories>
  ...
  <!-- If using a SNAPSHOT version, otherwise maven central is fine -->
  <repository>
    <id>oss-sonatype-snapshots</id>
    <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
  </repository>
</repositories>

<dependencies>
  ...
  <dependency>
    <groupId>io.github.spencerpark</groupId>
    <artifactId>jupyter-jvm-basekernel</artifactId>
    <version>2.3.0</version>
  </dependency>
</dependencies>

Why use this base kernel?

Firstly don't use this kernel simply because you prefer a JVM language over python. If it is no trouble to use the python base, go for it! Consider that using a JVM project is going to require user to have a JVM installed which unless your project is already using it, is a big extra dependency.

Do use this kernel if your kernel's language is already running on the JVM. In this case Java is already a requirement and interfacing with your compiler/interpreter can be much easier when things are all in one process. For example a Groovy, kotlin, Clojure, Scala, MellowD (check this one out, it's great!), etc. kernels would already be running on the JVM and so this simply lets it speak to Jupyter or any other client that speaks the protocol. Check out Hydrogen, an atom extension for executing code inline by speaking with Jupyter kernels (this could be you!).

The implementation aims to cover the messaging protocol alone. It supports some base classes for naive autocomplete, history, comms, etc. to make getting started painless but this is all opt-in functionality that your implementation doesn't have to touch. At the very least you don't have to reinvent the wheel and can get started by interfacing with a high level communication layer that implements the messaging protocol.

BaseKernel

The base kernel requires, at a very minimum to get things up and running, an implementation for eval which evaluates some code in the kernel's language. In the Nashorn case this code is nashorn's flavour of javascript.

Versions

Version
2.3.0
2.2.3
2.2.2