Skip to content

Commit

Permalink
Merge branch 'master' of github.com:twosigma/beakerx into lukasz/7204…
Browse files Browse the repository at this point in the history
…_do_not_relly_on_bootstrap_css
  • Loading branch information
piorek committed May 23, 2018
2 parents 5ad34ac + 0634949 commit 91d4990
Show file tree
Hide file tree
Showing 112 changed files with 517 additions and 284 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
[![NPM version](https://badge.fury.io/js/beakerx.svg)](http://badge.fury.io/js/beakerx)
[![PyPI Version](https://badge.fury.io/py/beakerx.svg)](http://badge.fury.io/py/beakerx)
[![Anaconda-Server Badge](https://anaconda.org/conda-forge/beakerx/badges/version.svg)](https://anaconda.org/conda-forge/beakerx)
[![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/twosigma/beakerx/0.17.0?filepath=StartHere.ipynb)
[![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/twosigma/beakerx/0.17.1?filepath=StartHere.ipynb)

BeakerX is a collection of JVM kernels and interactive widgets for
plotting, tables, autotranslation, and other extensions to Jupyter
Notebook. BeakerX is in beta and under active development.

The [documentation](https://github.com/twosigma/beakerx/blob/master/StartHere.ipynb) consists of tutorial notebooks on GitHub.
You can try it in the cloud for free with [Binder](https://mybinder.org/v2/gh/twosigma/beakerx/0.17.0?filepath=StartHere.ipynb).
You can try it in the cloud for free with [Binder](https://mybinder.org/v2/gh/twosigma/beakerx/0.17.1?filepath=StartHere.ipynb).

BeakerX is the successor to the [Beaker Notebook (source code
archive)](https://github.com/twosigma/beaker-notebook-archive). It
Expand Down
2 changes: 1 addition & 1 deletion StartHere.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"[Python](doc/python/AutoTranslation.ipynb), [Groovy](doc/groovy/AutoTranslation.ipynb).\n",
"\n",
"### Groovy Plotting and Charting\n",
"[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), [Second Y Axis](doc/groovy/2ndYaxis.ipynb).\n",
"[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), [Second Y Axis](doc/groovy/2ndYaxis.ipynb), [3D Visualization and Maps](doc/groovy/3D.ipynb).\n",
"\n",
"### Table Display\n",
"[Groovy API including Actions](doc/groovy/TableAPI.ipynb), [64-Bit Integers and BigNums](doc/groovy/BigInts.ipynb), [Automatic Display of Simple Data Structures](doc/groovy/MapLikeTable.ipynb), [Handling of Large Tables](doc/groovy/BigTable.ipynb).\n",
Expand Down
2 changes: 1 addition & 1 deletion beakerx/beakerx/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version_info = (0, 17, 0)
version_info = (0, 17, 1)
__version__ = '.'.join(map(str, version_info))
63 changes: 63 additions & 0 deletions doc/groovy/3D.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 3D Visualization and Maps\n",
"\n",
"There is an alpha Groovy API for [ipyvolume](https://github.com/maartenbreddels/ipyvolume). For this to work, the widget JS needs to be installed:\n",
"```\n",
"conda install -c conda-forge ipyvolume\n",
"```\n",
"\n",
"[Pythreejs](https://github.com/jupyter-widgets/pythreejs) and [ipyleaflet](https://github.com/jupyter-widgets/ipyleaflet) will be forthcoming, see [#6903](https://github.com/twosigma/beakerx/issues/6903). We hope these APIs will be included upstream in the original widget repositories."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%classpath config resolver jitpack.io https://jitpack.io\n",
"%classpath add mvn com.github.twosigma:ipyvolume:master-SNAPSHOT\n",
"import ipyvolume.PyLab;\n",
"\n",
"int size = 32;\n",
"int radius = 12;\n",
"float[][][] data = new float[size][size][size];\n",
"for (int x = 0; x<size; x++){\n",
" for (int y = 0; y<size; y++){\n",
" for (int z = 0; z<size; z++){\n",
" if (Math.pow(x - size/2, 2) + Math.pow(y - size/2, 2) + Math.pow(z - size/2, 2) <= Math.pow(radius, 2)){\n",
" data[x][y][z] = 1.0f;\n",
" }\n",
" }\n",
" }\n",
"}\n",
"\n",
"figure = PyLab.volShow(data)"
]
}
],
"metadata": {
"anaconda-cloud": {},
"beakerx_kernel_parameters": {},
"kernelspec": {
"display_name": "Groovy",
"language": "groovy",
"name": "groovy"
},
"language_info": {
"codemirror_mode": "groovy",
"file_extension": ".groovy",
"mimetype": "",
"name": "Groovy",
"nbconverter_exporter": "",
"version": "2.4.3"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
18 changes: 4 additions & 14 deletions doc/groovy/LevelsOfDetails.ipynb
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -23,9 +16,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"// generate a random walk\n",
Expand All @@ -44,15 +35,14 @@
"}\n",
"// now x is time for the x-axis, and y is the random variable\n",
"beer = walk(10)\n",
"whiskey = walk(100)"
"whiskey = walk(100)\n",
"OutputCell.HIDDEN"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"p = new TimePlot(title: \"Drunken Sailor Walks\", showLegend: true, lodThreshold: 2000)\n",
Expand Down
9 changes: 8 additions & 1 deletion doc/groovy/PolyglotMagic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
"source": [
"# Polyglot Magics\n",
"\n",
"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.\n",
"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.\n",
"\n",
"There are also [Groovy Magics](../python/KernelMagics.ipynb) magics for accessing the JVM from Python.\n",
"\n",
"Fleshing out the polyglot support in BeakerX with communication between languages ([#5039](https://github.com/twosigma/beakerx/issues/5039)) is on the agenda.\n",
"\n",
"\n",
"\n",
"\n",
"## Python Magic\n",
"\n",
Expand Down
4 changes: 2 additions & 2 deletions doc/kotlin/Kotlin.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"# Kotlin\n",
"\n",
"[Kotlin](https://kotlinlang.org/) is a relative newcomer from [JetBrains](https://www.jetbrains.com/) and [Android](https://developer.android.com/kotlin/get-started.html). It's intended to an improved version of Java, including [Null Safety](https://kotlinlang.org/docs/reference/null-safety.html)."
"[Kotlin](https://kotlinlang.org/) is a relative newcomer from [JetBrains](https://www.jetbrains.com/) and [Android](https://developer.android.com/kotlin/get-started.html). It's intended to be an improved version of Java, including [Null Safety](https://kotlinlang.org/docs/reference/null-safety.html)."
]
},
{
Expand Down Expand Up @@ -58,7 +58,7 @@
"mimetype": "",
"name": "Kotlin",
"nbconverter_exporter": "",
"version": "1.1.3"
"version": "1.2.21"
}
},
"nbformat": 4,
Expand Down
6 changes: 4 additions & 2 deletions doc/python/KernelMagics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"BeakerX has magics for Python so you can run cells in the other languages.\n",
"The first few cells below show how complete the implementation is with Groovy, then we have just one cell in each other language.\n",
"\n",
"Fleshing out the polyglot support in BeakerX with communication between languages ([#5039](https://github.com/twosigma/beakerx/issues/5039)) and the ability to access Python from the JVM kernels ([#6279](https://github.com/twosigma/beakerx/issues/6279)) are on the agenda.\n",
"There are also [Polyglot Magics](../groovy/PolyglotMagic.ipynb) magics for accessing Python from the JVM.\n",
"\n",
"Fleshing out the polyglot support in BeakerX with communication between languages ([#5039](https://github.com/twosigma/beakerx/issues/5039)) is on the agenda.\n",
"\n",
"## Groovy"
]
Expand Down Expand Up @@ -246,7 +248,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
"version": "3.6.5"
}
},
"nbformat": 4,
Expand Down
2 changes: 0 additions & 2 deletions doc/scala/SparkUI.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"outputs": [],
"source": [
"%%spark\n",
"import org.apache.spark.sql.SparkSession\n",
"SparkSession.builder()\n",
" .appName(\"BeakerX Demo\")\n",
" .master(\"local[4]\")"
Expand All @@ -73,7 +72,6 @@
"outputs": [],
"source": [
"%%spark --connect\n",
"import org.apache.spark.sql.SparkSession\n",
"SparkSession.builder().master(\"local[100]\")"
]
},
Expand Down
2 changes: 1 addition & 1 deletion js/lab/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/lab/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "beakerx-jupyterlab",
"version": "0.17.0",
"version": "0.17.1",
"description": "BeakerX: Beaker Extensions for JupyterLab",
"author": "Two Sigma Open Source, LLC",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion js/notebook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "beakerx",
"version": "0.17.0",
"version": "0.17.1",
"description": "BeakerX: Beaker Extensions for Jupyter",
"author": "Two Sigma Open Source, LLC",
"main": "src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion js/notebook/src/SparkStateProgress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class SparkStateProgressView extends widgets.VBoxView {
let valueActive = state.active;
let valueWaiting = max - (valueDone + valueActive);

this.progressLabels = document.createElement('p');
this.progressLabels = document.createElement('div');
this.progressLabels.classList.add('bx-spark-stageProgressLabels');

this.progressLabels.innerHTML = `
Expand Down
6 changes: 5 additions & 1 deletion js/notebook/src/shared/style/beakerx.scss
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ $focusColor: #66bb6a;
font-size: 14px;
line-height: 1.3em;
flex-grow: 1;
max-width: 600px;
text-indent: 0;
transition: opacity 0.1s ease-in-out;
padding: 0 15px;
Expand All @@ -134,6 +133,11 @@ $focusColor: #66bb6a;
overflow: hidden;
white-space: nowrap;
}

p {
margin: 0;
padding: 0;
}
}

.foldout-content {
Expand Down
14 changes: 14 additions & 0 deletions js/notebook/src/shared/style/spark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
& > .bx-spark-stagePanel {
padding: 0 15px;
max-width: 600px;
margin: 0;
}
}

Expand Down Expand Up @@ -100,3 +101,16 @@
width: 50%;
}
}

.bx-spark-stageProgressLabels {
display: block;
line-height: 100%;
height: 18px;
align-items: center;

.label {
display: inline-block;
max-height: 100%;
line-height: 150%;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ public void handle(Message message) {

private void handleMsg(Message message) {
logger.debug("Processing kernel info request");
Message reply = new Message();
Message reply = new Message(new Header(KERNEL_INFO_REPLY, message.getHeader().getSession()));
reply.setContent(content());
reply.setHeader(new Header(KERNEL_INFO_REPLY, message.getHeader().getSession()));
reply.setParentHeader(message.getHeader());
reply.setIdentities(message.getIdentities());
send(reply);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public BaseEvaluator(String id, String sId, CellExecutor cellExecutor, TempFolde
}

protected TryResult evaluate(SimpleEvaluationObject seo, Callable<TryResult> callable) {
InternalVariable.setValue(seo);
Future<TryResult> submit = executorService.submit(callable);
TryResult either = null;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ private void handleMsg(Message message) {
}

private Message createMsg(Message message, int cursorPos, AutocompleteResult autocomplete) {
Message reply = new Message();
reply.setHeader(new Header(COMPLETE_REPLY, message.getHeader().getSession()));
Message reply = new Message(new Header(COMPLETE_REPLY, message.getHeader().getSession()));
reply.setIdentities(message.getIdentities());
reply.setParentHeader(message.getHeader());
Map<String, Serializable> content = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ private void handleMsg(Message message) {
}

private Message createMsg(Message message, InspectResult inspectResult) {
Message reply = new Message();
reply.setHeader(new Header(INSPECT_REPLY, message.getHeader().getSession()));
Message reply = new Message(new Header(INSPECT_REPLY, message.getHeader().getSession()));
reply.setIdentities(message.getIdentities());
reply.setParentHeader(message.getHeader());
Map<String, Serializable> content = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@ public void handle(Message message) {

private void handleMsg(Message message) {
logger.debug("Processing is complete request");
Message reply = new Message();
Message reply = new Message(new Header(IS_COMPLETE_REPLY, message.getHeader().getSession()));
HashMap<String, Serializable> map = new HashMap<>();
map.put("status", "complete");
reply.setContent(map);
reply.setHeader(new Header(IS_COMPLETE_REPLY, message.getHeader().getSession()));
reply.setParentHeader(message.getHeader());
reply.setIdentities(message.getIdentities());
send(reply);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,13 @@ private List<Message> getIopubMessages() throws IOException {

private Message parseMessage(String stringJson) throws IOException {
ObjectMapper mapper = new ObjectMapper();
Message msg = new Message();
JsonNode json = mapper.readTree(stringJson);
Message msg = new Message(mapper.convertValue(json.get("header"), Header.class));
msg.setContent(mapper.convertValue(json.get("content"), Map.class));
msg.setMetadata(mapper.convertValue(json.get("metadata"), Map.class));
msg.setBuffers(mapper.convertValue(json.get("buffers"), List.class));
List<byte[]> identities = mapper.convertValue(json.get("comm_id"), List.class);
msg.setIdentities(identities == null ? new ArrayList<>() : identities);
msg.setHeader(mapper.convertValue(json.get("header"), Header.class));
return msg;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ protected T getValueFromData(Message message, String key) {
protected Message createReplyMessage(Message message, Serializable responceData) {
Message ret = null;
if (message != null) {
ret = new Message();
ret = new Message(new Header(COMM_MSG, message.getHeader().getSession()));
Map<String, Serializable> commMap = message.getContent();
ret.setHeader(new Header(COMM_MSG, message.getHeader().getSession()));
HashMap<String, Serializable> map = new HashMap<>();
map.put(COMM_ID, getString(commMap, COMM_ID));
map.put(DATA, responceData);
Expand Down
Loading

0 comments on commit 91d4990

Please sign in to comment.