Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Jun 25, 2025

Related

What

We were lacking a lot of documentation in that area. Addressing this here alongside deprecation of serve_web.
serve_web is still available, but it's recommended to use an explicit combination of serve_grpc and serve_web_viewer now. The rationale is that rr.serve_web was confusing as it created two different serves that can get easily confused.

Python:

"""Demonstrate how to log data to a gRPC server and connect the web viewer to it."""

import time

import rerun as rr

rr.init("rerun_example_serve_web_viewer")
# Start a gRPC server and use it as log sink.
server_uri = rr.serve_grpc()

# Connect the web viewer to the gRPC server and open it in the browser
rr.serve_web_viewer(connect_to=server_uri)

# Log some data to the gRPC server.
rr.log("data", rr.Boxes3D(half_sizes=[2.0, 2.0, 1.0]))

# Keep server running. If we cancel it too early, data may never arrive in the browser.
try:
    while True:
        time.sleep(1)
except KeyboardInterrupt:
    print("\nShutting down server...")

Rust:

//! Demonstrate how to log data to a gRPC server and connect the web viewer to it.

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Start a gRPC server and use it as log sink.
    let rec = rerun::RecordingStreamBuilder::new("rerun_example_serve_web_viewer").serve_grpc()?;

    // Connect the web viewer to the gRPC server and open it in the browser.
    let _server_guard = rerun::serve_web_viewer(rerun::web_viewer::WebViewerConfig {
        connect_to: Some("rerun+http://localhost/proxy".to_owned()),
        ..Default::default()
    })?;

    // Log some data to the gRPC server.
    rec.log("data", &rerun::Boxes3D::from_half_sizes([(2.0, 2.0, 1.0)]))?;

    // Keep server running. If we cancel it too early, data may never arrive in the browser.
    std::thread::sleep(std::time::Duration::from_secs(u64::MAX));

    Ok(())
}

(these snippets are part of the documentation as well now)

  • pass full ci

@Wumpf Wumpf added 📖 documentation Improvements or additions to documentation sdk-python Python logging API sdk-rust Rust logging API include in changelog labels Jun 25, 2025
Copy link

github-actions bot commented Jun 25, 2025

Latest documentation preview deployed successfully.

Result Commit Link
f32f5ae https://landing-rd25wcpbz-rerun.vercel.app/docs

Note: This comment is updated whenever you push a commit.

Copy link

github-actions bot commented Jun 25, 2025

Web viewer built successfully. If applicable, you should also test it:

  • I have tested the web viewer
Result Commit Link Manifest
f32f5ae https://rerun.io/viewer/pr/10360 +nightly +main

Note: This comment is updated whenever you push a commit.

since = "0.20.0",
note = "use rec.serve_grpc() with rerun::serve_web_viewer() instead"
)]
pub fn serve(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed this since it was overdue and in turn now relied on a deprecated method

Copy link
Member

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful ❤️

@Wumpf Wumpf force-pushed the andreas/python/deprecate-serve-web branch from e49b906 to 0851c10 Compare June 25, 2025 13:18
@Wumpf
Copy link
Member Author

Wumpf commented Jun 25, 2025

@rerun-bot full-check

Copy link

@Wumpf
Copy link
Member Author

Wumpf commented Jun 25, 2025

@rerun-bot full-check

Copy link

Started a full build: https://github.com/rerun-io/rerun/actions/runs/15879256526

@Wumpf Wumpf merged commit 2e7583a into main Jun 25, 2025
113 of 116 checks passed
@Wumpf Wumpf deleted the andreas/python/deprecate-serve-web branch June 25, 2025 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📖 documentation Improvements or additions to documentation include in changelog sdk-python Python logging API sdk-rust Rust logging API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

serve_web function need to back Deprecate serve_web
2 participants