Open maxandersen opened 1 year ago
just leaving it here to share - not sure if can become something provided. like a --jbang
option to the installer.
like, doing this on google colab:
!pip3 install jbang
import jbang
jbang.exec("--java", "21", "io.github.padreati:rapaio-jupyter-kernel:RELEASE", "-i", "-auto").stdout
rapaio jupyter actually becomes available as a possible runtime to select.
now imagine if we had a --jbang option or somehow could have it generate with java call to jbang install java 21...that could be interesting for #24
I did try this on collab:
%%bash
echo '{
"argv": [
"/root/.jbang/bin/jbang",
"--verbose",
"--enable-preview",
"--java",
"21",
"-R--add-modules",
"-Rjava.base,jdk.incubator.vector",
"io.github.padreati:rapaio-jupyter-kernel:RELEASE",
"{connection_file}"
],
"display_name": "Java (JBang Rapaio Jupyter)",
"language": "java",
"interrupt_mode": "message",
"env": {
"RJK_COMPILER_OPTIONS": "",
"RJK_INIT_SCRIPT": "",
"RJK_TIMEOUT_MILLIS": "-1"
}
}' > /root/.local/share/jupyter/kernels/rapaio-jupyter-kernel/kernel.json
and it does regsiter but then I realized the ipc issue in #24 prevents this from working anyway.
bummer :)
so I managed to get this working. not only with rapaio but with other java kernels.
!pip install jbang
import jbang
jbang.exec("trust add https://github.com/jupyter-java")
jbang.exec("install-kernel@jupyter-java rapaio")
On google colab if detected it will wire up an ipc proxy.
Started documenting this and more at https://github.com/jupyter-java.
Impressive work. I will advertise that as the default option for installing the kernel. The more I know about jbang, the more I like it. I tried that and my preferred way is to add the --enable-preview option.
!pip install jbang
import jbang
jbang.exec("trust add https://github.com/jupyter-java")
jbang.exec("install-kernel@jupyter-java rapaio --enable-preview")
This works too, directly from jbang
without the pip
stage (thanks to the https://github.com/jupyter-java/jbang-catalog):
$ jbang install-kernel@jupyter-java rapaio
Or maybe it only works because I also installed the jbang
module in Python?
@maxandersen are you maintaining that jupyter-java repo? I submitted a couple of PRs ages ago, e.g: https://github.com/jupyter-java/jbang-catalog/pull/2.
@dsyer damn - somehow i missed those! let me check!
I realized that this is possible:
add a kernel.json with this:
no install of the .jar necessary and you can use RELEASE like here or specific version and you have rapaio working on your jupyter :)