|
3 | 3 | [](https://travis-ci.org/jupyter/jvm-repr)
|
4 | 4 | [](https://jitpack.io/#jupyter/jvm-repr)
|
5 | 5 |
|
6 |
| -Standardizing REPL outputs for across JVM kernels (Scala, Clojure, Groovy, ...) |
| 6 | +[**Configuration**](#configuration) | [**Usage for Library Authors**](#usage---library-authors) | [**Usage for Kernel Authors**](#usage---kernel-authors) |
7 | 7 |
|
8 |
| -## Purpose |
| 8 | +Standardizing object representation and inspection across JVM kernels (Scala, Clojure, Groovy, ...). |
9 | 9 |
|
10 |
| -JVM languages use various conventions to convert REPL outputs to forms that can be displayed. This project is an attempt to standardize by providing an API that libraries can use to register display methods for any REPL project, like Jupyter console or nteract. |
| 10 | +## Purpose |
11 | 11 |
|
12 |
| -## Using this API |
| 12 | +JVM languages use various conventions to convert REPL outputs to forms that can be displayed. This project is an attempt to standardize by providing an API that libraries can use to register display methods for any jupyter frontend, whether console, notebook, |
| 13 | +or dashboard. |
13 | 14 |
|
14 | 15 | This API has two main uses:
|
15 |
| -* For library authors to provide conversions from a library's JVM objects to useful representations by MIME type |
16 |
| -* To provide a common way for kernel implementers to convert any JVM object to useful representations by MIME type |
17 | 16 |
|
18 |
| -### Library authors |
| 17 | +* For library authors to provide a way to convert from a library's JVM objects to useful representations by MIME type |
| 18 | +* For kernel authors to convert any JVM object to useful representations by MIME type |
| 19 | + |
| 20 | +As it is with IPython, this is a contract between the libraries within the ecosystem, |
| 21 | +the kernel that inspects the objects, and the frontends that display them. |
| 22 | + |
| 23 | +## Configuration |
| 24 | + |
| 25 | +See [instructions on JitPack](https://jitpack.io/#jupyter/jvm-repr) for gradle, maven, sbt, or leiningen. |
| 26 | + |
| 27 | +## Usage |
| 28 | + |
| 29 | +### Usage - Library authors |
19 | 30 |
|
20 | 31 | Library authors can register conversion code by implementing a `Displayer` and registering it with `Displayers`.
|
21 | 32 |
|
@@ -43,22 +54,27 @@ import vegas.DSL.ExtendedUnitSpecBuilder
|
43 | 54 | })
|
44 | 55 | ```
|
45 | 56 |
|
46 |
| -Any kernel implementation can use the method to display Vegas graphs for the DSL objects. |
| 57 | +Any kernel implementation can use the method to display Vegas graphs for the DSL |
| 58 | +objects. |
47 | 59 |
|
48 |
| -Library authors can optionally implement `setMimeTypes(String...)` to receive hints for the MIME types that the kernel or front-end supports. It is recommended that library authors use these hints to avoid expensive conversions. |
| 60 | +Library authors can optionally implement `setMimeTypes(String...)` to receive |
| 61 | +hints for the MIME types that the kernel or front-end supports. It is |
| 62 | +recommended that library authors use these hints to avoid expensive conversions. |
49 | 63 |
|
50 |
| -### Kernel implementers |
| 64 | +### Usage - Kernel authors |
51 | 65 |
|
52 |
| -Kernel implementors can use this API to display registered objects: |
| 66 | +Kernel authors can use this API to display registered objects: |
53 | 67 |
|
54 | 68 | ```java
|
55 | 69 | import java.util.Map
|
56 | 70 |
|
57 |
| -... |
| 71 | +// ... |
58 | 72 |
|
59 | 73 | Object result = interpreter.eval(code);
|
60 | 74 | Map<String, String> resultByMIME = Displayers.display(result);
|
61 | 75 | Kernel.this.display(resultByMIME);
|
62 | 76 | ```
|
63 | 77 |
|
64 |
| -Kernel implementers can optionally call `Displayers.setMimeTypes(String...)` to send hints to display implementations with the set of MIME types that can be used by the kernel or front-end. |
| 78 | +Kernel authors can optionally call `Displayers.setMimeTypes(String...)` to send |
| 79 | +hints to display implementations with the set of MIME types that can be used by |
| 80 | +the kernel or front-end. |
0 commit comments