Skip to content

Add notebook integration getting-started example#39

Merged
defunctzombie merged 4 commits into
mainfrom
roman/simple-foxglove-notebook-cc52
May 4, 2026
Merged

Add notebook integration getting-started example#39
defunctzombie merged 4 commits into
mainfrom
roman/simple-foxglove-notebook-cc52

Conversation

@defunctzombie
Copy link
Copy Markdown
Contributor

@defunctzombie defunctzombie commented May 1, 2026

Summary

Adds a new self-contained Jupyter notebook tutorial under jupyter_notebooks/getting_started/ that mirrors the Using the integration and Layout Management sections of the Foxglove notebook docs, so we have a runnable companion the docs and external posts can link to.

The notebook is Colab-first: dependencies are installed via %pip install "foxglove-sdk[notebook]" in the first cell, so it runs end-to-end in a fresh Colab kernel with no external assets.

What's in the notebook

jupyter_notebooks/getting_started/GettingStarted.ipynb, 12 cells:

  1. Title + intro with a link back to the docs page.
  2. Install%pip install -q "foxglove-sdk[notebook]".
  3. Using the integration — minimal /hello counter example mirroring the docs verbatim, including the log_time warning.
  4. Logging richer dataSceneUpdateChannel cube example so the embedded viewer has something visually meaningful to render.
  5. Layout management — single-panel Layout(content=MarkdownPanel(...), variables=...) example.
  6. Composing panels with containers — re-logs the cube + counter, then builds a TabContainer > SplitContainer layout pairing a ThreeDeePanel (/scene) with a PlotPanel (/hello.count) so the container API is shown driving real data.
  7. Where to next — links to the docs, the layouts API, the sibling data_platform notebook, and our Discord.

Per discussion, this PR intentionally does not cover:

  • the "Buffer management" (nb_buffer.clear()) subsection
  • the "Reloading viewer data" (viewer.refresh()) subsection
  • the "load layout from JSON file" / opaque_layout workflow

Easy follow-ups if we want them later.

Other changes

  • jupyter_notebooks/getting_started/README.md — folder README with front-matter (title + short description + colab_url), a Colab badge, and local-run instructions. The Colab badge uses the same https://colab.research.google.com/github/<org>/<repo>/blob/<branch>/<path> pattern as data_platform/README.md, pointing at this repo's main branch — so it works as soon as the PR merges, no separately-generated Colab share URL required.
  • .utils/generate_readme.py + .utils/README_template.md.j2 — adds support for a new colab_url front-matter field so Colab links can be surfaced as a 📓 bullet in the auto-generated root README. Backwards-compatible: existing tutorials that don't set colab_url are unaffected.
  • README.md — regenerated to include the new tutorial and its Colab bullet.

Testing

  • ✅ Headless-executed GettingStarted.ipynb end-to-end with jupyter nbconvert --execute against foxglove-sdk[notebook]==0.22.x. Every cell runs without errors or stderr output.
  • ✅ Verified all foxglove.layouts classes used (Layout, MarkdownPanel, MarkdownConfig, SplitContainer, SplitItem, TabContainer, TabItem, ThreeDeePanel, ThreeDeeConfig, PlotPanel, PlotConfig, PlotSeries, BaseRendererSceneUpdateTopicSettings, BaseRendererGridLayerSettings) exist in the installed SDK.
  • ✅ Verified .utils/generate_readme.py is idempotent after the colab_url change.

The embedded Foxglove widget is an Anywidget that loads the viewer in the browser, so it doesn't render meaningfully in headless nbconvert — the validation here is that the Python in every cell completes cleanly. Real visual validation will happen when the Colab link is opened post-merge.

Rendered notebook (HTML preview)

GettingStarted.ipynb rendered to HTML

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

cursoragent and others added 4 commits May 1, 2026 17:17
Adds a new self-contained Jupyter notebook tutorial under
`jupyter_notebooks/getting_started/` that mirrors the "Using the
integration" and "Layout Management" sections of
https://docs.foxglove.dev/docs/notebook.

The notebook is Colab-first: dependencies are installed via `%pip install
"foxglove-sdk[notebook]"` in the first cell so it runs end-to-end in a
fresh kernel with no external assets. Cells cover:

- Creating a notebook buffer with `foxglove.init_notebook_buffer()`
- Logging messages with explicit `log_time` and rendering them in the
  embedded Foxglove viewer
- Logging richer 3D scene data via `SceneUpdateChannel`
- Building a single-panel layout programmatically with the
  `foxglove.layouts` API
- Composing `SplitContainer` and `TabContainer` to drive a 3D scene
  + plot side-by-side from real data

Also extends `.utils/generate_readme.py` and the README template to
support a new `colab_url` front-matter field so Colab links can be
surfaced in the auto-generated root README, and regenerates README.md
to include the new tutorial.

Co-authored-by: Roman Shtylman <defunctzombie@users.noreply.github.com>
Match the data_platform tutorial's Colab badge style: link directly to
the notebook in this repo via the
https://colab.research.google.com/github/<org>/<repo>/blob/<branch>/<path>
pattern instead of waiting on a separately-generated Colab share URL.

Also wires the same URL into the README front-matter as colab_url so the
auto-generated root README surfaces a 'Open in Colab' bullet for this
tutorial.

Co-authored-by: Roman Shtylman <defunctzombie@users.noreply.github.com>
The minimal /hello example was opening the embedded viewer with the
default empty layout, leaving the user looking at no panels and no data
even though the buffer was full of /hello messages. Pre-configure a
single Raw Messages panel pointed at /hello so the viewer renders the
buffered data immediately.

This is also a nice teaser for the Layout Management section later in
the notebook.

Co-authored-by: Roman Shtylman <defunctzombie@users.noreply.github.com>
Same fix as the previous commit but for the SceneUpdate cube example:
ship a Layout with a ThreeDeePanel subscribed to /scene (and a base
grid layer) so the embedded viewer immediately renders the animated
cube instead of opening on an empty default layout.

Co-authored-by: Roman Shtylman <defunctzombie@users.noreply.github.com>
@defunctzombie defunctzombie requested review from msadowski and surbina May 1, 2026 22:53
@defunctzombie defunctzombie marked this pull request as ready for review May 1, 2026 22:54
"id": "191d273b",
"metadata": {},
"source": [
"## Where to next\n",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on adding a link to the Playground?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 For now I'll defer. We don't promote playground and its a very different experience than notebooks (no external libraries).

@defunctzombie defunctzombie merged commit 25620a0 into main May 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants