Skip to main content

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

Reason this release was yanked:

Doesn't load, reported by Nicolas

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 Observable 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'],
)

Embedding specific cells with the cell keyword parameter of embed([]) causes only these cells to be shown, but every cell still runs.

At the time of writing, this behavior is different than the Observable embed default.

About this library

This is an unofficial 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

See ARCHITECTURE.md for an overview.

Because Python library includes JavaScript, you'll need node as well as Python to contribute to it.

The two JavaScript files included in an installed package iframe_bundle.js and wrapper_bundle.js are not saved in this repo. They are generated by rollup, a JavaScript "bundler" that combines JavaScript source code from files in the js folder and dependencies listed in js/package.json.

Installing the Python package with or pip install -e . will automatically run the bundler and produce these files.

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.11.tar.gz (218.6 kB view details)

Uploaded Source

Built Distribution

observable_jupyter-0.1.11-py3-none-any.whl (31.1 kB view details)

Uploaded Python 3

File details

Details for the file observable_jupyter-0.1.11.tar.gz.

File metadata

  • Download URL: observable_jupyter-0.1.11.tar.gz
  • Upload date:
  • Size: 218.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for observable_jupyter-0.1.11.tar.gz
Algorithm Hash digest
SHA256 6b13a49b0e3e3dda597e1e2da905cbc22bb432983466b96d920cbf98e975c5da
MD5 d407575f2488d3b6d19040b2e942a2ae
BLAKE2b-256 9f4473b895d2aa16ad49397d06a4d71a245136b898de9d524a8bddfe15eeb779

See more details on using hashes here.

File details

Details for the file observable_jupyter-0.1.11-py3-none-any.whl.

File metadata

  • Download URL: observable_jupyter-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 31.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for observable_jupyter-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 881ab98380f4f089be7e77e687d29ab6e353dfc1c3d79a179bc3d6255cbb8bf5
MD5 bb00ca96169e9b6dc8fdb084ee1366b4
BLAKE2b-256 f0b933837db5e47d5c0ce8a7a86645c0b23bcaa3491863f0c167336a31e9d4d9

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