Skip to content
This repository was archived by the owner on Feb 4, 2022. It is now read-only.

Commit a3c34b9

Browse files
authored
Merge pull request #46 from hadim/polyglot
Turn the Scijava kernel into a polyglot kernel
2 parents da112ac + 9068f17 commit a3c34b9

24 files changed

+286
-327
lines changed

.ci/test.sh

+13-13
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,23 @@ export IJ_PATH="$HOME/Fiji.app"
2626
export IJ_LAUNCHER="$IJ_PATH/ImageJ-linux64"
2727

2828
JAVA_COMMAND_CLASS="org.scijava.jupyter.commands.InstallScijavaKernel"
29-
$IJ_LAUNCHER --ij2 --headless --run $JAVA_COMMAND_CLASS "logLevel=\"info\",pythonBinaryPath=\"$(which python)\",installAllKernels=true"
29+
$IJ_LAUNCHER --ij2 --headless --run $JAVA_COMMAND_CLASS "logLevel=\"info\",pythonBinaryPath=\"$(which python)\""
3030

3131
jupyter kernelspec list
3232

3333

3434
# Now run some notebooks
3535

36-
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava-python" "$TRAVIS_BUILD_DIR/notebooks/Welcome.ipynb"
37-
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava-groovy" "$TRAVIS_BUILD_DIR/notebooks/General.ipynb"
38-
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava-python" "$TRAVIS_BUILD_DIR/notebooks/Rich Output.ipynb"
39-
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava-python" "$TRAVIS_BUILD_DIR/notebooks/On-The-Fly Grabbing.ipynb"
40-
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava-groovy" "$TRAVIS_BUILD_DIR/notebooks/ImageJ.ipynb"
41-
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava-groovy" "$TRAVIS_BUILD_DIR/notebooks/Scijava.ipynb"
42-
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava-python" "$TRAVIS_BUILD_DIR/notebooks/languages/Python.ipynb"
43-
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava-groovy" "$TRAVIS_BUILD_DIR/notebooks/languages/Groovy.ipynb"
44-
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava-scala" "$TRAVIS_BUILD_DIR/notebooks/languages/Scala.ipynb"
45-
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava-clojure" "$TRAVIS_BUILD_DIR/notebooks/languages/Clojure.ipynb"
46-
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava-beanshell" "$TRAVIS_BUILD_DIR/notebooks/languages/Beanshell.ipynb"
47-
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava-javascript" "$TRAVIS_BUILD_DIR/notebooks/languages/Javascript.ipynb"
36+
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava" "$TRAVIS_BUILD_DIR/notebooks/Welcome.ipynb"
37+
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava" "$TRAVIS_BUILD_DIR/notebooks/General.ipynb"
38+
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava" "$TRAVIS_BUILD_DIR/notebooks/Rich Output.ipynb"
39+
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava" "$TRAVIS_BUILD_DIR/notebooks/On-The-Fly Grabbing.ipynb"
40+
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava" "$TRAVIS_BUILD_DIR/notebooks/ImageJ.ipynb"
41+
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava" "$TRAVIS_BUILD_DIR/notebooks/Scijava.ipynb"
42+
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava" "$TRAVIS_BUILD_DIR/notebooks/languages/Python.ipynb"
43+
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava" "$TRAVIS_BUILD_DIR/notebooks/languages/Groovy.ipynb"
44+
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava" "$TRAVIS_BUILD_DIR/notebooks/languages/Scala.ipynb"
45+
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava" "$TRAVIS_BUILD_DIR/notebooks/languages/Clojure.ipynb"
46+
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava" "$TRAVIS_BUILD_DIR/notebooks/languages/Beanshell.ipynb"
47+
#jupyter nbconvert --execute --ExecutePreprocessor.timeout="60" --ExecutePreprocessor.kernel_name="scijava" "$TRAVIS_BUILD_DIR/notebooks/languages/Javascript.ipynb"
4848

README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ conda create --name java_env scijava-jupyter-kernel
4545
# Activate the `java_env` environment
4646
source install java_env
4747

48-
# Check the kernels have been installed
48+
# Check the kernel has been installed
4949
jupyter kernelspec list
5050

5151
# Launch your favorite Jupyter client
@@ -63,18 +63,17 @@ jupyter lab
6363
- Drop it in your Fiji plugins directory.
6464
- Start Fiji and launch `Analyze > Jupyter Kernel > Install Scijava Kernel`.
6565
- Set the path to your Python binary.
66-
- Choose a language (for example `jython` or `groovy`) or you can choose to install all the available languages.
6766
- Choose a log level.
6867

69-
- Check the kernels have been installed with : `jupyter kernelspec list`.
68+
- Check the kernel has been installed with : `jupyter kernelspec list`.
7069
- Launch `jupyter notebook` or `jupyter lab` and **select the kernel you want in the kernel list**.
7170

7271
![Scijava Jupyter Kernel Installation](teaser.gif)
7372

7473
## Development
7574

7675
- [CI with Travis](https://travis-ci.org/hadim/scijava-jupyter-kernel) makes sure the project builds without errors for each new commit.
77-
- All the [notebook examples](./notebooks) are executed by the kernel during CI with [nbconvert](http://nbconvert.readthedocs.io/en/latest/execute_api.html).
76+
- All the [notebook examples](./notebooks) are executed by the kernel during CI with [nbconvert](http://nbconvert.readthedocs.io/en/latest/execute_api.html) (currently not working).
7877
- A [Conda package](https://github.com/conda-forge/scijava-jupyter-kernel-feedstock) is built for each new release.
7978

8079
## License

notebooks/General.ipynb

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
}
1818
],
1919
"source": [
20-
"// TODO"
20+
"// Highlight here the polyglot features"
2121
]
2222
},
2323
{
@@ -37,13 +37,13 @@
3737
"name": "scijava-groovy"
3838
},
3939
"language_info": {
40-
"codemirror_mode": "Groovy",
41-
"file_extension": "[groovy]",
42-
"mimetype": "[]",
43-
"name": "Groovy",
40+
"codemirror_mode": "groovy",
41+
"file_extension": "",
42+
"mimetype": "",
43+
"name": "scijava",
4444
"nbconverter_exporter": "",
45-
"pygments_lexer": "Groovy",
46-
"version": "1.5.6"
45+
"pygments_lexer": "groovy",
46+
"version": "1.0"
4747
}
4848
},
4949
"nbformat": 4,

notebooks/ImageJ.ipynb

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
}
1818
],
1919
"source": [
20+
"#!groovy\n",
2021
"// @ImageJ ij\n",
2122
"// @NotebookService nb"
2223
]

notebooks/On-The-Fly Grabbing.ipynb

+7-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
},
99
"outputs": [],
1010
"source": [
11+
"#!python\n",
1112
"# TODO"
1213
]
1314
},
@@ -28,13 +29,13 @@
2829
"name": "scijava-python"
2930
},
3031
"language_info": {
31-
"codemirror_mode": "Python",
32-
"file_extension": "[py]",
33-
"mimetype": "[text/python, application/python, text/x-python, application/x-python]",
34-
"name": "Python",
32+
"codemirror_mode": "groovy",
33+
"file_extension": "",
34+
"mimetype": "",
35+
"name": "scijava",
3536
"nbconverter_exporter": "",
36-
"pygments_lexer": "Python",
37-
"version": "2.7"
37+
"pygments_lexer": "groovy",
38+
"version": "1.0"
3839
}
3940
},
4041
"nbformat": 4,

notebooks/Rich Output.ipynb

+7-6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
}
1818
],
1919
"source": [
20+
"#!python\n",
2021
"# @NotebookService nb"
2122
]
2223
},
@@ -282,13 +283,13 @@
282283
"name": "scijava-python"
283284
},
284285
"language_info": {
285-
"codemirror_mode": "Python",
286-
"file_extension": "[py]",
287-
"mimetype": "[text/python, application/python, text/x-python, application/x-python]",
288-
"name": "Python",
286+
"codemirror_mode": "groovy",
287+
"file_extension": "",
288+
"mimetype": "",
289+
"name": "scijava",
289290
"nbconverter_exporter": "",
290-
"pygments_lexer": "Python",
291-
"version": "2.7"
291+
"pygments_lexer": "groovy",
292+
"version": "1.0"
292293
}
293294
},
294295
"nbformat": 4,

notebooks/Scijava.ipynb

+10-9
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
}
2727
],
2828
"source": [
29+
"#!groovy\n",
2930
"// @ImageJ ij\n",
3031
"\n",
3132
"// The plugin service manages the available plugins (see \"Plugins\" below).\n",
@@ -52,7 +53,7 @@
5253
{
5354
"data": {
5455
"text/plain": [
55-
"java.util.concurrent.FutureTask@2915ef5b"
56+
"java.util.concurrent.FutureTask@cae6b0b"
5657
]
5758
},
5859
"execution_count": 2,
@@ -105,7 +106,7 @@
105106
{
106107
"data": {
107108
"text/plain": [
108-
"java.util.concurrent.FutureTask@72e027c6"
109+
"java.util.concurrent.FutureTask@abe9271"
109110
]
110111
},
111112
"execution_count": 3,
@@ -161,7 +162,7 @@
161162
"Module count: 1102\n",
162163
"Service count: 96\n",
163164
"SciJava version: 2.62.1\n",
164-
"Where is SciJava? file:/home/hadim/local/Fiji.app/jars/scijava-common-2.62.1.jar\n"
165+
"Where is SciJava? file:/opt/local/Fiji.app/jars/scijava-common-2.62.1.jar\n"
165166
]
166167
},
167168
{
@@ -200,13 +201,13 @@
200201
"name": "scijava-groovy"
201202
},
202203
"language_info": {
203-
"codemirror_mode": "Groovy",
204-
"file_extension": "[groovy]",
205-
"mimetype": "[]",
206-
"name": "Groovy",
204+
"codemirror_mode": "groovy",
205+
"file_extension": "",
206+
"mimetype": "",
207+
"name": "scijava",
207208
"nbconverter_exporter": "",
208-
"pygments_lexer": "Groovy",
209-
"version": "1.5.6"
209+
"pygments_lexer": "groovy",
210+
"version": "1.0"
210211
}
211212
},
212213
"nbformat": 4,

notebooks/Welcome.ipynb

+6-6
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@
4646
"name": "scijava-python"
4747
},
4848
"language_info": {
49-
"codemirror_mode": "Python",
50-
"file_extension": "[py]",
51-
"mimetype": "[text/python, application/python, text/x-python, application/x-python]",
52-
"name": "Python",
49+
"codemirror_mode": "groovy",
50+
"file_extension": "",
51+
"mimetype": "",
52+
"name": "scijava",
5353
"nbconverter_exporter": "",
54-
"pygments_lexer": "Python",
55-
"version": "2.7"
54+
"pygments_lexer": "groovy",
55+
"version": "1.0"
5656
}
5757
},
5858
"nbformat": 4,

notebooks/languages/Beanshell.ipynb

+24-14
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 2,
5+
"execution_count": 1,
66
"metadata": {},
77
"outputs": [
88
{
@@ -18,25 +18,26 @@
1818
"null"
1919
]
2020
},
21-
"execution_count": 2,
21+
"execution_count": 1,
2222
"metadata": {},
2323
"output_type": "execute_result"
2424
}
2525
],
2626
"source": [
27+
"#!Beanshell\n",
2728
"printBanner();"
2829
]
2930
},
3031
{
3132
"cell_type": "code",
32-
"execution_count": 5,
33+
"execution_count": 2,
3334
"metadata": {},
3435
"outputs": [
3536
{
3637
"name": "stdout",
3738
"output_type": "stream",
3839
"text": [
39-
"1493250700406\n",
40+
"1493774310652\n",
4041
"0\n",
4142
"1\n",
4243
"2\n",
@@ -50,7 +51,7 @@
5051
"null"
5152
]
5253
},
53-
"execution_count": 5,
54+
"execution_count": 2,
5455
"metadata": {},
5556
"output_type": "execute_result"
5657
}
@@ -67,22 +68,31 @@
6768
"for (int i=0; i<5; i++)\n",
6869
" print(i);"
6970
]
71+
},
72+
{
73+
"cell_type": "code",
74+
"execution_count": null,
75+
"metadata": {
76+
"collapsed": true
77+
},
78+
"outputs": [],
79+
"source": []
7080
}
7181
],
7282
"metadata": {
7383
"kernelspec": {
74-
"display_name": "Scijava - BeanShell",
75-
"language": "BeanShell",
76-
"name": "scijava-beanshell"
84+
"display_name": "Scijava",
85+
"language": "groovy",
86+
"name": "scijava"
7787
},
7888
"language_info": {
79-
"codemirror_mode": "BeanShell",
80-
"file_extension": "[bsh, bs]",
81-
"mimetype": "[]",
82-
"name": "BeanShell",
89+
"codemirror_mode": "groovy",
90+
"file_extension": "",
91+
"mimetype": "",
92+
"name": "scijava",
8393
"nbconverter_exporter": "",
84-
"pygments_lexer": "BeanShell",
85-
"version": "0.3.1"
94+
"pygments_lexer": "groovy",
95+
"version": "1.0"
8696
}
8797
},
8898
"nbformat": 4,

0 commit comments

Comments
 (0)