Skip to content

Welcome to Shinyobservable

Embed Observable Notebooks in Shiny for Python.

Shinyobservable makes it a breeze to integrate libraries such as D3.

Create any kind of JavaScript visualizations and let Shiny handle your data and interactivity.

Features

  • Embed entire notebooks
  • Embed selected cells only
  • Update data cells to update visualizations

Installation

pip install shinyobservable

# Dev
pip install git+https://github.com/eodaGmbH/py-shiny-shinyobservable

Quickstart

from htmltools import a
from shiny.express import ui
from shinyobservable import Observable, ObservableRenderer

NOTEBOOK = "https://observablehq.com/@d3/zoomable-sunburst"

ui.h1("Observable Notebook in Shiny")
ui.div(a(NOTEBOOK, href=NOTEBOOK, target="_blank"))
ui.hr()


# Embed selected cells
@ObservableRenderer
def render_cells():
    return Observable(NOTEBOOK, cells=["chart"])


# Include entire notebook
# @ObservableRenderer
def render_notebook():
    return Observable(NOTEBOOK)

Enjoy your notebook!