Skip to content

Latest commit

聽

History

154 Commits

Folders and files

NameName
Last commit message
Last commit date
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽
聽

Repository files navigation

pyobservablejs

CI PyPI Python versions License

pyobservablejs brings reactive Observable notebooks to Python. Build cells, charts, and browser inputs, or import an existing notebook. Display the whole notebook or selected cells in JupyterLab, marimo, VS Code, Colab, and other anywidget hosts.

An interactive notebook built from Python

Try it in your browser 路 Quickstart 路 Examples 路 API reference

Start

Install in a Python 3.11 through 3.14 notebook environment:

pip install pyobservablejs

Create an input and a result that updates when it changes:

import observablejs as obs

notebook = obs.Notebook(
    obs.ojs(
        "viewof threshold = Inputs.range([0, 1], {value: 0.5, step: 0.1})",
        key="control",
    ),
    obs.js(
        "const doubled = threshold * 2; display(md`Doubled: **${doubled}**`);",
        key="result",
    ),
)
view = notebook.view()
view

Cells run in the browser through Notebook Kit. Its Inputs library loads from the network. Use notebook and module sources you trust, since their JavaScript runs in the host page.

Experimental: the API may change between releases.

Run headlessly

Install pyobservablejs[server] to inspect and evaluate notebooks in Python scripts and services:

print(notebook.with_variables(threshold=0.5).data["doubled"].to_python())

Read Python values, Polars or pandas dataframes, Arrow tables, and attachment bytes through the data and file namespaces. Headless Python guide.

Build on it

Documentation 路 Troubleshooting 路 Contributing 路 MIT license

Built on Observable's Notebook Kit and anywidget. pyobsplot informed the Python variable API.

About

馃摀 Build and embed reactive Observable notebooks in Python

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages