Skip to content

Initialization functions

rerun

class RecordingStream

A RecordingStream is used to send data to Rerun.

You can instantiate a RecordingStream by calling either rerun.init (to create a global recording) or rerun.RecordingStream (for more advanced use cases).

Multithreading

A RecordingStream can safely be copied and sent to other threads. You can also set a recording as the global active one for all threads (rerun.set_global_data_recording) or just for the current thread (rerun.set_thread_local_data_recording).

Similarly, the with keyword can be used to temporarily set the active recording for the current thread, e.g.:

with rec:
    rr.log(...)
WARNING: if using a RecordingStream as a context manager, yielding from a generator function while holding the context open will leak the context and likely cause your program to send data to the wrong stream. See: https://github.com/rerun-io/rerun/issues/6238. You can work around this by using the rerun.recording_stream_generator_ctx decorator.

Flushing or context manager exit guarantees that all previous data sent by the calling thread has been recorded and (if applicable) flushed to the underlying OS-managed file descriptor, but other threads may still have data in flight.

See also: rerun.get_data_recording, rerun.get_global_data_recording, rerun.get_thread_local_data_recording.

Available methods

Every function in the Rerun SDK that takes an optional RecordingStream as a parameter can also be called as a method on RecordingStream itself.

This includes, but isn't limited to:

For an exhaustive list, see help(rerun.RecordingStream).

Micro-batching

Micro-batching using both space and time triggers (whichever comes first) is done automatically in a dedicated background thread.

You can configure the frequency of the batches using the following environment variables:

  • RERUN_FLUSH_TICK_SECS: Flush frequency in seconds (default: 0.05 (50ms)).
  • RERUN_FLUSH_NUM_BYTES: Flush threshold in bytes (default: 1048576 (1MiB)).
  • RERUN_FLUSH_NUM_ROWS: Flush threshold in number of rows (default: 18446744073709551615 (u64::MAX)).
def __init__(application_id, *, recording_id=None, make_default=False, make_thread_default=False, default_enabled=True, send_properties=True)

Creates a new recording stream with a user-chosen application id (name) that can be used to log data.

If you only need a single global recording, rerun.init might be simpler.

Note that new recording streams always begin connected to a buffered sink. To send the data to a viewer or file you will likely want to call rerun.connect_grpc or rerun.save explicitly.

Warning

If you don't specify a recording_id, it will default to a random value that is generated once at the start of the process. That value will be kept around for the whole lifetime of the process, and even inherited by all its subprocesses, if any.

This makes it trivial to log data to the same recording in a multiprocess setup, but it also means that the following code will not create two distinct recordings:

rr.init("my_app")
rr.init("my_app")

To create distinct recordings from the same process, specify distinct recording IDs:

from uuid import uuid4
rec = rr.RecordingStream(application_id="test", recording_id=uuid4())
rec = rr.RecordingStream(application_id="test", recording_id=uuid4())

PARAMETER DESCRIPTION
application_id

Your Rerun recordings will be categorized by this application id, so try to pick a unique one for each application that uses the Rerun SDK.

For example, if you have one application doing object detection and another doing camera calibration, you could have rerun.init("object_detector") and rerun.init("calibrator").

TYPE: str

recording_id

Set the recording ID that this process is logging to, as a UUIDv4.

The default recording_id is based on multiprocessing.current_process().authkey which means that all processes spawned with multiprocessing will have the same default recording_id.

If you are not using multiprocessing and still want several different Python processes to log to the same Rerun instance (and be part of the same recording), you will need to manually assign them all the same recording_id. Any random UUIDv4 will work, or copy the recording id for the parent process.

TYPE: Optional[str] DEFAULT: None

make_default

If true (not the default), the newly initialized recording will replace the current active one (if any) in the global scope.

TYPE: bool DEFAULT: False

make_thread_default

If true (not the default), the newly initialized recording will replace the current active one (if any) in the thread-local scope.

TYPE: bool DEFAULT: False

default_enabled

Should Rerun logging be on by default? Can be overridden with the RERUN env-var, e.g. RERUN=on or RERUN=off.

TYPE: bool DEFAULT: True

send_properties

Immediately send the recording properties to the viewer (default: True)

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
RecordingStream

A handle to the rerun.RecordingStream. Use it to log data to Rerun.

Examples:

Using a recording stream object directly.

