Giter VIP home page Giter VIP logo

beakerx's Introduction

banner

BeakerX: Beaker extensions for Jupyter

BeakerX is a collection of JVM kernels and interactive widgets for plotting, tables, autotranslation, and other extensions to Jupyter Notebook and Jupyter Lab version 1.2.x and 2.x.

Version 2.x of BeakerX improves on the original solution architecture by providing independent modules that end-users can install to better tune the platform.

The documentation consists of tutorial notebooks on GitHub and a cheatsheet.

BeakerX is the successor to the Beaker Notebook (source code archive). It comes from Two Sigma Open Source. Yes we are hiring.

How to use

To install BeakerX and all kernels use:

conda install -c beakerx beakerx_all

To install only part of the solution choose which kernels to install:

conda install -c beakerx beakerx_kernel_groovy
conda install -c beakerx beakerx_kernel_java
conda install -c beakerx beakerx_kernel_scala
conda install -c beakerx beakerx_kernel_sql
conda install -c beakerx beakerx_kernel_clojure
conda install -c beakerx beakerx_kernel_kotlin

And then install optional packages:

conda install -c beakerx beakerx_kernel_autotranslation
conda install -c beakerx beakerx_tabledisplay
conda install -c beakerx beakerx_widgets

To install BeakerX extensions inside Jupyter Lab 1.2 use

// ensure you have yarn, nodejs and npm installed
conda install -c conda-forge jupyterlab=1.2
conda install -c beakerx beakerx_all

To install BeakerX extensions inside Jupyter Lab 2.x use

// ensure you have yarn, nodejs and npm installed
conda install -c conda-forge jupyterlab=2
conda install -c beakerx beakerx_all

Features

JVM kernels with Interactive Plotting:

screen shot

This feature requires all optional packages.

Autotranslation from Python to JavaScript and D3

screen shot

This feature requires beakerx_kernel_autotranslation package.

Interactive Tables

screen shot

This feature requires beakerx_tabledisplay package.

FAQs

See FAQ.md.

Attribution

BeakerX contains and depends on many projects including:

The kernel is originally derived from lappsgrid, but has been rewritten in Java and refactored and expanded.

The Java support uses Adrian Witas' org.abstractmeta.toolbox.

ANTLR Copyright (c) 2012 Terence Parr and Sam Harwell

d3 Copyright (c) 2010-2015, Michael Bostock

IPython Copyright (c) 2008-2014, IPython Development Team Copyright (c) 2001-2007, Fernando Perez Copyright (c) 2001, Janko Hauser Copyright (c) 2001, Nathaniel Gray

The table of contents and init cells extensions come from: IPython-contrib Copyright (c) 2013-2015, IPython-contrib Developers

Scala Copyright (c) 2002-2015 EPFL Copyright (c) 2011-2015 Typesafe, Inc.

Guava Copyright (C) 2012 The Guava Authors

Apache Spark Copyright (C) 2014 and onwards The Apache Software Foundation.

H2 database engine This software contains unmodified binary redistributions for H2 database engine (http://www.h2database.com/), which is dual licensed and available under the MPL 2.0 (Mozilla Public License) or under the EPL 1.0 (Eclipse Public License). An original copy of the license agreement can be found at: http://www.h2database.com/html/license.html

beakerx's People

Contributors

benmccann avatar dependabot[bot] avatar efimovvladimir avatar gnestor avatar haobibo avatar ildipo avatar irjerad avatar jaroslawmalekcodete avatar jd557 avatar jmsdnns avatar jpallas avatar jszalek avatar klahrich avatar krnone avatar leetz avatar lmitusinski avatar mariuszjurowicz avatar markhalonen avatar mbtaylor avatar michalgce avatar piorek avatar prusswan avatar rbidas avatar ricklamers avatar rootty avatar samwincott avatar scottdraves avatar ssadedin avatar tsos-cla-tracker avatar wojciechowskim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

beakerx's Issues

Preserve loaded menu at app level instead of notebook or session level

Currently, if a menu is loaded dynamically (e.g. through plugin manager), the loaded menu will be gone once leaving the app. Also relatedly, there are different mechanisms exist in the system for specifying default menu plugins. These mechanisms should be unified and there should be any 1-st class menu items. The proposed plan is to add a menu config file and retrieve config from there.

Make able to update old default notebook and config file

Currently, the default notebook and config file sitting in the dot dir will not be updated once created. This prevents the newer version of default notebook and config to be deployed. We should apply version converter to update the old format files while preserving any user changes(maybe manual).

Can't re-evaluate Latex cells

  1. Make a Latex cell
  2. Type in '1+1'
  3. Press CTRL-ENTER
  4. Change the code to '1+2'
  5. Press CTRL-ENTER

The output doesn't update

Cannot save notebook or backup session due to nginx issue

To reproduce, open a new notebook and add a Python cell with the following content:

from pylab import *
import matplotlib.pyplot as plt
x = linspace(0, 5, 10)
y = x ** 2
figure() 
plot(x, y, 'r') 
xlabel('x')
ylabel('y') 
title('title')
show()

then try to save.

The Chrome console shows that the save request response with 500 server internal error.
Note that before evaluating the code cell or after evaluation, delete the output cell, the notebook saves fine. Only when the output cell appears (a PNG), the notebook file saving fails.

julia RDatasets won't load

on ubuntu

Pkg.add("RDatasets")

produces

ERROR: failed process: Process(sh -c 'cd /home/sheep/.julia/v0.2/.cache/RDatasets && git rev-parse --git-dir', ProcessExited(128)) [128]
in pipeline_error at process.jl:476
in readbytes at process.jl:430
in readall at process.jl:437
in dir at git.jl:12
in git at git.jl:18
in cmd at git.jl:23
in run at git.jl:24
in set_remote_url at git.jl:96
in prefetch at pkg/cache.jl:40
in resolve at pkg/entry.jl:341
in resolve at pkg/entry.jl:316
in edit at pkg/entry.jl:24
in add at pkg/entry.jl:44
in add at pkg/entry.jl:48
in anonymous at pkg/dir.jl:28
in cd at file.jl:22
in cd at pkg/dir.jl:28
in add at pkg.jl:19

do not require restart for new plugin

if you load a plugin that hasn't been seen before, then beaker requests a restart.
instead it should rewrite nginx config and then just send it a HUP.
if this leaves existing connections unmodified then it should work.
if it works we can eliminate the ~/.beaker/plugins file.

Support IPython Latex display

The following should all work in Python. None of them currently do.

from IPython.display import Latex
Latex("$x_i$")
from IPython.display import Math
Math(r'x_i')
%%latex
$x_i$

Updated Ubuntu branch has broken groovysh comet handshake

Somewhere in the process of resolving merge conflicts between master and the ubuntu branch or somewhere in a new commit, something has gone awry. I'll see what I can figure out but if it is obvious to anyone else, please let me know.

15:53:51.144 [QUIET] [system.out] nginx-stderr>2014/03/06 15:53:51 [error] 26272#0: *418 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: , request: "POST /groovysh/cometd/handshake HTTP/1.1", upstream: "http://127.0.0.1:8806/cometd/handshake", host: "mojotech-mcd:8801", referrer: "http://mojotech-mcd:8801/beaker/"

Prevent duplicate menu items

Currently there is no mechanism to remove or replace menu items. This is desirable if customized environment wants to override menu items. One example of this is the 'Tutorial' menu item in the Help menu.

Refactor Beaker routing URL's

Now that we switched to use query parameters for path (ae60c5b), however, the path is still composed with prefixes that could indicate file format (ipynb, bkr) and/or file location (file system, http, dropbox, or other proprietary storages), which is undesirable.

I propose that the beaker URL should reflect the following info to be used in the session model with query parameters:

  1. path, (e.g. /User/PyaneDiaz/myNotebook.bkr, or http://raw.github.com/abc/xyz.ipynb)
  2. pathType (e.g. "file", "http", optional, if not provided, beaker should infer from the path)
  3. fileType (e.g. bkr, ipynb. optional, if not provided, ideally beaker should read the file then guess)

More details about the proposal:

  • The “/open” URL should be transient, it should load the file specified to be opened then create a session by redirecting to “/session”.
  • The /open URL should use query parameters: path, pathType(optional), fileType(maybe optional),
  • Alternatively, /open URL can be “/open/:uri” which should fall back to treat the uri arg as path and opts out on pathType and fileType. Also, the uri can be ‘new’ which opens a new session by loading the default notebook.
  • The session URL should be as simple as “/session/:id”, user should refer to other part of UI (other than the browser address bar) for location of the file loaded.

Initialization cell doesn't work

To reproduce, create a notebook with one IPython cell, make input cell body: 1+1, and make the code cell initialization cell. Save the notebook book to a file.

And then in Beaker, open the notebook from file, the output cell of the code cell displays "pending" and never updates further.

menus adapt to narrow window too soon and incorrectly

our top menus turn into an icon even though the window is plenty wide enough to show them all. and then, if you click this, the navigation is horrible. this screencap is on ubuntu but i see a similar problem on mac. perhaps it works on mobile?

screenshot from 2014-02-22 19 33 43

copyrights in html templates are not removed

so final page is full of many copies of

<!--
Copyright 2014 TWO SIGMA INVESTMENTS, LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->

Notify user on save errors

  1. Make a new notebook
  2. File -> Save
  3. Enter "/asdf" and click save

You'll get an exception in the console but no feedback within Beaker. (Assuming you're not root)

notebook namespace

We need a way to communicate between cells from different evaluators. I propose this be done with a notebook namespace: a collection of variables that are part of the document model. Their values would be JSON.

Access to the variables would be by a module "beaker" written for each plugin and loaded automatically. As a baseline we would use strings for the variables with a basic get/set API: beaker.get("x") and beaker.set("x", 1). Some languages in particular Javascript might be able to better and you could just say beaker.x and beaker.x = 1. Maybe, but we could live without it.

The big question is where the namespace is stored. Since the namespace is part of the document model (including for example be saved in the notebook), naturally it should primarily exist there, in the JS in the web browser. But if code in plugin X accesses a value, it would have to make a REST call to Beaker core, which would then use comet to get the value. This round-trip could be expensive. So I propose keeping a copy of the namespace in Beaker Core, and using comet to keep the two copies synchronized. REST calls are not as fast as in-memory access but avoiding going over the WAN could be a huge win.

Mostly this synchronization can be done after the caller returns. The danger is that you will write to one side and then evaluate a cell on the other side that reads it before it has been updated. Without some kind of locking this would be possible because different channels are used for each plugin and the core. So when accessing the namespace you would have to block until you were guaranteed to get the right value. Along with the cell evaluation results you could return a flag that said there might be namespace changes coming. Similarly with the cell evaluation call you can have a flag that there might be changes coming. In both cases you only block if you need access.

This is just a performance optimization, so a first pass at implementation should probably stick with keeping one copy in the JS.

It would be possible to keep it just in the Core and not in the client. I think they are most likely to be accessed from JS though (for application development and for saving the document). Another possibility is to keep a copy in every plugin, but that would be expensive in memory, though it does give very fast access.

The big alternative to this is using cell evaluation results as the bus. Ie in one cell referring to the output of another cell. This has two problems, one is there's no obvious name to use, and two because values are not explicitly shared the optimization of duplicating the namespace becomes impractical.

R plugin uses fixed port

which means only one instance of beaker can run R.
the solution is to allocate the port dynamically along with the rest in our block.
then pass it to the connection: RConnection(java.lang.String host, int port)
and in the Rserve script (which would have to be written dynamically too)
run.Rserve(port=9999)

Middle click into control panel doesn't update it

  1. Go to control panel
  2. Make a new notebook
  3. Middle click the Beaker logo to open control panel in a new tab

The new notebook is not present in the list. It does show up if you left click the control panel instead of middle click.

IPython autocomplete sometime doesn't work

for example try to complete this code:
open('/Users/') by moving the cursor to between / and ' (at the end of "/Users"), hit Ctrl+space, it becomes something like:
open('//Users/alee/)
while expected result should be:
open('/Users/alee/')

Reopening the same notebook doesn't work

  1. Open the tutorial
  2. Click Help -> Tutorial notebook again

The tutorial should reload, but it doesn't. The same problem happens if you load something with File -> recent and then try the same thing again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.