Skip to content

A JupyterLab and Jupyter Notebook extension for rendering data with dynamically loaded React components

Notifications You must be signed in to change notification settings

gnestor/jupyterlab_react

Repository files navigation

jupyterlab_react

A JupyterLab and Jupyter Notebook extension for rendering data with dynamically loaded React components

screencap

Prerequisites

  • JupyterLab ^0.16.0 and/or Notebook >=4.3.0

Usage

To render React output in IPython:

from jupyterlab_react import React

element = {
    'type': 'JSONTree',
    'props': {
        'data': [
            {'month': 'September', 'profit': 35000, 'loss': 2000},
            {'month': 'October', 'profit': 42000, 'loss': 8000},
            {'month': 'November', 'profit': 55000, 'loss': 5000}
        ],
        'theme': 'google'
    }
}
    
React(element, module='react-json-tree')

Install

To install using pip:

pip install jupyterlab_react
# For JupyterLab
jupyter labextension install --py --sys-prefix jupyterlab_react
jupyter labextension enable --py --sys-prefix jupyterlab_react
# For Notebook
jupyter nbextension install --py --sys-prefix jupyterlab_react
jupyter nbextension enable --py --sys-prefix jupyterlab_react

Development

Set up using install script

Use the install.sh script to build the Javascript, install the Python package, and install/enable the notebook and lab extensions:

bash install.sh --sys-prefix

Use the build.sh script to rebuild the Javascript:

bash build.sh

Set up manually

Alternatively, see the README.md in /labextension and /nbextension for extension-specific build instructions.

To install the Python package:

pip install -e .

To install the extension for JupyterLab:

jupyter labextension install --symlink --py --sys-prefix jupyterlab_react
jupyter labextension enable --py --sys-prefix jupyterlab_react

To install the extension for Jupyter Notebook:

jupyter nbextension install --symlink --py --sys-prefix jupyterlab_react
jupyter nbextension enable --py --sys-prefix jupyterlab_react

About

A JupyterLab and Jupyter Notebook extension for rendering data with dynamically loaded React components

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages