From 3205236f6c455eac0beb226d17bbf034f804172c Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Tue, 27 Aug 2024 15:54:05 -0400 Subject: [PATCH] Add a release checklist for overrides, including VisualizerOverrides --- .../check_blueprint_overrides.py | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 tests/python/release_checklist/check_blueprint_overrides.py diff --git a/tests/python/release_checklist/check_blueprint_overrides.py b/tests/python/release_checklist/check_blueprint_overrides.py new file mode 100644 index 000000000000..ed9386b605de --- /dev/null +++ b/tests/python/release_checklist/check_blueprint_overrides.py @@ -0,0 +1,71 @@ +from __future__ import annotations + +import os +from argparse import Namespace +from uuid import uuid4 + +import rerun as rr +import rerun.blueprint as rrb + +README = """\ +# Blueprint overrides + +This checks that overrides work as expected when sent via blueprint APIs. + +Expected behavior: +* The `sin` plot should be a blue line (set via defaults) +* The `cos` plot should be a green points with cross markers (set via overrides) +""" + + +def log_readme() -> None: + rr.log("readme", rr.TextDocument(README, media_type=rr.MediaType.MARKDOWN), static=True) + + +def log_plots() -> None: + from math import cos, sin, tau + + for t in range(0, int(tau * 2 * 10.0)): + rr.set_time_sequence("frame_nr", t) + + sin_of_t = sin(float(t) / 10.0) + rr.log("plots/sin", rr.Scalar(sin_of_t)) + + cos_of_t = cos(float(t) / 10.0) + rr.log("plots/cos", rr.Scalar(cos_of_t)) + + rr.send_blueprint( + rrb.Blueprint( + rrb.Grid( + rrb.TextDocumentView(origin="readme", name="Instructions"), + rrb.TimeSeriesView( + name="Plots", + defaults=[rr.components.Color([0, 0, 255])], + overrides={ + "plots/cos": [ + rrb.VisualizerOverrides("SeriesPoint"), + rr.components.Color([0, 255, 0]), + # TODDO(#6670): This should just be rr.components.MarkerShape.Cross + rr.components.MarkerShapeBatch("cross"), + ], + }, + ), + ) + ) + ) + + +def run(args: Namespace) -> None: + rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=uuid4()) + + log_readme() + log_plots() + + +if __name__ == "__main__": + import argparse + + parser = argparse.ArgumentParser(description="Interactive release checklist") + rr.script_add_args(parser) + args = parser.parse_args() + run(args)