-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standard input/output support 3: Python SDK stdout impl/examples/docs (…
…#4513) Allow the Python SDK to stream RRD data to stdout. Checks: - [x] `just py-build && echo 'hello from stdin!' | python examples/python/stdio/main.py | rerun -` --- Part of a small PR series to add stdio streaming support to our Viewer and SDKs: - #4511 - #4512 - #4513 - #4514
- Loading branch information
Showing
8 changed files
with
98 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
title: Standard Input/Output example | ||
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/stdio/main.py?speculative-link | ||
rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/stdio/src/main.rs?speculative-link | ||
cpp: https://github.com/rerun-io/rerun/tree/latest/examples/cpp/stdio/main.cpp?speculative-link | ||
thumbnail: https://static.rerun.io/stdio/25c5aba992d4c8b3861386d8d9539a4823dca117/480w.png | ||
thumbnail_dimensions: [480, 298] | ||
--- | ||
|
||
<picture> | ||
<img src="https://static.rerun.io/stdio/25c5aba992d4c8b3861386d8d9539a4823dca117/full.png" alt=""> | ||
<source media="(max-width: 480px)" srcset="https://static.rerun.io/stdio/25c5aba992d4c8b3861386d8d9539a4823dca117/480w.png"> | ||
<source media="(max-width: 768px)" srcset="https://static.rerun.io/stdio/25c5aba992d4c8b3861386d8d9539a4823dca117/768w.png"> | ||
<source media="(max-width: 1024px)" srcset="https://static.rerun.io/stdio/25c5aba992d4c8b3861386d8d9539a4823dca117/1024w.png"> | ||
<source media="(max-width: 1200px)" srcset="https://static.rerun.io/stdio/25c5aba992d4c8b3861386d8d9539a4823dca117/1200w.png"> | ||
</picture> | ||
|
||
Demonstrates how to log data to standard output with the Rerun SDK, and then visualize it from standard input with the Rerun Viewer. | ||
|
||
```bash | ||
echo 'hello from stdin!' | python main.py | rerun - | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
Demonstrates how to use standard input/output with the Rerun SDK/Viewer. | ||
Usage: `echo 'hello from stdin!' | python main.py | rerun -` | ||
""" | ||
from __future__ import annotations | ||
|
||
import sys | ||
|
||
import rerun as rr # pip install rerun-sdk | ||
|
||
# sanity-check since all other example scripts take arguments: | ||
assert len(sys.argv) == 1, f"{sys.argv[0]} does not take any arguments" | ||
|
||
rr.init("rerun_example_stdio") | ||
rr.stdout() | ||
|
||
input = sys.stdin.buffer.read() | ||
|
||
rr.log("stdin", rr.TextDocument(input.decode("utf-8"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rerun-sdk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters