Skip to content

Conversation

@timkpaine
Copy link
Member

@timkpaine timkpaine commented Mar 23, 2021

This is a simple modification that turns on editing for our JupyterLab mime renderer plugin (the thing that lets you right click on a csv, json, or arrow and visualize in perspective). As a result, we now have a pivotable, sortable, filterable, editable csv/json/arrow viewer.

tmp

  • add mime renderer to jlab readme and usage page
  • fix arrow saving

@timkpaine
Copy link
Member Author

Round trip arrow save/load

tmp

@timkpaine timkpaine marked this pull request as ready for review March 23, 2021 04:17
@timkpaine timkpaine requested a review from sc1f March 23, 2021 12:57
@texodus
Copy link
Member

texodus commented Mar 24, 2021

Also - this is a really cool feature!

@texodus texodus removed the request for review from sc1f April 2, 2021 20:00
@texodus texodus marked this pull request as draft April 2, 2021 20:01
timkpaine added a commit that referenced this pull request Apr 12, 2021
@perspective-dev perspective-dev deleted a comment from texodus Apr 14, 2021
@perspective-dev perspective-dev deleted a comment from texodus Apr 14, 2021
@timkpaine timkpaine marked this pull request as ready for review April 14, 2021 03:13
@timkpaine
Copy link
Member Author

@texodus redid this on top of your fixes and its working fine, ready for review

@texodus texodus changed the title add editing to mime renderer in JupyterLab Enable editing to mime renderer in JupyterLab Apr 14, 2021
@texodus texodus added enhancement Feature requests or improvements Jupyter labels Apr 14, 2021
Copy link
Member

@texodus texodus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Looks good -

  • Does the arrow output work? On first sight it looks suspect, I will test this.
  • It may be prohibitively expensive to save on every cell edit, the mime renderer may benefit form a small control panel with "update/reset" and "save/submit" buttons?

} else if (this._type === "arrow") {
view.to_arrow().then((result: ArrayBuffer) => {
const resultAsB64 = btoa(new Uint8Array(result).reduce((acc, i) => (acc += String.fromCharCode.apply(null, [i])), ""));
this.context.model.fromString(resultAsB64);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do - this creates an arrow and not a base64 encoded string in a text file?

Copy link
Member Author

@timkpaine timkpaine Apr 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep the key is in a different code block where we tell jupyter to open arrow files as binary which means they're exposed in the model as b64 encoded strings and the underlying conversion to/from binary is managed for us https://github.com/finos/perspective/blob/master/packages/perspective-jupyterlab/src/ts/renderer.ts#L168

@texodus texodus added this to the 0.7.1 milestone Apr 14, 2021
@perspective-dev perspective-dev deleted a comment from texodus Apr 14, 2021
@perspective-dev perspective-dev deleted a comment from texodus Apr 14, 2021
@texodus texodus merged commit e09e6b9 into master Apr 22, 2021
@texodus texodus deleted the mimerender_edit branch April 22, 2021 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Feature requests or improvements Jupyter

Development

Successfully merging this pull request may close these issues.

3 participants