__init__.py
rerun
The Rerun Python SDK, which is a wrapper around the re_sdk crate.
def init(application_id, recording_id=None, spawn=False, init_logging=True, default_enabled=True, strict=False, exp_init_blueprint=False, exp_add_to_app_default_blueprint=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.new_recording
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
application_id |
str
|
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
|
required |
recording_id |
Optional[str]
|
Set the recording ID that this process is logging to, as a UUIDv4. The default recording_id is based on If you are not using |
None
|
spawn |
bool
|
Spawn a Rerun Viewer and stream logging data to it.
Short for calling |
False
|
default_enabled |
bool
|
Should Rerun logging be on by default?
Can be overridden with the RERUN env-var, e.g. |
True
|
init_logging |
bool
|
Should we initialize the logging for this application? |
True
|
strict |
bool
|
If |
False
|
exp_init_blueprint |
bool
|
(Experimental) Should we initialize the blueprint for this application? |
False
|
exp_add_to_app_default_blueprint |
bool
|
(Experimental) Should the blueprint append to the existing app-default blueprint instead of creating a new one. |
True
|
def new_recording(application_id, recording_id=None, make_default=False, make_thread_default=False, spawn=False, default_enabled=True)
Creates a new recording 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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
application_id |
str
|
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
|
required |
recording_id |
Optional[str]
|
Set the recording ID that this process is logging to, as a UUIDv4. The default recording_id is based on If you are not using |
None
|
make_default |
bool
|
If true (not the default), the newly initialized recording will replace the current active one (if any) in the global scope. |
False
|
make_thread_default |
bool
|
If true (not the default), the newly initialized recording will replace the current active one (if any) in the thread-local scope. |
False
|
spawn |
bool
|
Spawn a Rerun Viewer and stream logging data to it.
Short for calling |
False
|
default_enabled |
bool
|
Should Rerun logging be on by default?
Can be overridden with the RERUN env-var, e.g. |
True
|
Returns:
Type | Description |
---|---|
RecordingStream
|
A handle to the |
def version()
Returns a verbose version string of the Rerun SDK.
Example: rerun_py 0.6.0-alpha.0 [rustc 1.69.0 (84c898d65 2023-04-16), LLVM 15.0.7] aarch64-apple-darwin main bd8a072, built 2023-05-11T08:25:17Z
def shutdown_at_exit(func)
Decorator to shutdown Rerun cleanly when this function exits.
Normally, Rerun installs an atexit-handler that attempts to shutdown cleanly and flush all outgoing data before terminating. However, some cases, such as forked processes will always skip this at-exit handler. In these cases, you can use this decorator on the entry-point to your subprocess to ensure cleanup happens as expected without losing data.
def strict_mode()
Strict mode enabled.
In strict mode, incorrect use of the Rerun API (wrong parameter types etc.) will result in exception being raised. When strict mode is on, such problems are instead logged as warnings.
The default is OFF.
def set_strict_mode(mode)
Turn strict mode on/off.
In strict mode, incorrect use of the Rerun API (wrong parameter types etc.) will result in exception being raised. When strict mode is off, such problems are instead logged as warnings.
The default is OFF.
def start_web_viewer_server(port=0)
Start an HTTP server that hosts the rerun web viewer.
This only provides the web-server that makes the viewer available and does not otherwise provide a rerun websocket server or facilitate any routing of data.
This is generally only necessary for application such as running a jupyter notebook in a context where app.rerun.io is unavailable, or does not have the matching resources for your build (such as when running from source.)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
port |
int
|
Port to serve assets on. Defaults to 0 (random port). |
0
|