Skip to content

Commit

Permalink
add minimal_options py example and use it in e2e suite (catches 2fast…
Browse files Browse the repository at this point in the history
…2log races(
  • Loading branch information
teh-cmc committed May 15, 2023
1 parent 86adc26 commit f3af273
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
23 changes: 23 additions & 0 deletions examples/python/minimal_options/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env python3

"""Demonstrates the most barebone usage of the Rerun SDK, with standard options."""


import argparse

import numpy as np
import rerun as rr

parser = argparse.ArgumentParser(description="Logs rich data using the Rerun SDK.")
rr.script_add_args(parser)
args, unknown = parser.parse_known_args()
[__import__("logging").warning(f"unknown arg: {arg}") for arg in unknown]

rr.script_setup(args, "minimal_options")

positions = np.vstack([xyz.ravel() for xyz in np.mgrid[3 * [slice(-5, 5, 10j)]]]).T
colors = np.vstack([rgb.ravel() for rgb in np.mgrid[3 * [slice(0, 255, 10j)]]]).astype(np.uint8).T

rr.log_points("my_points", positions=positions, colors=colors)

rr.script_teardown(args)
2 changes: 2 additions & 0 deletions examples/python/minimal_options/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
numpy
rerun-sdk
1 change: 1 addition & 0 deletions examples/python/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
-r dicom/requirements.txt
-r dna/requirements.txt
-r minimal/requirements.txt
-r minimal_options/requirements.txt
-r mp_pose/requirements.txt
-r multiprocessing/requirements.txt
-r multithreading/requirements.txt
Expand Down
2 changes: 2 additions & 0 deletions scripts/run_python_e2e_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def main() -> None:
requirements = [
"examples/python/api_demo/requirements.txt",
"examples/python/car/requirements.txt",
"examples/python/minimal_options/requirements.txt",
"examples/python/multithreading/requirements.txt",
"examples/python/plots/requirements.txt",
"examples/python/text_logging/requirements.txt",
Expand All @@ -61,6 +62,7 @@ def main() -> None:
# Trivial examples that don't require weird dependencies, or downloading data
("examples/python/api_demo/main.py", ["--demo", "all"]),
("examples/python/car/main.py", []),
("examples/python/minimal_options/main.py", []),
("examples/python/multithreading/main.py", []),
("examples/python/plots/main.py", []),
("examples/python/text_logging/main.py", []),
Expand Down

0 comments on commit f3af273

Please sign in to comment.