from uuid import uuid4
stream = rr.RecordingStream("my_app", recording_id=uuid4())
stream.connect_grpc()
stream.log("hello", rr.TextLog("Hello world"))

def connect_grpc(url=None, *, flush_timeout_sec=2.0, default_blueprint=None)

Connect to a remote Rerun Viewer on the given HTTP(S) URL.

This function returns immediately.

PARAMETER DESCRIPTION
url

The HTTP(S) URL to connect to

TYPE: str | None DEFAULT: None

flush_timeout_sec

The minimum time the SDK will wait during a flush before potentially dropping data if progress is not being made. Passing None indicates no timeout, and can cause a call to flush to block indefinitely.

TYPE: float | None DEFAULT: 2.0

default_blueprint

Optionally set a default blueprint to use for this application. If the application already has an active blueprint, the new blueprint won't become active until the user clicks the "reset blueprint" button. If you want to activate the new blueprint immediately, instead use the rerun.send_blueprint API.

TYPE: BlueprintLike | None DEFAULT: None

def disable_timeline(timeline)

Clear time information for the specified timeline on this thread.

PARAMETER DESCRIPTION
timeline

The name of the timeline to clear the time for.

TYPE: str

def disconnect()

Closes all TCP connections, servers, and files.

Closes all TCP connections, servers, and files that have been opened with [rerun.connect_grpc], [rerun.serve], [rerun.save] or [rerun.spawn].

def flush(blocking=True)

Initiates a flush the batching pipeline and optionally waits for it to propagate to the underlying file descriptor (if any).

PARAMETER DESCRIPTION
blocking

If true, the flush will block until the flush is complete.

TYPE: bool DEFAULT: True

def log(entity_path, entity, *extra, static=False, strict=None)

Log data to Rerun.

This is the main entry point for logging data to rerun. It can be used to log anything that implements the rerun.AsComponents interface, or a collection of ComponentBatchLike objects.

When logging data, you must always provide an entity_path for identifying the data. Note that paths prefixed with "__" are considered reserved for use by the Rerun SDK itself and should not be used for logging user data. This is where Rerun will log additional information such as properties and warnings.

The most common way to log is with one of the rerun archetypes, all of which implement the AsComponents interface.

For example, to log a 3D point:

rr.log("my/point", rr.Points3D(position=[1.0, 2.0, 3.0]))

The log function can flexibly accept an arbitrary number of additional objects which will be merged into the first entity so long as they don't expose conflicting components, for instance:

# Log three points with arrows sticking out of them,
# and a custom "confidence" component.
rr.log(
    "my/points",
    rr.Points3D([[0.2, 0.5, 0.3], [0.9, 1.2, 0.1], [1.0, 4.2, 0.3]], radii=[0.1, 0.2, 0.3]),
    rr.Arrows3D(vectors=[[0.3, 2.1, 0.2], [0.9, -1.1, 2.3], [-0.4, 0.5, 2.9]]),
    rr.AnyValues(confidence=[0.3, 0.4, 0.9]),
)

PARAMETER DESCRIPTION
entity_path

Path to the entity in the space hierarchy.

The entity path can either be a string (with special characters escaped, split on unescaped slashes) or a list of unescaped strings. This means that logging to "world/my\ image\!" is the same as logging to ["world", "my image!"].

See https://www.rerun.io/docs/concepts/entity-path for more on entity paths.

TYPE: str | list[object]

entity

Anything that implements the rerun.AsComponents interface, usually an archetype.

TYPE: AsComponents | Iterable[DescribedComponentBatch]

*extra

An arbitrary number of additional component bundles implementing the rerun.AsComponents interface, that are logged to the same entity path.

TYPE: AsComponents | Iterable[DescribedComponentBatch] DEFAULT: ()

static

If true, the components will be logged as static data.

Static data has no time associated with it, exists on all timelines, and unconditionally shadows any temporal data of the same type.

Otherwise, the data will be timestamped automatically with log_time and log_tick. Additional timelines set by rerun.set_time_sequence, rerun.set_time_seconds or rerun.set_time_nanos will also be included.

TYPE: bool DEFAULT: False

strict

If True, raise exceptions on non-loggable data. If False, warn on non-loggable data. if None, use the global default from rerun.strict_mode()

TYPE: bool | None DEFAULT: None

def log_file_from_contents(file_path, file_contents, *, entity_path_prefix=None, static=False)

Logs the given file_contents using all DataLoaders available.

A single path might be handled by more than one loader.

This method blocks until either at least one DataLoader starts streaming data in or all of them fail.

See https://www.rerun.io/docs/getting-started/data-in/open-any-file for more information.

PARAMETER DESCRIPTION
file_path

Path to the file that the file_contents belong to.

TYPE: str | Path

file_contents

Contents to be logged.

TYPE: bytes

entity_path_prefix

What should the logged entity paths be prefixed with?

TYPE: str | None DEFAULT: None

static

If true, the components will be logged as static data.

Static data has no time associated with it, exists on all timelines, and unconditionally shadows any temporal data of the same type.

Otherwise, the data will be timestamped automatically with log_time and log_tick. Additional timelines set by rerun.set_time_sequence, rerun.set_time_seconds or rerun.set_time_nanos will also be included.

TYPE: bool DEFAULT: False

def log_file_from_path(file_path, *, entity_path_prefix=None, static=False)

Logs the file at the given path using all DataLoaders available.

A single path might be handled by more than one loader.

This method blocks until either at least one DataLoader starts streaming data in or all of them fail.

See https://www.rerun.io/docs/getting-started/data-in/open-any-file for more information.

PARAMETER DESCRIPTION
file_path

Path to the file to be logged.

TYPE: str | Path

entity_path_prefix

What should the logged entity paths be prefixed with?

TYPE: str | None DEFAULT: None

static

If true, the components will be logged as static data.

Static data has no time associated with it, exists on all timelines, and unconditionally shadows any temporal data of the same type.

Otherwise, the data will be timestamped automatically with log_time and log_tick. Additional timelines set by rerun.set_time_sequence, rerun.set_time_seconds or rerun.set_time_nanos will also be included.

TYPE: bool DEFAULT: False

def memory_recording()

Streams all log-data to a memory buffer.

This can be used to display the RRD to alternative formats such as html. See: rerun.notebook_show.

RETURNS DESCRIPTION
MemoryRecording

A memory recording object that can be used to read the data.

def notebook_show(*, width=None, height=None, blueprint=None)

Output the Rerun viewer in a notebook using IPython IPython.core.display.HTML.

Any data logged to the recording after initialization will be sent directly to the viewer.

Note that this can be called at any point during cell execution. The call will block until the embedded viewer is initialized and ready to receive data. Thereafter any log calls will immediately send data to the viewer.

PARAMETER DESCRIPTION
width

The width of the viewer in pixels.

TYPE: int DEFAULT: None

height

The height of the viewer in pixels.

TYPE: int DEFAULT: None

blueprint

A blueprint object to send to the viewer. It will be made active and set as the default blueprint in the recording.

Setting this is equivalent to calling rerun.send_blueprint before initializing the viewer.

TYPE: BlueprintLike DEFAULT: None

def save(path, default_blueprint=None)

Stream all log-data to a file.

Call this before you log any data!

The Rerun Viewer is able to read continuously from the resulting rrd file while it is being written. However, depending on your OS and configuration, changes may not be immediately visible due to file caching. This is a common issue on Windows and (to a lesser extent) on MacOS.

PARAMETER DESCRIPTION
path

The path to save the data to.

TYPE: str | Path

default_blueprint

Optionally set a default blueprint to use for this application. If the application already has an active blueprint, the new blueprint won't become active until the user clicks the "reset blueprint" button. If you want to activate the new blueprint immediately, instead use the rerun.send_blueprint API.

TYPE: BlueprintLike | None DEFAULT: None

def send_blueprint(blueprint, *, make_active=True, make_default=True)

Create a blueprint from a BlueprintLike and send it to the RecordingStream.

PARAMETER DESCRIPTION
blueprint

A blueprint object to send to the viewer.

TYPE: BlueprintLike

make_active

Immediately make this the active blueprint for the associated app_id. Note that setting this to false does not mean the blueprint may not still end up becoming active. In particular, if make_default is true and there is no other currently active blueprint.

TYPE: bool DEFAULT: True

make_default

Make this the default blueprint for the app_id. The default blueprint will be used as the template when the user resets the blueprint for the app. It will also become the active blueprint if no other blueprint is currently active.

TYPE: bool DEFAULT: True

def send_columns(entity_path, indexes, columns, strict=None)

Send columnar data to Rerun.

Unlike the regular log API, which is row-oriented, this API lets you submit the data in a columnar form. Each TimeColumnLike and ComponentColumn object represents a column of data that will be sent to Rerun. The lengths of all these columns must match, and all data that shares the same index across the different columns will act as a single logical row, equivalent to a single call to rr.log().

Note that this API ignores any stateful time set on the log stream via the rerun.set_time_* APIs. Furthermore, this will not inject the default timelines log_tick and log_time timeline columns.

PARAMETER DESCRIPTION
entity_path

Path to the entity in the space hierarchy.

See https://www.rerun.io/docs/concepts/entity-path for more on entity paths.

TYPE: str

indexes

The time values of this batch of data. Each TimeColumnLike object represents a single column of timestamps. Generally, you should use one of the provided classes: TimeSequenceColumn, TimeSecondsColumn, or TimeNanosColumn.

TYPE: Iterable[TimeColumnLike]

columns

The columns of components to log. Each object represents a single column of data.

In order to send multiple components per time value, explicitly create a ComponentColumn either by constructing it directly, or by calling the .columns() method on an Archetype type.

TYPE: Iterable[ComponentColumn]

strict

If True, raise exceptions on non-loggable data. If False, warn on non-loggable data. If None, use the global default from rerun.strict_mode()

TYPE: bool | None DEFAULT: None

def send_property(name, values)
Send a property of the recording.
PARAMETER DESCRIPTION
name

Name of the property.

TYPE: str

values

Anything that implements the rerun.AsComponents interface, usually an archetype, or an iterable of (described)component batches.

TYPE: AsComponents | Iterable[DescribedComponentBatch]

def send_recording_name(name)

Send the name of the recording.

This name is shown in the Rerun Viewer.

PARAMETER DESCRIPTION
name

The name of the recording.

TYPE: str

def send_recording_start_time_nanos(nanos)

Send the start time of the recording.

This timestamp is shown in the Rerun Viewer.

PARAMETER DESCRIPTION
nanos

The start time of the recording.

TYPE: int

def serve_web(*, open_browser=True, web_port=None, grpc_port=None, default_blueprint=None, server_memory_limit='25%')

Serve log-data over WebSockets and serve a Rerun web viewer over HTTP.

You can also connect to this server with the native viewer using rerun localhost:9090.

