Skip to content

Commit 848f1b4

Browse files
committed
start documenting autotranslation
1 parent 1ecc938 commit 848f1b4

File tree

3 files changed

+141
-3
lines changed

3 files changed

+141
-3
lines changed

StartHere.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"[Properties, Heap Size, and other JVM Options](doc/groovy/JavaArgs.ipynb), [UI Options](doc/groovy/UIOptions.ipynb).\n",
2525
"\n",
2626
"## Autotranslation\n",
27-
"[Python](doc/python/AutoTranslation.ipynb), [Groovy](doc/groovy/AutoTranslation.ipynb).\n",
27+
"[Python to JS and D3](doc/python/AutoTranslation.ipynb), [Groovy to JS and D3](doc/groovy/AutoTranslation.ipynb),\n",
28+
"[General Autotranslation](doc/groovy/GeneralAutotranslation.ipynb).\n",
2829
"\n",
2930
"## Groovy Plotting and Charting\n",
3031
"[Example and Interaction](doc/groovy/Charting.ipynb), [Time Series and General APIs and Features](doc/groovy/PlotFeatures.ipynb), [Category Plots and Bar Charts](doc/groovy/CategoryPlot.ipynb), [Levels of Detail](doc/groovy/LevelsOfDetails.ipynb), [Histograms](doc/groovy/Histogram.ipynb), [Heatmaps](doc/groovy/Heatmap.ipynb), [Treemaps](doc/groovy/Treemap.ipynb), [Plot Actions](doc/groovy/PlotActions.ipynb), [Plot Seamless Updates](doc/groovy/PlotsPythonStyle.ipynb), [3D Visualization and Maps](doc/groovy/3D.ipynb).\n",
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# General Autotranslation\n",
8+
"\n",
9+
"The `beakerx` object synchronizes values between languages, including JavaScript, Python, Groovy, and the other JVM languages. BeakerX's current implementation works with metaprogramming and serializing the objects to JSON, so it's not recommended for more than a few MB of data. Using [Arrow](https://arrow.apache.org/) and shared memory to remove that limitation is on the [agenda](https://github.com/twosigma/beakerx/issues/7577).\n",
10+
"\n",
11+
"Start in Groovy:"
12+
]
13+
},
14+
{
15+
"cell_type": "code",
16+
"execution_count": null,
17+
"metadata": {},
18+
"outputs": [],
19+
"source": [
20+
"beakerx.foo = \"a groovy value\""
21+
]
22+
},
23+
{
24+
"cell_type": "markdown",
25+
"metadata": {},
26+
"source": [
27+
"Translate to JavaScript:"
28+
]
29+
},
30+
{
31+
"cell_type": "code",
32+
"execution_count": null,
33+
"metadata": {},
34+
"outputs": [],
35+
"source": [
36+
"%%javascript\n",
37+
"alert(beakerx.foo);\n",
38+
"beakerx.bar = [23, 48, 7, \"from JS\"];"
39+
]
40+
},
41+
{
42+
"cell_type": "markdown",
43+
"metadata": {},
44+
"source": [
45+
"And back to Groovy:"
46+
]
47+
},
48+
{
49+
"cell_type": "code",
50+
"execution_count": null,
51+
"metadata": {},
52+
"outputs": [],
53+
"source": [
54+
"beakerx.bar "
55+
]
56+
},
57+
{
58+
"cell_type": "markdown",
59+
"metadata": {},
60+
"source": [
61+
"Or Python:"
62+
]
63+
},
64+
{
65+
"cell_type": "code",
66+
"execution_count": null,
67+
"metadata": {},
68+
"outputs": [],
69+
"source": [
70+
"%%python\n",
71+
"beakerx.bar"
72+
]
73+
},
74+
{
75+
"cell_type": "markdown",
76+
"metadata": {},
77+
"source": [
78+
"Or Scala:"
79+
]
80+
},
81+
{
82+
"cell_type": "code",
83+
"execution_count": null,
84+
"metadata": {},
85+
"outputs": [],
86+
"source": [
87+
"%%scala\n",
88+
"beakerx.bar"
89+
]
90+
}
91+
],
92+
"metadata": {
93+
"beakerx_kernel_parameters": {},
94+
"classpath": [],
95+
"imports": [],
96+
"kernelspec": {
97+
"display_name": "Groovy",
98+
"language": "groovy",
99+
"name": "groovy"
100+
},
101+
"language_info": {
102+
"codemirror_mode": "groovy",
103+
"file_extension": ".groovy",
104+
"mimetype": "",
105+
"name": "Groovy",
106+
"nbconverter_exporter": "",
107+
"version": "2.4.3"
108+
},
109+
"toc": {
110+
"base_numbering": 1,
111+
"nav_menu": {},
112+
"number_sections": false,
113+
"sideBar": false,
114+
"skip_h1_title": false,
115+
"title_cell": "Table of Contents",
116+
"title_sidebar": "Contents",
117+
"toc_cell": false,
118+
"toc_position": {},
119+
"toc_section_display": false,
120+
"toc_window_display": false
121+
}
122+
},
123+
"nbformat": 4,
124+
"nbformat_minor": 1
125+
}

doc/groovy/PolyglotMagic.ipynb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
"\n",
1111
"There are also [Groovy Magics](../python/KernelMagics.ipynb) magics for accessing the JVM from Python.\n",
1212
"\n",
13-
"Fleshing out the polyglot support in BeakerX with communication between languages ([#5039](https://github.com/twosigma/beakerx/issues/5039)) is on the agenda.\n",
14-
"\n",
13+
"You can communicate between languages with [Autotranslation](GeneralAutotranslation.ipynb).\n",
1514
"\n",
1615
"\n",
1716
"\n",
@@ -123,6 +122,19 @@
123122
"name": "Groovy",
124123
"nbconverter_exporter": "",
125124
"version": "2.4.3"
125+
},
126+
"toc": {
127+
"base_numbering": 1,
128+
"nav_menu": {},
129+
"number_sections": false,
130+
"sideBar": false,
131+
"skip_h1_title": false,
132+
"title_cell": "Table of Contents",
133+
"title_sidebar": "Contents",
134+
"toc_cell": false,
135+
"toc_position": {},
136+
"toc_section_display": false,
137+
"toc_window_display": false
126138
}
127139
},
128140
"nbformat": 4,

0 commit comments

Comments
 (0)