/jupyter-scala

Lightweight Scala kernel for Jupyter / IPython 3

Primary LanguageScala

Jupyter Scala

Jupyter Scala is a Scala kernel for Jupyter / IPython. It's a lightweight alternative to IScala, being easily embeddable in other apps / libraries and being based on the great wrapper around the scalac internals from Ammonite (my fork of it actually).

Build Status

This README is being updated, taking into account things recently pushed. You can have a look at its updated draft. Below is the now deprecated README of the previous main development branch.


Quick start

Ensure you have IPython 3 installed. ipython --version should return a value >= 3.0. If it's not the case, a quick way of setting it up consists in installing the Anaconda Python distribution, and then running

$ pip install --upgrade "ipython[all]"

ipython --version should then return a value >= 3.0.

Download the Jupyter Scala binaries for Scala 2.10 (txz or zip) or Scala 2.11 (txz or zip), and unpack them in a safe place. Then run once the jupyter-scala program (or jupyter-scala.bat on Windows) it contains. That will set-up the Jupyter Scala kernel for the current user.

Check that IPython knows about Jupyter Scala by running

$ ipython kernelspec list

This should print, among others, a line like

scala211

(or scala210 dependending on the Scala version you chose).

Then run either IPython console with

$ ipython console --kernel scala211

and start using the Jupyter Scala kernel straightaway, or run IPython Notebook with

$ ipython notebook

and create Scala 2.11 notebooks by choosing Scala 2.11 in the dropdown in the upper right of the IPython Notebook start page.

Examples

Some example notebooks can be found in the examples directory: you can follow macrology 201 in a notebook, use compiler plugins like simulacrum from notebooks, use a type level library to parse CSV, setup a notebook for psp-std etc. More to come.

Internals

Jupyter Scala is a bridge between (my fork of the) Ammonite's wrappers around the Scala compiler, and the Jupyter kernel facilities put in Jupyter kernel.

Compiling it

Build your own binaries from the sources with

$ git clone https://github.com/alexarchambault/jupyter-scala.git
$ cd jupyter-scala
$ sbt cli/packArchive

This will generate a tar archive like jupyter-scala-cli-0.2.0-SNAPSHOT.tar.gz in cli/target/. See the instructions above for how to set it up then.

Released under the Apache 2.0 license, see LICENSE for more details.