diff --git a/examples/manifest.toml b/examples/manifest.toml index 240932fb3ed8..1e283de8181c 100644 --- a/examples/manifest.toml +++ b/examples/manifest.toml @@ -145,6 +145,8 @@ Showcase basic usage and specific features of Rerun. examples = [ # display order, most interesting first "notebook", + "notebook_viewer", + "notebook_callbacks", "clock", "dna", "graphs", diff --git a/examples/python/notebook_callbacks/README.md b/examples/python/notebook_callbacks/README.md new file mode 100644 index 000000000000..3b2471be94dc --- /dev/null +++ b/examples/python/notebook_callbacks/README.md @@ -0,0 +1,40 @@ + + +## Overview + +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. + +You need the separate support package [`rerun-notebook`](https://pypi.org/project/rerun-notebook/) to use this feature. Typically this is installed using: + +```bash +pip install "rerun-sdk[notebook]" +``` + +Check out the [minimal notebook example](https://rerun.io/examples/integrations/notebook) for a quick start. + +## Background + +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. + +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. + +## Running in Jupyter + +First, install the requirements (this includes Jupyter, the Rerun SDK, and the notebook support package): + +```bash +pip install -r requirements.txt +``` + +Then, open the notebook: + +```bash +jupyter notebook notebook_callbacks.ipynb +``` + +Interact with the viewer by scrubbing the timeline and selecting points or views; the widgets underneath will update instantly to mirror the viewer state. diff --git a/rerun_notebook/callbacks.ipynb b/examples/python/notebook_callbacks/notebook_callbacks.ipynb similarity index 100% rename from rerun_notebook/callbacks.ipynb rename to examples/python/notebook_callbacks/notebook_callbacks.ipynb diff --git a/examples/python/notebook_callbacks/requirements.txt b/examples/python/notebook_callbacks/requirements.txt new file mode 100644 index 000000000000..bb23eb8c6b6d --- /dev/null +++ b/examples/python/notebook_callbacks/requirements.txt @@ -0,0 +1,3 @@ +rerun-sdk[notebook] +ipywidgets +numpy diff --git a/examples/python/notebook_viewer/README.md b/examples/python/notebook_viewer/README.md new file mode 100644 index 000000000000..1b6c9c983f4d --- /dev/null +++ b/examples/python/notebook_viewer/README.md @@ -0,0 +1,38 @@ + + +## Overview + +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. + +You need the separate support package [`rerun-notebook`](https://pypi.org/project/rerun-notebook/) to use this feature. Typically this is installed using: + +```bash +pip install "rerun-sdk[notebook]" +``` + +Check out the [minimal notebook example](https://rerun.io/examples/integrations/notebook) for a quick start. + +## Background + +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. + +## Running in Jupyter + +First, install the requirements (this includes Jupyter, the Rerun SDK, and the notebook support package): + +```bash +pip install -r requirements.txt +``` + +Then, open the notebook: + +```bash +jupyter notebook notebook_viewer.ipynb +``` + +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. diff --git a/rerun_notebook/example.ipynb b/examples/python/notebook_viewer/notebook_viewer.ipynb similarity index 73% rename from rerun_notebook/example.ipynb rename to examples/python/notebook_viewer/notebook_viewer.ipynb index dc8c7d890e76..ee70cc77d478 100644 --- a/rerun_notebook/example.ipynb +++ b/examples/python/notebook_viewer/notebook_viewer.ipynb @@ -8,24 +8,19 @@ "source": [ "from __future__ import annotations\n", "\n", - "from rerun_notebook import Viewer\n", + "from rerun.notebook import Viewer\n", "\n", "Viewer(\n", " width=\"auto\",\n", " height=\"auto\",\n", " url=\"https://app.rerun.io/version/nightly/examples/raw_mesh.rrd\",\n", - " panel_states={\n", - " \"blueprint\": \"hidden\",\n", - " \"selection\": \"hidden\",\n", - " \"time\": \"collapsed\",\n", - " },\n", ")" ] } ], "metadata": { "kernelspec": { - "display_name": "py", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -39,7 +34,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.10" + "version": "3.10.11" } }, "nbformat": 4, diff --git a/examples/python/notebook_viewer/requirements.txt b/examples/python/notebook_viewer/requirements.txt new file mode 100644 index 000000000000..175b968808c9 --- /dev/null +++ b/examples/python/notebook_viewer/requirements.txt @@ -0,0 +1 @@ +rerun-sdk[notebook]