Rerun Python SDK
The Rerun Python SDK is an open-source library for logging, storing, querying, and visualizing multimodal and multi-rate data. It provides Python APIs to stream data like images, tensors, point clouds, and text to the Rerun Viewer for live visualization or to a file for later use. It is currently in active development, with frequent releases, and is particularly useful in areas like robotics, simulation, and computer vision, aiming to help users understand and improve complex processes involving rich, time-aware multimodal data.
Warnings
- breaking The Rerun SDK is under active development and the API is still evolving. Expect breaking changes between minor versions, especially prior to a 1.0 release. Recent breaking changes (around 0.30/0.31) included updates to gRPC-based viewer communication, the `.rrd` file format, and connection methods.
- gotcha The PyPI package name is `rerun-sdk`, but the Python module to import is simply `rerun`. Using `import rerun_sdk` will result in an `ImportError`.
- gotcha The Rerun Viewer might experience slowdowns when visualizing an excessive number of entities or very large point clouds (multi-million points).
- gotcha The Rerun SDK provides multiple operating modes (`spawn`, `connect_grpc`, `serve_grpc`, `save`, `stdout`). By default, these modes will override each other. If you intend to use multiple data sinks concurrently (e.g., streaming to a viewer and saving to a file simultaneously), you must explicitly configure them using `rr.set_sinks()`.
Install
-
pip install rerun-sdk -
pip install rerun-sdk[notebook]
Imports
- rerun
import rerun as rr
Quickstart
import rerun as rr
import numpy as np
# Initialize Rerun with an application ID and spawn the viewer.
# The 'spawn=True' argument will automatically open the Rerun Viewer application.
rr.init("my_first_rerun_app", spawn=True)
# Generate some example 3D data (a grid of points with colors).
SIZE = 10
pos_grid = np.meshgrid(*[np.linspace(-5, 5, SIZE)] * 3)
positions = np.vstack([d.ravel() for d in pos_grid]).T
col_grid = np.meshgrid(*[np.linspace(0, 255, SIZE)] * 3)
colors = np.vstack([c.ravel() for c in col_grid]).astype(np.uint8).T
# Log the 3D points with colors to an entity named 'my_points'.
rr.log(
"my_points",
rr.Points3D(positions, colors=colors, radii=0.5)
)
print("Logged 3D points. Check the Rerun Viewer!")