A sidecar output widget for JupyterLab
If you use jupyterlab:
pip install sidecar
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install @jupyter-widgets/jupyterlab-sidecar
The sidecar widget is used as a context manager, just like ipywidgets' output widget.
from sidecar import Sidecar
from ipywidgets import IntSlider
sc = Sidecar(title='Sidecar Output')
sl = IntSlider(description='Some slider')
with sc:
display(sl)
When a single output is displayed in a Sidecar, it is allowed to occupy all of the vertical space available. If more content is displayed, the natural height is used instead.
# Create a new conda environment
conda create -n jupyterlab-sidecar -c conda-forge jupyterlab ipywidgets nodejs
# Activate the conda environment
conda activate jupyterlab-sidecar
# Install dependencies
jlpm
# Build Typescript source
jlpm build
# Link your development version of the extension with JupyterLab
jupyter labextension link .
# Rebuild Typescript source after making changes
jlpm build
# Rebuild JupyterLab after making any changes
jupyter lab build
# Install the sidecar Python package
python -m pip install -e .