Polyglot Magics

The BeakerX kernels have magics to run other kernels, including %%python. There are magics for each BeakerX langage: %%groovy, %%java, %%scala, %%sql, %%clojure, and %%kotlin. There is also a %%kernel magic to access any kernel available to Jupyter. Widgets work through these magics. These magics give access to Python from the JVM.

There are also Groovy Magics magics for accessing the JVM from Python.

You can communicate between languages with Autotranslation.

Python Magic

For example, even though this is a Groovy notebook, you can run Python code:


In [ ]:
%%python
print("regular")
{"output": "works"}

Widgets Work


In [ ]:
%%python
import ipywidgets as widgets
w = widgets.IntSlider()
w

In [ ]:
%%python
w.value

Scala Table


In [ ]:
%%scala
new TableDisplay(Seq(Map("a" -> 1, "b" -> 2, "c" -> 3),
                     Map("a" -> 4, "b" -> 5, "c" -> 6),
                     Map("a" -> 7, "b" -> 8, "c" -> 8)))

Kernel Magic

Access any kernel available to Jupyter by name:


In [ ]:
%%kernel ir
x <- rnorm(1000)
plot(x)

In [ ]:
%%kernel julia-0.6
(1 + 1im) * (1 - 1im)