Skip to content

Commit bcb148f

Browse files
Weijun-Hntjohnson1
andauthored
refactor: Move examples for notebook viewer and callbacks to examples/python (#11416)
### Related <!-- Include links to any related issues/PRs in a bulleted list, for example: * Closes #1234 * Part of #1337 --> Closes #10711 ### What <!-- Make sure the PR title and labels are set to maximize their usefulness for the CHANGELOG, and our `git log`. If you have noticed any breaking changes, include them in the migration guide. We track various metrics at <https://build.rerun.io>. For maintainers: * To run all checks from `main`, comment on the PR with `@rerun-bot full-check`. * To deploy documentation changes immediately after merging this PR, add the `deploy docs` label. For more details check the PR section on <https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md>. --> --------- Co-authored-by: ntjohnson1 <[email protected]>
1 parent d715f3e commit bcb148f

File tree

7 files changed

+87
-8
lines changed

7 files changed

+87
-8
lines changed

examples/manifest.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ Showcase basic usage and specific features of Rerun.
145145
examples = [
146146
# display order, most interesting first
147147
"notebook",
148+
"notebook_viewer",
149+
"notebook_callbacks",
148150
"clock",
149151
"dna",
150152
"graphs",
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!--[metadata]
2+
title = "Notebook: viewer callbacks"
3+
tags = ["Notebook", "Interactive", "Callbacks", "3D"]
4+
thumbnail = "https://static.rerun.io/notebook_callbacks/0daba8485bc0d589cfda3411db450db4bf2e8818/480w.png"
5+
thumbnail_dimensions = [480, 339]
6+
-->
7+
8+
## Overview
9+
10+
This notebook demonstrates how to react to user interactions coming from the embedded Rerun Viewer widget. It logs a dynamic 3D point cloud, listens for timeline, time, and selection events, and surfaces them in real time using Jupyter widgets.
11+
12+
You need the separate support package [`rerun-notebook`](https://pypi.org/project/rerun-notebook/) to use this feature. Typically this is installed using:
13+
14+
```bash
15+
pip install "rerun-sdk[notebook]"
16+
```
17+
18+
Check out the [minimal notebook example](https://rerun.io/examples/integrations/notebook) for a quick start.
19+
20+
## Background
21+
22+
This notebook spins up a colorful point cloud and pipes it into the viewer so you can experiment with callbacks in real time. As the camera, timeline, and selection change, [`Viewer.on_event`](https://www.rerun.io/docs/reference/sdk/rerun_notebook#rerun.notebook.Viewer.on_event) emits rich event payloads that we translate into friendly [`ipywidgets`](https://ipywidgets.readthedocs.io/) readouts.
23+
24+
Scrub the timeline, pick individual points, or activate entire views to see how each interaction updates the labels—handy for building responsive dashboards or debugging custom tooling around the Rerun Viewer.
25+
26+
## Running in Jupyter
27+
28+
First, install the requirements (this includes Jupyter, the Rerun SDK, and the notebook support package):
29+
30+
```bash
31+
pip install -r requirements.txt
32+
```
33+
34+
Then, open the notebook:
35+
36+
```bash
37+
jupyter notebook notebook_callbacks.ipynb
38+
```
39+
40+
Interact with the viewer by scrubbing the timeline and selecting points or views; the widgets underneath will update instantly to mirror the viewer state.
File renamed without changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
rerun-sdk[notebook]
2+
ipywidgets
3+
numpy
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<!--[metadata]
2+
title = "Notebook: viewer"
3+
tags = ["Notebook", "Widget", "3D"]
4+
thumbnail = "https://static.rerun.io/notebook_viewer/3e3bc9c7eede26db837fb317b7e2b2de77dfc777/480w.png"
5+
thumbnail_dimensions = [480, 272]
6+
-->
7+
8+
## Overview
9+
10+
This notebook shows the easiest way to embed the Rerun Viewer widget inside a Jupyter notebook. Instead of logging new data, it loads a pre-recorded `.rrd` file and renders the scene inline, making it perfect for demos, documentation, or quick inspections of existing captures.
11+
12+
You need the separate support package [`rerun-notebook`](https://pypi.org/project/rerun-notebook/) to use this feature. Typically this is installed using:
13+
14+
```bash
15+
pip install "rerun-sdk[notebook]"
16+
```
17+
18+
Check out the [minimal notebook example](https://rerun.io/examples/integrations/notebook) for a quick start.
19+
20+
## Background
21+
22+
In this notebook we are loading a pre-recorded `.rrd` file into the Rerun Viewer widget. The viewer streams the capture and allows you to interact with the 3D scene directly in your browser. You can orbit, zoom, and inspect the scene without needing to run any additional applications.
23+
24+
## Running in Jupyter
25+
26+
First, install the requirements (this includes Jupyter, the Rerun SDK, and the notebook support package):
27+
28+
```bash
29+
pip install -r requirements.txt
30+
```
31+
32+
Then, open the notebook:
33+
34+
```bash
35+
jupyter notebook notebook_viewer.ipynb
36+
```
37+
38+
When the notebook launches, the embedded viewer will stream the remote mesh capture so you can orbit, zoom, and inspect the scene directly inside the notebook.

rerun_notebook/example.ipynb renamed to examples/python/notebook_viewer/notebook_viewer.ipynb

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,19 @@
88
"source": [
99
"from __future__ import annotations\n",
1010
"\n",
11-
"from rerun_notebook import Viewer\n",
11+
"from rerun.notebook import Viewer\n",
1212
"\n",
1313
"Viewer(\n",
1414
" width=\"auto\",\n",
1515
" height=\"auto\",\n",
1616
" url=\"https://app.rerun.io/version/nightly/examples/raw_mesh.rrd\",\n",
17-
" panel_states={\n",
18-
" \"blueprint\": \"hidden\",\n",
19-
" \"selection\": \"hidden\",\n",
20-
" \"time\": \"collapsed\",\n",
21-
" },\n",
2217
")"
2318
]
2419
}
2520
],
2621
"metadata": {
2722
"kernelspec": {
28-
"display_name": "py",
23+
"display_name": "Python 3 (ipykernel)",
2924
"language": "python",
3025
"name": "python3"
3126
},
@@ -39,7 +34,7 @@
3934
"name": "python",
4035
"nbconvert_exporter": "python",
4136
"pygments_lexer": "ipython3",
42-
"version": "3.11.10"
37+
"version": "3.10.11"
4338
}
4439
},
4540
"nbformat": 4,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rerun-sdk[notebook]

0 commit comments

Comments
 (0)