Skip to main content

A GridStack template for Voila.

Project description

voila-gridstack

A gridstack-based template for voila-gridstack.

Gitter channel Voila JupyterLab extension
Join the Gitter Chat Voila GridStack on Binder JupyterLab on Binder

Installation

voila-gridstack can be installed with the mamba package manager

mamba install -c conda-forge voila-gridstack

or from PyPI

pip install voila-gridstack

Format

The template uses metadata defined in the notebook file (.ipynb) to configure the layout. The specification of the metadata was defined by a now defunct project jupyter-dashboards. The specification is described in jupyter-dashboards docs.

The voila renderer behaves as a "display-only renderer without authoring capabilitiy" as defined in the specs. However, there are a few differences compared to the original implmentation:

  • if no metadata is found in the notebook voilà will render the notebook as grid layout,
  • it can not persist the state of the cells (i.e. the re-configuration of the layout will be lost, when the user closes the voila page),
  • if the cell does not contain view configuration for the particular view type (grid or report) or hidden attribute is not defined, voilà will treat it as visible.

Usage

To use the gridstack template, pass option --template=gridstack to the voila command line.

voila-gridstack

By default the position of cells in the dashboard will be fixed. If you want them to be draggable and resizable, you can launch voila with the show_handles resource set to True:

voila --template=gridstack examples/ --VoilaConfiguration.resources='{"gridstack": {"show_handles": True}}'

Note, however, that the state of the dashboard can not be persisted in the notebook.

You can change the color scheme using the theme resource:

voila examples/ --template=gridstack --theme=dark

Development

To install the template from source:

# create a new `conda` environment
conda create -n voila-gridstack -c conda-forge notebook python

# activate the environment
conda activate voila-gridstack

# install the package in development mode
python -m pip install -e .

# start voila with the gridstack template
voila --template=gridstack

Classic Notebook Extension

voila-gridstack

voila-gridstack provides an extension for the classic notebook to edit the gridstack layout from the notebook interface.

To install this extension in development mode:

# activate the environment
conda activate voila-gridstack

# link the local files
jupyter nbextension install --sys-prefix --symlink --overwrite --py voila-gridstack

# enable the extension
jupyter nbextension enable --sys-prefix --py voila-gridstack

# check the extension is installed and enabled
jupyter nbextension list

# start the notebook
jupyter notebook

Then edit the files in voila-gridstack/static and reload the page to see the changes.

JupyterLab Extension

voila-gridstack

Note: You will need NodeJS to build the extension package.

The jlpm command is JupyterLab's pinned version of yarn that is installed with JupyterLab. You may use yarn or npm in lieu of jlpm below.

# activate the environment
conda activate voila-gridstack

# install JupyterLab
mamba install -c conda-forge jupyterlab

# Install package in development mode
pip install -e .

# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite

# Rebuild extension TypeScript source after making changes
jlpm run build

You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.

# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm run watch
# Run JupyterLab in another terminal
jupyter lab

License

We use a shared copyright model that enables all contributors to maintain the copyright on their contributions.

This software is licensed under the BSD-3-Clause license. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

voila-gridstack-0.3.0a2.tar.gz (214.3 kB view details)

Uploaded Source

Built Distribution

voila_gridstack-0.3.0a2-py2.py3-none-any.whl (226.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file voila-gridstack-0.3.0a2.tar.gz.

File metadata

  • Download URL: voila-gridstack-0.3.0a2.tar.gz
  • Upload date:
  • Size: 214.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for voila-gridstack-0.3.0a2.tar.gz
Algorithm Hash digest
SHA256 a09d8d2a2bb8fcf315bbb90ebf7b4a0ab0534fac18d6ec864f81ac792553295e
MD5 580cfb15aa4dcc784fc7117f0103fb54
BLAKE2b-256 9c895144859fe7bb7eca78c60b54dbf5828ba5d278864aae5491a96fb28df44d

See more details on using hashes here.

File details

Details for the file voila_gridstack-0.3.0a2-py2.py3-none-any.whl.

File metadata

  • Download URL: voila_gridstack-0.3.0a2-py2.py3-none-any.whl
  • Upload date:
  • Size: 226.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for voila_gridstack-0.3.0a2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2dc6ddb8b493e2f05d4c67f3a3515683f8b3c751d9a9e3178b34d9f9442fcf64
MD5 75afa9309298a2565fbb7e4428446738
BLAKE2b-256 8e3d17d51604d7008afcdcbd06ec509c5d3ec3895e66946f080b5fe5b2490b86

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page