The WebSocket server will buffer all log data in memorsy so that late connecting viewers will get all the data. You can limit the amount of data buffered by the WebSocket server with the server_memory_limit argument. Once reached, the earliest logged data will be dropped. Note that this means that static data may be dropped if logged early (see https://github.com/rerun-io/rerun/issues/5531).

This function returns immediately.

PARAMETER DESCRIPTION
open_browser

Open the default browser to the viewer.

TYPE: bool DEFAULT: True

web_port

The port to serve the web viewer on (defaults to 9090).

TYPE: int | None DEFAULT: None

grpc_port

The port to serve the gRPC server on (defaults to 9876)

TYPE: int | None DEFAULT: None

default_blueprint

Optionally set a default blueprint to use for this application. If the application already has an active blueprint, the new blueprint won't become active until the user clicks the "reset blueprint" button. If you want to activate the new blueprint immediately, instead use the rerun.send_blueprint API.

TYPE: BlueprintLike | None DEFAULT: None

server_memory_limit

Maximum amount of memory to use for buffering log data for clients that connect late. This can be a percentage of the total ram (e.g. "50%") or an absolute value (e.g. "4GB").

TYPE: str DEFAULT: '25%'

def set_time(timeline, *, sequence=None, duration=None, timestamp=None)

Set the current time of a timeline for this thread.

Used for all subsequent logging on the same thread, until the next call to rerun.set_time, rerun.reset_time or rerun.disable_timeline.

For example: set_time("frame_nr", sequence=frame_nr).

There is no requirement of monotonicity. You can move the time backwards if you like.

You are expected to set exactly ONE of the arguments sequence, duration, or timestamp. You may NOT change the type of a timeline, so if you use duration for a specific timeline, you must only use duration for that timeline going forward.

The columnar equivalent to this function is rerun.TimeColumn.

PARAMETER DESCRIPTION
timeline

The name of the timeline to set the time for.

TYPE: str

sequence

Used for sequential indices, like frame_nr. Must be an integer.

TYPE: int | None DEFAULT: None

duration

Used for relative times, like time_since_start. Must either be in seconds, a datetime.timedelta, or numpy.timedelta64. For nanosecond precision, use numpy.timedelta64(nanoseconds, 'ns').

TYPE: int | float | timedelta | timedelta64 | None DEFAULT: None

timestamp

Used for absolute time indices, like capture_time. Must either be in seconds since Unix epoch, a datetime.datetime, or numpy.datetime64. For nanosecond precision, use numpy.datetime64(nanoseconds, 'ns').

TYPE: int | float | datetime | datetime64 | None DEFAULT: None

def set_time_nanos(timeline, nanos)

Set the current time for this thread.

Used for all subsequent logging on the same thread, until the next call to rerun.set_time_nanos or rerun.set_time_seconds.

For example: set_time_nanos("capture_time", nanos_since_unix_epoch).

You can remove a timeline again using disable_timeline("capture_time").

Very large values will automatically be interpreted as nanoseconds since unix epoch (1970-01-01). Small values (less than a few years) will be interpreted as relative some unknown point in time, and will be shown as e.g. +3.132s.

The bindings has a built-in time which is log_time, and is logged as nanos since unix epoch.

There is no requirement of monotonicity. You can move the time backwards if you like.

This function marks the timeline as being of a temporal type. You should not use the sequential function rerun.set_time_sequence on the same timeline, as that will produce undefined behavior.

PARAMETER DESCRIPTION
timeline

The name of the timeline to set the time for.

TYPE: str

nanos

The current time on the timeline in nanoseconds.

TYPE: int

def set_time_seconds(timeline, seconds)

Set the current time for this thread in seconds.

Used for all subsequent logging on the same thread, until the next call to rerun.set_time_seconds or rerun.set_time_nanos.

For example: set_time_seconds("capture_time", seconds_since_unix_epoch).

You can remove a timeline again using disable_timeline("capture_time").

Very large values will automatically be interpreted as seconds since unix epoch (1970-01-01). Small values (less than a few years) will be interpreted as relative some unknown point in time, and will be shown as e.g. +3.132s.

The bindings has a built-in time which is log_time, and is logged as seconds since unix epoch.

There is no requirement of monotonicity. You can move the time backwards if you like.

This function marks the timeline as being of a temporal type. You should not use the sequential function rerun.set_time_sequence on the same timeline, as that will produce undefined behavior.

PARAMETER DESCRIPTION
timeline

The name of the timeline to set the time for.

TYPE: str

seconds

The current time on the timeline in seconds.

TYPE: float

def set_time_sequence(timeline, sequence)

Set the current time for this thread as an integer sequence.

Used for all subsequent logging on the same thread, until the next call to set_time_sequence.

For example: set_time_sequence("frame_nr", frame_nr).

You can remove a timeline again using disable_timeline("frame_nr").

There is no requirement of monotonicity. You can move the time backwards if you like.

This function marks the timeline as being of a squential type. You should not use the temporal functions (rerun.set_time_seconds, rerun.set_time_nanos) on the same timeline, as that will produce undefined behavior.

PARAMETER DESCRIPTION
timeline

The name of the timeline to set the time for.

TYPE: str

sequence

The current time on the timeline in integer units.

TYPE: int

def spawn(*, port=9876, connect=True, memory_limit='75%', hide_welcome_screen=False, default_blueprint=None)

Spawn a Rerun Viewer, listening on the given port.

This is often the easiest and best way to use Rerun. Just call this once at the start of your program.

You can also call rerun.init with a spawn=True argument.

PARAMETER DESCRIPTION
port

The port to listen on.

TYPE: int DEFAULT: 9876

connect

also connect to the viewer and stream logging data to it.

TYPE: bool DEFAULT: True

memory_limit

An upper limit on how much memory the Rerun Viewer should use. When this limit is reached, Rerun will drop the oldest data. Example: 16GB or 50% (of system total).

TYPE: str DEFAULT: '75%'

hide_welcome_screen

Hide the normal Rerun welcome screen.

TYPE: bool DEFAULT: False

default_blueprint

Optionally set a default blueprint to use for this application. If the application already has an active blueprint, the new blueprint won't become active until the user clicks the "reset blueprint" button. If you want to activate the new blueprint immediately, instead use the rerun.send_blueprint API.

TYPE: BlueprintLike | None DEFAULT: None

def stdout(default_blueprint=None)

Stream all log-data to stdout.

Pipe it into a Rerun Viewer to visualize it.

Call this before you log any data!

If there isn't any listener at the other end of the pipe, the RecordingStream will default back to buffered mode, in order not to break the user's terminal.

PARAMETER DESCRIPTION
default_blueprint

Optionally set a default blueprint to use for this application. If the application already has an active blueprint, the new blueprint won't become active until the user clicks the "reset blueprint" button. If you want to activate the new blueprint immediately, instead use the rerun.send_blueprint API.

TYPE: BlueprintLike | None DEFAULT: None

def init(application_id, *, recording_id=None, spawn=False, init_logging=True, default_enabled=True, strict=None, default_blueprint=None, send_properties=True)

Initialize the Rerun SDK with a user-chosen application id (name).

You must call this function first in order to initialize a global recording. Without an active recording, all methods of the SDK will turn into no-ops.

For more advanced use cases, e.g. multiple recordings setups, see rerun.RecordingStream.

Warning

If you don't specify a recording_id, it will default to a random value that is generated once at the start of the process. That value will be kept around for the whole lifetime of the process, and even inherited by all its subprocesses, if any.

This makes it trivial to log data to the same recording in a multiprocess setup, but it also means that the following code will not create two distinct recordings:

rr.init("my_app")
rr.init("my_app")

To create distinct recordings from the same process, specify distinct recording IDs:

from uuid import uuid4
rr.init("my_app", recording_id=uuid4())
rr.init("my_app", recording_id=uuid4())

PARAMETER DESCRIPTION
application_id

Your Rerun recordings will be categorized by this application id, so try to pick a unique one for each application that uses the Rerun SDK.

For example, if you have one application doing object detection and another doing camera calibration, you could have rerun.init("object_detector") and rerun.init("calibrator").

Application ids starting with rerun_example_ are reserved for Rerun examples, and will be treated specially by the Rerun Viewer. In particular, it will opt-in to more analytics, and will also seed the global random number generator deterministically.

TYPE: str

recording_id

Set the recording ID that this process is logging to, as a UUIDv4.

The default recording_id is based on multiprocessing.current_process().authkey which means that all processes spawned with multiprocessing will have the same default recording_id.

If you are not using multiprocessing and still want several different Python processes to log to the same Rerun instance (and be part of the same recording), you will need to manually assign them all the same recording_id. Any random UUIDv4 will work, or copy the recording id for the parent process.

TYPE: Optional[str] DEFAULT: None

spawn

Spawn a Rerun Viewer and stream logging data to it. Short for calling spawn separately. If you don't call this, log events will be buffered indefinitely until you call either connect, show, or save

TYPE: bool DEFAULT: False

default_enabled

Should Rerun logging be on by default? Can be overridden with the RERUN env-var, e.g. RERUN=on or RERUN=off.

TYPE: bool DEFAULT: True

init_logging

Should we initialize the logging for this application?

TYPE: bool DEFAULT: True

strict

If True, an exception is raised on use error (wrong parameter types, etc.). If False, errors are logged as warnings instead. If unset, this can alternatively be overridden using the RERUN_STRICT environment variable. If not otherwise specified, the default behavior will be equivalent to False.

TYPE: bool | None DEFAULT: None

default_blueprint

Optionally set a default blueprint to use for this application. If the application already has an active blueprint, the new blueprint won't become active until the user clicks the "reset blueprint" button. If you want to activate the new blueprint immediately, instead use the rerun.send_blueprint API.

TYPE: BlueprintLike | None DEFAULT: None

send_properties
Immediately send the recording properties to the viewer (default: True)

TYPE: bool DEFAULT: True

def connect_grpc(url=None, *, flush_timeout_sec=2.0, default_blueprint=None, recording=None)

Connect to a remote Rerun Viewer on the given HTTP(S) URL.

This function returns immediately.

PARAMETER DESCRIPTION
url

The HTTP(S) URL to connect to

TYPE: str | None DEFAULT: None

flush_timeout_sec

The minimum time the SDK will wait during a flush before potentially dropping data if progress is not being made. Passing None indicates no timeout, and can cause a call to flush to block indefinitely.

TYPE: float | None DEFAULT: 2.0

default_blueprint

Optionally set a default blueprint to use for this application. If the application already has an active blueprint, the new blueprint won't become active until the user clicks the "reset blueprint" button. If you want to activate the new blueprint immediately, instead use the rerun.send_blueprint API.

TYPE: BlueprintLike | None DEFAULT: None

recording

Specifies the rerun.RecordingStream to use. If left unspecified, defaults to the current active data recording, if there is one. See also: rerun.init, rerun.set_global_data_recording.

TYPE: RecordingStream | None DEFAULT: None

def disconnect(recording=None)

Closes all TCP connections, servers, and files.

Closes all TCP connections, servers, and files that have been opened with [rerun.connect_grpc], [rerun.serve], [rerun.save] or [rerun.spawn].

PARAMETER DESCRIPTION
recording

Specifies the rerun.RecordingStream to use. If left unspecified, defaults to the current active data recording, if there is one. See also: rerun.init, rerun.set_global_data_recording.

TYPE: RecordingStream | None DEFAULT: None

def save(path, default_blueprint=None, recording=None)

Stream all log-data to a file.

Call this before you log any data!

The Rerun Viewer is able to read continuously from the resulting rrd file while it is being written. However, depending on your OS and configuration, changes may not be immediately visible due to file caching. This is a common issue on Windows and (to a lesser extent) on MacOS.

PARAMETER DESCRIPTION
path

The path to save the data to.

TYPE: str | Path

default_blueprint

Optionally set a default blueprint to use for this application. If the application already has an active blueprint, the new blueprint won't become active until the user clicks the "reset blueprint" button. If you want to activate the new blueprint immediately, instead use the rerun.send_blueprint API.

TYPE: BlueprintLike | None DEFAULT: None

recording

Specifies the rerun.RecordingStream to use. If left unspecified, defaults to the current active data recording, if there is one. See also: rerun.init, rerun.set_global_data_recording.

TYPE: RecordingStream | None DEFAULT: None

def send_blueprint(blueprint, *, make_active=True, make_default=True, recording=None)

Create a blueprint from a BlueprintLike and send it to the RecordingStream.

PARAMETER DESCRIPTION
blueprint

A blueprint object to send to the viewer.

TYPE: BlueprintLike

make_active

Immediately make this the active blueprint for the associated app_id. Note that setting this to false does not mean the blueprint may not still end up becoming active. In particular, if make_default is true and there is no other currently active blueprint.

TYPE: bool DEFAULT: True

make_default

Make this the default blueprint for the app_id. The default blueprint will be used as the template when the user resets the blueprint for the app. It will also become the active blueprint if no other blueprint is currently active.

TYPE: bool DEFAULT: True

recording

Specifies the rerun.RecordingStream to use. If left unspecified, defaults to the current active data recording, if there is one. See also: rerun.init, rerun.set_global_data_recording.

TYPE: RecordingStream | None DEFAULT: None

def serve_web(*, open_browser=True, web_port=None, grpc_port=None, default_blueprint=None, recording=None, server_memory_limit='25%')

Serve log-data over WebSockets and serve a Rerun web viewer over HTTP.

You can also connect to this server with the native viewer using rerun localhost:9090.

The WebSocket server will buffer all log data in memory so that late connecting viewers will get all the data. You can limit the amount of data buffered by the WebSocket server with the server_memory_limit argument. Once reached, the earliest logged data will be dropped. Note that this means that static data may be dropped if logged early (see https://github.com/rerun-io/rerun/issues/5531).

This function returns immediately.

PARAMETER DESCRIPTION
open_browser

Open the default browser to the viewer.

TYPE: bool DEFAULT: True

web_port

The port to serve the web viewer on (defaults to 9090).

TYPE: int | None DEFAULT: None

grpc_port

The port to serve the gRPC server on (defaults to 9876)

TYPE: int | None DEFAULT: None

default_blueprint

Optionally set a default blueprint to use for this application. If the application already has an active blueprint, the new blueprint won't become active until the user clicks the "reset blueprint" button. If you want to activate the new blueprint immediately, instead use the rerun.send_blueprint API.

TYPE: BlueprintLike | None DEFAULT: None

recording

Specifies the rerun.RecordingStream to use. If left unspecified, defaults to the current active data recording, if there is one. See also: rerun.init, rerun.set_global_data_recording.

TYPE: RecordingStream | None DEFAULT: None

server_memory_limit

Maximum amount of memory to use for buffering log data for clients that connect late. This can be a percentage of the total ram (e.g. "50%") or an absolute value (e.g. "4GB").

TYPE: str DEFAULT: '25%'

def spawn(*, port=9876, connect=True, memory_limit='75%', hide_welcome_screen=False, default_blueprint=None, recording=None)

Spawn a Rerun Viewer, listening on the given port.

This is often the easiest and best way to use Rerun. Just call this once at the start of your program.

You can also call rerun.init with a spawn=True argument.

PARAMETER DESCRIPTION
port

The port to listen on.

TYPE: int DEFAULT: 9876

connect

also connect to the viewer and stream logging data to it.

TYPE: bool DEFAULT: True

memory_limit

An upper limit on how much memory the Rerun Viewer should use. When this limit is reached, Rerun will drop the oldest data. Example: 16GB or 50% (of system total).

TYPE: str DEFAULT: '75%'

hide_welcome_screen

Hide the normal Rerun welcome screen.

TYPE: bool DEFAULT: False

recording

Specifies the rerun.RecordingStream to use if connect = True. If left unspecified, defaults to the current active data recording, if there is one. See also: rerun.init, rerun.set_global_data_recording.

TYPE: RecordingStream | None DEFAULT: None

default_blueprint

Optionally set a default blueprint to use for this application. If the application already has an active blueprint, the new blueprint won't become active until the user clicks the "reset blueprint" button. If you want to activate the new blueprint immediately, instead use the rerun.send_blueprint API.

TYPE: BlueprintLike | None DEFAULT: None

def memory_recording(recording=None)

Streams all log-data to a memory buffer.

This can be used to display the RRD to alternative formats such as html. See: rerun.notebook_show.

PARAMETER DESCRIPTION
recording

Specifies the rerun.RecordingStream to use. If left unspecified, defaults to the current active data recording, if there is one. See also: rerun.init, rerun.set_global_data_recording.

TYPE: RecordingStream | None DEFAULT: None

RETURNS DESCRIPTION
MemoryRecording

A memory recording object that can be used to read the data.

def notebook_show(*, width=None, height=None, blueprint=None, recording=None)

Output the Rerun viewer in a notebook using IPython IPython.core.display.HTML.

Any data logged to the recording after initialization will be sent directly to the viewer.

Note that this can be called at any point during cell execution. The call will block until the embedded viewer is initialized and ready to receive data. Thereafter any log calls will immediately send data to the viewer.

PARAMETER DESCRIPTION
width

The width of the viewer in pixels.

TYPE: int DEFAULT: None

height

The height of the viewer in pixels.

TYPE: int DEFAULT: None

blueprint

A blueprint object to send to the viewer. It will be made active and set as the default blueprint in the recording.

Setting this is equivalent to calling rerun.send_blueprint before initializing the viewer.

TYPE: BlueprintLike DEFAULT: None

recording

Specifies the rerun.RecordingStream to use. If left unspecified, defaults to the current active data recording, if there is one. See also: rerun.init, rerun.set_global_data_recording.

TYPE: RecordingStream | None DEFAULT: None

def legacy_notebook_show(*, width=DEFAULT_WIDTH, height=DEFAULT_HEIGHT, app_url=None, timeout_ms=DEFAULT_TIMEOUT, blueprint=None, recording=None)

Output the Rerun viewer in a notebook using IPython IPython.core.display.HTML.

This is a legacy function that uses a limited mechanism of inlining an RRD into a self-contained HTML template that loads the viewer in an iframe.

In general, rerun.notebook_show should be preferred. However, this function can be useful in some systems with incomplete support for the anywidget library.

PARAMETER DESCRIPTION
width

The width of the viewer in pixels.

TYPE: int DEFAULT: DEFAULT_WIDTH

height

The height of the viewer in pixels.

TYPE: int DEFAULT: DEFAULT_HEIGHT

app_url

Alternative HTTP url to find the Rerun web viewer. This will default to using https://app.rerun.io or localhost if rerun.start_web_viewer_server has been called.

TYPE: str DEFAULT: None

timeout_ms

The number of milliseconds to wait for the Rerun web viewer to load.

TYPE: int DEFAULT: DEFAULT_TIMEOUT

blueprint

The blueprint to display in the viewer.

TYPE: BlueprintLike DEFAULT: None

recording

Specifies the rerun.RecordingStream to use. If left unspecified, defaults to the current active data recording, if there is one. See also: rerun.init, rerun.set_global_data_recording.

TYPE: RecordingStream | None DEFAULT: None