From 80ca0df6755fbc6c43b80d7c4250ba7ad61cebad Mon Sep 17 00:00:00 2001 From: jprochazk <1665677+jprochazk@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:34:08 +0200 Subject: [PATCH 01/19] add example templates --- Cargo.lock | 7 ++ examples/README.md | 5 ++ examples/python/requirements.txt | 1 + examples/python/template/README.md | 13 ++++ examples/python/template/main.py | 89 +++++++++++++++++++++++ examples/python/template/requirements.txt | 1 + examples/rust/template/Cargo.toml | 10 +++ examples/rust/template/README.md | 14 ++++ examples/rust/template/src/main.rs | 15 ++++ 9 files changed, 155 insertions(+) create mode 100644 examples/python/template/README.md create mode 100755 examples/python/template/main.py create mode 100644 examples/python/template/requirements.txt create mode 100644 examples/rust/template/Cargo.toml create mode 100644 examples/rust/template/README.md create mode 100644 examples/rust/template/src/main.rs diff --git a/Cargo.lock b/Cargo.lock index 2e495f70036f..ce11792bcb68 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5378,6 +5378,13 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "template" +version = "0.7.0-alpha.0" +dependencies = [ + "rerun", +] + [[package]] name = "termcolor" version = "1.2.0" diff --git a/examples/README.md b/examples/README.md index 6bcd89334d68..e3e436fc2b0f 100644 --- a/examples/README.md +++ b/examples/README.md @@ -40,3 +40,8 @@ python: https://github.com/rerun-io/rerun/tree/latest/examples/python/tracking_h The contents of this `README.md` file and its frontmatter are used to render the examples in [the documentation](https://rerun.io/examples). Individual examples are currently "stitched together" to form one large markdown file for every category of examples (`artificial-data`, `real-data`). The `manifest.yml` file describes the structure of the examples contained in this repository. Only the examples which appear in the manifest are included in the [generated documentation](https://rerun.io/examples). The file contains a description of its own format. + +## Adding a new example + +You can base your example off of `python/template` or `rust/template`. +Once it's ready to be displayed in the docs, add it to the [manifest](./manifest.yml). diff --git a/examples/python/requirements.txt b/examples/python/requirements.txt index a68bd6985bef..c83831ba7daa 100644 --- a/examples/python/requirements.txt +++ b/examples/python/requirements.txt @@ -21,5 +21,6 @@ -r ros/requirements.txt -r segment_anything/requirements.txt -r stable_diffusion/requirements.txt +-r template/requirements.txt -r text_logging/requirements.txt -r tracking_hf_opencv/requirements.txt diff --git a/examples/python/template/README.md b/examples/python/template/README.md new file mode 100644 index 000000000000..0fafa00aeff0 --- /dev/null +++ b/examples/python/template/README.md @@ -0,0 +1,13 @@ +--- +title: Template +python: https://github.com/rerun-io/rerun/tree/latest/examples/python/template/main.py +rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/template/src/main.rs +--- + + + +This is an example example. It is not a real example. You can duplicate the directory and use it as a starting point for writing a real example. + +```bash +python examples/python/template/main.py +``` diff --git a/examples/python/template/main.py b/examples/python/template/main.py new file mode 100755 index 000000000000..3346a0713a52 --- /dev/null +++ b/examples/python/template/main.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python3 +""" +How to integrate python's native `logging` with the Rerun SDK. + +Run: +```sh +./examples/python/text_logging/main.py +``` +""" +from __future__ import annotations + +import argparse +import logging + +import rerun as rr # pip install rerun-sdk + + +def setup_logging() -> None: + # That's really all there is to it: attach a Rerun logging handler to one + # or more loggers of your choosing and your logs will be forwarded. + # + # In this case we attach our handler directly to the root logger, which + # will catch events from all loggers going forward (propagation is on by + # default). + # + # For more info: https://docs.python.org/3/howto/logging.html#handlers + logging.getLogger().addHandler(rr.log.text.LoggingHandler()) + logging.getLogger().setLevel(-1) + + +def log_stuff(frame_offset: int) -> None: + # The usual + logging.critical("catastrophic failure") + logging.error("not going too well") + logging.info("somewhat relevant") + logging.debug("potentially interesting") + + # Custom log levels + logging.addLevelName(42, "IMPORTANT") + logging.log(42, "end-user deemed this important") + + # Log anything + logging.info("here's some data: %s", {"some": 42, "data": True}) + + # Log multi-line text + logging.info("First line\nSecond line\nAnd third!") + # Log multi-line text using the evil \r + logging.info("Line ending with \\r\\n\r\nSecond line ending with \\n\\r\n\rAnd a third line, which just ends") + + # Test that we can log multiple times to the same sequence timeline and still + # have the log messages show up in the correct chronological order in the viewer: + for frame_nr in range(2): + rr.set_time_sequence("frame_nr", 2 * frame_offset + frame_nr) + logging.info(f"Log one thing during frame {frame_nr}") + logging.info(f"Log second thing during the same frame {frame_nr}") + logging.info(f"Log third thing during the same frame {frame_nr}") + + # Use child loggers to map to arbitrary entity paths + inner_logger = logging.getLogger("foo.bar.baz") + inner_logger.info("hey") + + # Use spaces to create distinct logging streams + other_logger = logging.getLogger("totally.unrelated") + other_logger.propagate = False # don't want root logger to catch those + other_logger.addHandler(rr.log.text.LoggingHandler("3rd_party_logs")) + for _ in range(10): + other_logger.debug("look ma, got my very own view!") + + +def main() -> None: + parser = argparse.ArgumentParser( + description="demonstrates how to integrate python's native `logging` with the Rerun SDK" + ) + parser.add_argument("--repeat", type=int, default=1, help="How many times do we want to run the log function?") + 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, "text_logging") + + setup_logging() + for frame_offset in range(args.repeat): + log_stuff(frame_offset) + + rr.script_teardown(args) + + +if __name__ == "__main__": + main() diff --git a/examples/python/template/requirements.txt b/examples/python/template/requirements.txt new file mode 100644 index 000000000000..ebb847ff0d2d --- /dev/null +++ b/examples/python/template/requirements.txt @@ -0,0 +1 @@ +rerun-sdk diff --git a/examples/rust/template/Cargo.toml b/examples/rust/template/Cargo.toml new file mode 100644 index 000000000000..abe1f0e0b1ff --- /dev/null +++ b/examples/rust/template/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "template" +version = "0.7.0-alpha.0" +edition = "2021" +rust-version = "1.69" +license = "MIT OR Apache-2.0" +publish = false + +[dependencies] +rerun = { path = "../../../crates/rerun", features = ["native_viewer"] } diff --git a/examples/rust/template/README.md b/examples/rust/template/README.md new file mode 100644 index 000000000000..071042b911af --- /dev/null +++ b/examples/rust/template/README.md @@ -0,0 +1,14 @@ +--- +title: Template +python: https://github.com/rerun-io/rerun/tree/latest/examples/python/template/main.py +rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/template/src/main.rs +--- + + + +This is an example example. It is not a real example. You can duplicate the directory and use it as a starting point for writing a real example. + +```bash +cargo run --release +``` + diff --git a/examples/rust/template/src/main.rs b/examples/rust/template/src/main.rs new file mode 100644 index 000000000000..ed2956429731 --- /dev/null +++ b/examples/rust/template/src/main.rs @@ -0,0 +1,15 @@ +//! Example template. + +use rerun::RecordingStreamBuilder; + +fn main() -> Result<(), Box> { + let (rec_stream, storage) = RecordingStreamBuilder::new("minimal_rs").memory()?; + + let _ = rec_stream; + + // ... example code + + rerun::native_viewer::show(storage.take())?; + + Ok(()) +} From 5ae543db777a0e56feb1e793c76c3cc1c1af33df Mon Sep 17 00:00:00 2001 From: jprochazk <1665677+jprochazk@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:35:50 +0200 Subject: [PATCH 02/19] update `python/template/main.py` --- examples/python/template/main.py | 45 ++------------------------------ 1 file changed, 2 insertions(+), 43 deletions(-) diff --git a/examples/python/template/main.py b/examples/python/template/main.py index 3346a0713a52..992262fb5693 100755 --- a/examples/python/template/main.py +++ b/examples/python/template/main.py @@ -1,10 +1,10 @@ #!/usr/bin/env python3 """ -How to integrate python's native `logging` with the Rerun SDK. +Example template. Run: ```sh -./examples/python/text_logging/main.py +./examples/python/template/main.py ``` """ from __future__ import annotations @@ -28,45 +28,6 @@ def setup_logging() -> None: logging.getLogger().setLevel(-1) -def log_stuff(frame_offset: int) -> None: - # The usual - logging.critical("catastrophic failure") - logging.error("not going too well") - logging.info("somewhat relevant") - logging.debug("potentially interesting") - - # Custom log levels - logging.addLevelName(42, "IMPORTANT") - logging.log(42, "end-user deemed this important") - - # Log anything - logging.info("here's some data: %s", {"some": 42, "data": True}) - - # Log multi-line text - logging.info("First line\nSecond line\nAnd third!") - # Log multi-line text using the evil \r - logging.info("Line ending with \\r\\n\r\nSecond line ending with \\n\\r\n\rAnd a third line, which just ends") - - # Test that we can log multiple times to the same sequence timeline and still - # have the log messages show up in the correct chronological order in the viewer: - for frame_nr in range(2): - rr.set_time_sequence("frame_nr", 2 * frame_offset + frame_nr) - logging.info(f"Log one thing during frame {frame_nr}") - logging.info(f"Log second thing during the same frame {frame_nr}") - logging.info(f"Log third thing during the same frame {frame_nr}") - - # Use child loggers to map to arbitrary entity paths - inner_logger = logging.getLogger("foo.bar.baz") - inner_logger.info("hey") - - # Use spaces to create distinct logging streams - other_logger = logging.getLogger("totally.unrelated") - other_logger.propagate = False # don't want root logger to catch those - other_logger.addHandler(rr.log.text.LoggingHandler("3rd_party_logs")) - for _ in range(10): - other_logger.debug("look ma, got my very own view!") - - def main() -> None: parser = argparse.ArgumentParser( description="demonstrates how to integrate python's native `logging` with the Rerun SDK" @@ -79,8 +40,6 @@ def main() -> None: rr.script_setup(args, "text_logging") setup_logging() - for frame_offset in range(args.repeat): - log_stuff(frame_offset) rr.script_teardown(args) From dceb7d3d740b85958027d6e56598c29fac3c67ce Mon Sep 17 00:00:00 2001 From: jprochazk <1665677+jprochazk@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:36:39 +0200 Subject: [PATCH 03/19] remove unused arg --- examples/python/template/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/python/template/main.py b/examples/python/template/main.py index 992262fb5693..d45439c35b13 100755 --- a/examples/python/template/main.py +++ b/examples/python/template/main.py @@ -32,7 +32,6 @@ def main() -> None: parser = argparse.ArgumentParser( description="demonstrates how to integrate python's native `logging` with the Rerun SDK" ) - parser.add_argument("--repeat", type=int, default=1, help="How many times do we want to run the log function?") rr.script_add_args(parser) args, unknown = parser.parse_known_args() [__import__("logging").warning(f"unknown arg: {arg}") for arg in unknown] @@ -41,6 +40,8 @@ def main() -> None: setup_logging() + # ... example code + rr.script_teardown(args) From e7b4e828ea407e140e60a34071f9017cdafc92b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <1665677+jprochazk@users.noreply.github.com> Date: Tue, 13 Jun 2023 18:54:40 +0200 Subject: [PATCH 04/19] Update examples/python/template/README.md Co-authored-by: Emil Ernerfeldt --- examples/python/template/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/python/template/README.md b/examples/python/template/README.md index 0fafa00aeff0..727d110c5f82 100644 --- a/examples/python/template/README.md +++ b/examples/python/template/README.md @@ -1,5 +1,6 @@ --- title: Template +tags: kebab-case, comma, separated python: https://github.com/rerun-io/rerun/tree/latest/examples/python/template/main.py rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/template/src/main.rs --- From 3037bb35efb57d3d427a6b91f6b4f90c172b60fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <1665677+jprochazk@users.noreply.github.com> Date: Tue, 13 Jun 2023 18:54:48 +0200 Subject: [PATCH 05/19] Update examples/python/template/main.py Co-authored-by: Emil Ernerfeldt --- examples/python/template/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/python/template/main.py b/examples/python/template/main.py index d45439c35b13..ec3fbf4120af 100755 --- a/examples/python/template/main.py +++ b/examples/python/template/main.py @@ -4,6 +4,7 @@ Run: ```sh +pip install -r examples/python/template/requirements.txt ./examples/python/template/main.py ``` """ From 226125c82ff29dfba0a291f78ce36c3e9fbb7856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <1665677+jprochazk@users.noreply.github.com> Date: Tue, 13 Jun 2023 18:55:13 +0200 Subject: [PATCH 06/19] Update examples/python/template/README.md Co-authored-by: Emil Ernerfeldt --- examples/python/template/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/python/template/README.md b/examples/python/template/README.md index 727d110c5f82..1aa81b75f3ba 100644 --- a/examples/python/template/README.md +++ b/examples/python/template/README.md @@ -10,5 +10,6 @@ rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/template/src/m This is an example example. It is not a real example. You can duplicate the directory and use it as a starting point for writing a real example. ```bash -python examples/python/template/main.py +pip install -r examples/python/template/requirements.txt +examples/python/template/main.py ``` From da293090fbccc814abeaa2b2be101824dc4b4f88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <1665677+jprochazk@users.noreply.github.com> Date: Tue, 13 Jun 2023 18:55:27 +0200 Subject: [PATCH 07/19] Update examples/python/template/main.py Co-authored-by: Emil Ernerfeldt --- examples/python/template/main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/python/template/main.py b/examples/python/template/main.py index ec3fbf4120af..2367d3ed0d1b 100755 --- a/examples/python/template/main.py +++ b/examples/python/template/main.py @@ -34,8 +34,7 @@ def main() -> None: description="demonstrates how to integrate python's native `logging` with 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] + args = parser.parse_args() rr.script_setup(args, "text_logging") From 58a4eeb3b3e0c5f5677130a933e6f53edcaa8fdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <1665677+jprochazk@users.noreply.github.com> Date: Tue, 13 Jun 2023 18:55:53 +0200 Subject: [PATCH 08/19] Update examples/python/template/main.py Co-authored-by: Emil Ernerfeldt --- examples/python/template/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/python/template/main.py b/examples/python/template/main.py index 2367d3ed0d1b..97722af20b23 100755 --- a/examples/python/template/main.py +++ b/examples/python/template/main.py @@ -36,7 +36,7 @@ def main() -> None: rr.script_add_args(parser) args = parser.parse_args() - rr.script_setup(args, "text_logging") + rr.script_setup(args, "my_example_name") setup_logging() From 556f586d63dc1018e63e67122a3c811986458aa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <1665677+jprochazk@users.noreply.github.com> Date: Tue, 13 Jun 2023 18:56:05 +0200 Subject: [PATCH 09/19] Update examples/python/template/main.py Co-authored-by: Emil Ernerfeldt --- examples/python/template/main.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/examples/python/template/main.py b/examples/python/template/main.py index 97722af20b23..fe4bdb5f3eca 100755 --- a/examples/python/template/main.py +++ b/examples/python/template/main.py @@ -17,11 +17,8 @@ def setup_logging() -> None: - # That's really all there is to it: attach a Rerun logging handler to one - # or more loggers of your choosing and your logs will be forwarded. - # - # In this case we attach our handler directly to the root logger, which - # will catch events from all loggers going forward (propagation is on by + # Forward all text logs to Rerun by attaching a handler directly to the root logger, + # which will catch events from all loggers going forward (propagation is on by # default). # # For more info: https://docs.python.org/3/howto/logging.html#handlers From e8edfbe6315cc60c0d1bf52f4bb428ab7632513f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <1665677+jprochazk@users.noreply.github.com> Date: Tue, 13 Jun 2023 18:56:11 +0200 Subject: [PATCH 10/19] Update examples/rust/template/src/main.rs Co-authored-by: Emil Ernerfeldt --- examples/rust/template/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/rust/template/src/main.rs b/examples/rust/template/src/main.rs index ed2956429731..b82da327fb85 100644 --- a/examples/rust/template/src/main.rs +++ b/examples/rust/template/src/main.rs @@ -3,7 +3,7 @@ use rerun::RecordingStreamBuilder; fn main() -> Result<(), Box> { - let (rec_stream, storage) = RecordingStreamBuilder::new("minimal_rs").memory()?; + let (rec_stream, storage) = RecordingStreamBuilder::new("my_example_name").memory()?; let _ = rec_stream; From e2e1bc52a0c92a29feb91c4aacadf5be2f52bc57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <1665677+jprochazk@users.noreply.github.com> Date: Tue, 13 Jun 2023 18:56:15 +0200 Subject: [PATCH 11/19] Update examples/rust/template/README.md Co-authored-by: Emil Ernerfeldt --- examples/rust/template/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/rust/template/README.md b/examples/rust/template/README.md index 071042b911af..ef7aa86db90b 100644 --- a/examples/rust/template/README.md +++ b/examples/rust/template/README.md @@ -9,6 +9,6 @@ rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/template/src/m This is an example example. It is not a real example. You can duplicate the directory and use it as a starting point for writing a real example. ```bash -cargo run --release +cargo run --release -p template ``` From ec9cd7afb8667ee12bed4bb0b974da1ed36b3c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <1665677+jprochazk@users.noreply.github.com> Date: Tue, 13 Jun 2023 18:56:22 +0200 Subject: [PATCH 12/19] Update examples/python/template/main.py Co-authored-by: Emil Ernerfeldt --- examples/python/template/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/python/template/main.py b/examples/python/template/main.py index fe4bdb5f3eca..748ea62e9681 100755 --- a/examples/python/template/main.py +++ b/examples/python/template/main.py @@ -28,7 +28,7 @@ def setup_logging() -> None: def main() -> None: parser = argparse.ArgumentParser( - description="demonstrates how to integrate python's native `logging` with the Rerun SDK" + description="Describe your example here!" ) rr.script_add_args(parser) args = parser.parse_args() From 4081e0402586faf82fc3a8dccda44a0acb4c5e17 Mon Sep 17 00:00:00 2001 From: jprochazk <1665677+jprochazk@users.noreply.github.com> Date: Tue, 13 Jun 2023 18:56:59 +0200 Subject: [PATCH 13/19] add tags to example templates --- examples/python/template/README.md | 2 +- examples/rust/template/README.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/python/template/README.md b/examples/python/template/README.md index 1aa81b75f3ba..23f226a860d2 100644 --- a/examples/python/template/README.md +++ b/examples/python/template/README.md @@ -1,6 +1,6 @@ --- title: Template -tags: kebab-case, comma, separated +tags: [kebab-case, comma, separated] python: https://github.com/rerun-io/rerun/tree/latest/examples/python/template/main.py rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/template/src/main.rs --- diff --git a/examples/rust/template/README.md b/examples/rust/template/README.md index ef7aa86db90b..d48148181c1d 100644 --- a/examples/rust/template/README.md +++ b/examples/rust/template/README.md @@ -1,5 +1,6 @@ --- title: Template +tags: [kebab-case, comma, separated] python: https://github.com/rerun-io/rerun/tree/latest/examples/python/template/main.py rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/template/src/main.rs --- From d4c7c3eaf18333a35f14e4935232c084e948fca5 Mon Sep 17 00:00:00 2001 From: jprochazk <1665677+jprochazk@users.noreply.github.com> Date: Tue, 13 Jun 2023 18:59:56 +0200 Subject: [PATCH 14/19] fix format --- examples/python/template/main.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/python/template/main.py b/examples/python/template/main.py index 748ea62e9681..2883eea099da 100755 --- a/examples/python/template/main.py +++ b/examples/python/template/main.py @@ -27,9 +27,7 @@ def setup_logging() -> None: def main() -> None: - parser = argparse.ArgumentParser( - description="Describe your example here!" - ) + parser = argparse.ArgumentParser(description="Describe your example here!") rr.script_add_args(parser) args = parser.parse_args() From faedbba0dfe3bdbee108fa5254020a3b1420f6bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <1665677+jprochazk@users.noreply.github.com> Date: Tue, 13 Jun 2023 21:42:36 +0200 Subject: [PATCH 15/19] Update examples/python/template/main.py Co-authored-by: Emil Ernerfeldt --- examples/python/template/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/python/template/main.py b/examples/python/template/main.py index 2883eea099da..7ff62563ca93 100755 --- a/examples/python/template/main.py +++ b/examples/python/template/main.py @@ -27,7 +27,7 @@ def setup_logging() -> None: def main() -> None: - parser = argparse.ArgumentParser(description="Describe your example here!") + parser = argparse.ArgumentParser(description="Example of using the Rerun visualizer") rr.script_add_args(parser) args = parser.parse_args() From 327a1e598384e0f6770064ae439baa62062d82f9 Mon Sep 17 00:00:00 2001 From: jprochazk <1665677+jprochazk@users.noreply.github.com> Date: Tue, 13 Jun 2023 22:32:03 +0200 Subject: [PATCH 16/19] remove log forwarding --- examples/python/template/main.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/examples/python/template/main.py b/examples/python/template/main.py index 7ff62563ca93..33d077ef1a2a 100755 --- a/examples/python/template/main.py +++ b/examples/python/template/main.py @@ -11,21 +11,10 @@ from __future__ import annotations import argparse -import logging import rerun as rr # pip install rerun-sdk -def setup_logging() -> None: - # Forward all text logs to Rerun by attaching a handler directly to the root logger, - # which will catch events from all loggers going forward (propagation is on by - # default). - # - # For more info: https://docs.python.org/3/howto/logging.html#handlers - logging.getLogger().addHandler(rr.log.text.LoggingHandler()) - logging.getLogger().setLevel(-1) - - def main() -> None: parser = argparse.ArgumentParser(description="Example of using the Rerun visualizer") rr.script_add_args(parser) @@ -33,8 +22,6 @@ def main() -> None: rr.script_setup(args, "my_example_name") - setup_logging() - # ... example code rr.script_teardown(args) From 58706389ed0a04e8122c3732bb3af3286c5e7c10 Mon Sep 17 00:00:00 2001 From: jprochazk <1665677+jprochazk@users.noreply.github.com> Date: Tue, 13 Jun 2023 22:32:13 +0200 Subject: [PATCH 17/19] explain how to take screenshot --- examples/python/template/README.md | 8 +++++++- examples/rust/template/README.md | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/examples/python/template/README.md b/examples/python/template/README.md index 23f226a860d2..e6312bfe6b3f 100644 --- a/examples/python/template/README.md +++ b/examples/python/template/README.md @@ -5,7 +5,13 @@ python: https://github.com/rerun-io/rerun/tree/latest/examples/python/template/m rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/template/src/main.rs --- - + This is an example example. It is not a real example. You can duplicate the directory and use it as a starting point for writing a real example. diff --git a/examples/rust/template/README.md b/examples/rust/template/README.md index d48148181c1d..d9673c2c07d5 100644 --- a/examples/rust/template/README.md +++ b/examples/rust/template/README.md @@ -5,7 +5,13 @@ python: https://github.com/rerun-io/rerun/tree/latest/examples/python/template/m rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/template/src/main.rs --- - + This is an example example. It is not a real example. You can duplicate the directory and use it as a starting point for writing a real example. From 29ac31df63f86af40c3edeab1aa9a022b4d7f08c Mon Sep 17 00:00:00 2001 From: jprochazk <1665677+jprochazk@users.noreply.github.com> Date: Fri, 16 Jun 2023 10:41:11 +0200 Subject: [PATCH 18/19] update readmes --- examples/python/template/README.md | 9 +++------ examples/rust/template/README.md | 7 ++----- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/examples/python/template/README.md b/examples/python/template/README.md index e6312bfe6b3f..e7f5a34757ec 100644 --- a/examples/python/template/README.md +++ b/examples/python/template/README.md @@ -6,16 +6,13 @@ rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/template/src/m --- This is an example example. It is not a real example. You can duplicate the directory and use it as a starting point for writing a real example. ```bash pip install -r examples/python/template/requirements.txt -examples/python/template/main.py +python examples/python/template/main.py ``` diff --git a/examples/rust/template/README.md b/examples/rust/template/README.md index d9673c2c07d5..689500534e5d 100644 --- a/examples/rust/template/README.md +++ b/examples/rust/template/README.md @@ -6,11 +6,8 @@ rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/template/src/m --- This is an example example. It is not a real example. You can duplicate the directory and use it as a starting point for writing a real example. From 43bebd522149c0585c8e8dca39b7a37fdc582e25 Mon Sep 17 00:00:00 2001 From: jprochazk <1665677+jprochazk@users.noreply.github.com> Date: Fri, 16 Jun 2023 10:41:46 +0200 Subject: [PATCH 19/19] hint to use `python` instead of running as executable --- examples/python/template/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/python/template/main.py b/examples/python/template/main.py index 33d077ef1a2a..5172aa9fb596 100755 --- a/examples/python/template/main.py +++ b/examples/python/template/main.py @@ -5,7 +5,7 @@ Run: ```sh pip install -r examples/python/template/requirements.txt -./examples/python/template/main.py +python examples/python/template/main.py ``` """ from __future__ import annotations