[
https://issues.apache.org/jira/browse/TOREE-380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16045691#comment-16045691
]
ASF GitHub Bot commented on TOREE-380:
--------------------------------------
GitHub user rdblue reopened a pull request:
https://github.com/apache/incubator-toree/pull/104
TOREE-380: Allow interpreters to format output.
This branch has the changes that I made to our Toree distribution to allow
interpreters to format output. The goal is to enable better integration when
libraries are used with Toree, similar to conventions in IPython like
`_repr_html_` methods.
In IPython, classes can define a `_repr_html_` method that is used to
produce a `text/html` representation of an output object that is shown in the
Jupyter notebook. This branch adds a `Displayer` class that can be registered
with the Scala interpreter and updates the interpreter so that it fetches the
last object of an interpreted block and calls an appropriate displayer to get
its output representations. I think this is a reasonable way to maintain type
safety and allow libraries to produce HTML outputs in notebooks. I'm also
interested in using the plugin system to register these.
In addition, there are a few example displayer implementations:
* A SparkSession/SparkContext displayer that produces HTML links to the a
Spark application
* A [Vegas](https://github.com/vegas-viz/Vegas) displayer for graphs
* A MagicOutput displayer to avoid the need for post-processing
* A default displayer for AnyRef that calls toString and (as
proof-of-concept) uses reflection to call toHtml
Implementation required changing the way outputs from interpreters and
blocks are handled. Rather than an interpreter returning text, it now returns a
mime-type to content map (which has various type names). It also changes magic
to produce MagicOutput, instead of requiring post-processing.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/rdblue/incubator-toree
TOREE-380-add-result-content-map
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-toree/pull/104.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #104
----
commit 54340466c917d4ac10412305dee4773d09a4b015
Author: Ryan Blue <[email protected]>
Date: 2017-02-06T02:18:36Z
TOREE-380: Allow interpreters to produce output by MIME type.
This updates the interpreter API to return a Map of MIME type to content
instead of a String that is rendered as text. This allows interpreters
to show HTML as cell output.
This also updates the output of magic functions to be a similar MIME
type to content structure. This is cleaner and no longer requires
hacky post-processing before relaying a cell's output.
commit a78e9cb9b9c2f755c3b393a8144fe647fdb716bb
Author: Ryan Blue <[email protected]>
Date: 2017-04-10T01:42:17Z
TOREE-380: Add support for Jupyter's jvm-repr API.
commit fc9889015fa99f31968947ae71e2225a8e3fb504
Author: Ryan Blue <[email protected]>
Date: 2017-04-30T22:52:25Z
TOREE-380: Fix tests.
commit 9c9c9dc045cfddc3130ee596afba309dfbd540c4
Author: Ryan Blue <[email protected]>
Date: 2017-06-09T01:19:34Z
TOREE-380: Add JVMReprSpec.
commit b4c1510644cf8d33410ad3d71f78c522d27b5bbe
Author: Ryan Blue <[email protected]>
Date: 2017-06-09T16:06:02Z
TOREE-380: Fix Python integration tests.
commit 7a50f20abe9c9a85b57e39fe3124fffb6f55d797
Author: Ryan Blue <[email protected]>
Date: 2017-06-09T16:34:01Z
TOREE-380: Fix AddJar integration test.
commit 1eaf4a0ae605e865deadad60e13328a1c2197e98
Author: Ryan Blue <[email protected]>
Date: 2017-06-10T18:50:10Z
TOREE-380: Add copyright header to new files.
----
> Interpreters should be allowed to send results other than text/plain.
> ---------------------------------------------------------------------
>
> Key: TOREE-380
> URL: https://issues.apache.org/jira/browse/TOREE-380
> Project: TOREE
> Issue Type: Improvement
> Reporter: Ryan Blue
> Assignee: Ryan Blue
>
> Jupyter allows kernels to send results using different content types, but
> this isn't allowed by Toree for its interpreters. This prevents custom
> display logic. The basic problem is that {{ExecuteOutput}} is a {{String}}
> and not a {{Map[String, String]}} like {{CellMagicOutput}}.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)