Skip to main content

Embed Observable cells hosted on observablehq.com into Jupyter notebooks.

Project description

observable_jupyter

Embed cells from Observable notebooks into Jupyter notebooks.

View demo notebook on Colab

To install the library, import the embed function, and embed the "graphic" cell from this notebook:

!pip install observable_jupyter
from observable_jupyter import embed
embed('@mbostock/epicyclic-gearing', cells=['graphic'], inputs={'speed': 0.2})

The simplest way to use embed() is to render an entire Observable notebook:

embed('@d3/gallery')

You may want to swap in your own data into a D3 chart:

import this
text = ''.join(this.d.get(l, l) for l in this.s)
embed('@d3/word-cloud', cells=['chart'], inputs={'source': text})

With multiple cells, you can embed interactive charts!

embed(
    '@observablehq/visualize-a-data-frame-with-observable-in-jupyter,
    cells=['vegaPetalsWidget', 'viewof sepalLengthLimits', 'viewof sepalWidthLimits'],
)

About this library

This is an unofficial, but unlikely to break because it uses official embedding APIs, library for embedding Observable notebooks in Jupyter. The library was developed at Observable but is now maintained by Thomas Ballinger. All code added before Sept 2021 is copyright Observable.

Development

Because this is a Python and JavaScript library, you'll need node as well as Python to contribute to it.

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

observable_jupyter-0.1.10.tar.gz (216.4 kB view hashes)

Uploaded Source

Built Distribution

observable_jupyter-0.1.10-py3-none-any.whl (29.8 kB view hashes)

Uploaded Python 3

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