From 5a1acdaa930c4516f4edd73c890f3114b776fc2e Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 25 May 2023 18:46:40 +0200 Subject: [PATCH] In all our Python examples, show how to `pip install rerun-sdk` (#2221) ### What Changed all our examples from ```py import rerun as rr ``` to ```py import rerun as rr # pip install rerun-sdk ``` A lot of people only look at examples, and we want to make sure they don't fall into the trap of `pip install rerun` ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) PR Build Summary: https://build.rerun.io/pr/2221 --- examples/python/api_demo/main.py | 2 +- examples/python/arkitscenes/main.py | 2 +- examples/python/blueprint/main.py | 2 +- examples/python/car/main.py | 2 +- examples/python/clock/main.py | 2 +- examples/python/colmap/main.py | 2 +- examples/python/deep_sdf/main.py | 2 +- examples/python/dicom/main.py | 2 +- examples/python/dna/main.py | 2 +- examples/python/minimal/main.py | 2 +- examples/python/minimal_options/main.py | 2 +- examples/python/mp_pose/main.py | 2 +- examples/python/multiprocessing/main.py | 2 +- examples/python/multithreading/main.py | 2 +- examples/python/notebook/blueprint.ipynb | 2 +- examples/python/notebook/cube.ipynb | 3 +-- examples/python/nyud/main.py | 2 +- examples/python/objectron/main.py | 2 +- examples/python/opencv_canny/main.py | 2 +- examples/python/plots/main.py | 2 +- examples/python/raw_mesh/main.py | 2 +- examples/python/ros/main.py | 2 +- examples/python/ros/rerun_urdf.py | 2 +- examples/python/segment_anything/main.py | 2 +- examples/python/stable_diffusion/huggingface_pipeline.py | 2 +- examples/python/stable_diffusion/main.py | 2 +- examples/python/text_logging/main.py | 2 +- examples/python/tracking_hf_opencv/main.py | 2 +- 28 files changed, 28 insertions(+), 29 deletions(-) diff --git a/examples/python/api_demo/main.py b/examples/python/api_demo/main.py index eea90005e9e3..5d56efb63879 100755 --- a/examples/python/api_demo/main.py +++ b/examples/python/api_demo/main.py @@ -18,7 +18,7 @@ import cv2 import numpy as np -import rerun as rr +import rerun as rr # pip install rerun-sdk def run_segmentation() -> None: diff --git a/examples/python/arkitscenes/main.py b/examples/python/arkitscenes/main.py index 34254194e227..96537f0b5952 100755 --- a/examples/python/arkitscenes/main.py +++ b/examples/python/arkitscenes/main.py @@ -9,7 +9,7 @@ import matplotlib.pyplot as plt import numpy as np import numpy.typing as npt -import rerun as rr +import rerun as rr # pip install rerun-sdk import trimesh from download_dataset import AVAILABLE_RECORDINGS, ensure_recording_available from scipy.spatial.transform import Rotation as R diff --git a/examples/python/blueprint/main.py b/examples/python/blueprint/main.py index a98dc40e87e3..d5d9c0ca5120 100644 --- a/examples/python/blueprint/main.py +++ b/examples/python/blueprint/main.py @@ -3,7 +3,7 @@ import argparse import numpy as np -import rerun as rr +import rerun as rr # pip install rerun-sdk import rerun.experimental as rr_exp diff --git a/examples/python/car/main.py b/examples/python/car/main.py index eb3cc6c47a00..0059790f3a4a 100755 --- a/examples/python/car/main.py +++ b/examples/python/car/main.py @@ -8,7 +8,7 @@ import cv2 import numpy as np import numpy.typing as npt -import rerun as rr +import rerun as rr # pip install rerun-sdk def log_car_data() -> None: diff --git a/examples/python/clock/main.py b/examples/python/clock/main.py index 2b5fb96e4c93..4466bf9daca1 100755 --- a/examples/python/clock/main.py +++ b/examples/python/clock/main.py @@ -11,7 +11,7 @@ from typing import Final, Tuple import numpy as np -import rerun as rr +import rerun as rr # pip install rerun-sdk LENGTH_S: Final = 20.0 LENGTH_M: Final = 10.0 diff --git a/examples/python/colmap/main.py b/examples/python/colmap/main.py index 1d91b5dbf345..13b9490cdd84 100755 --- a/examples/python/colmap/main.py +++ b/examples/python/colmap/main.py @@ -12,7 +12,7 @@ import numpy as np import numpy.typing as npt import requests -import rerun as rr +import rerun as rr # pip install rerun-sdk from read_write_model import Camera, read_model from tqdm import tqdm diff --git a/examples/python/deep_sdf/main.py b/examples/python/deep_sdf/main.py index ad3d11de2d4a..12dd7d90978e 100755 --- a/examples/python/deep_sdf/main.py +++ b/examples/python/deep_sdf/main.py @@ -37,7 +37,7 @@ import mesh_to_sdf import numpy as np import numpy.typing as npt -import rerun as rr +import rerun as rr # pip install rerun-sdk import trimesh from download_dataset import AVAILABLE_MESHES, ensure_mesh_downloaded from trimesh import Trimesh diff --git a/examples/python/dicom/main.py b/examples/python/dicom/main.py index 892b43b39434..f1693008820f 100755 --- a/examples/python/dicom/main.py +++ b/examples/python/dicom/main.py @@ -20,7 +20,7 @@ import numpy.typing as npt import pydicom as dicom import requests -import rerun as rr +import rerun as rr # pip install rerun-sdk DATASET_DIR: Final = Path(os.path.dirname(__file__)) / "dataset" DATASET_URL: Final = "https://storage.googleapis.com/rerun-example-datasets/dicom.zip" diff --git a/examples/python/dna/main.py b/examples/python/dna/main.py index 13148637b55f..63a295e7bfba 100755 --- a/examples/python/dna/main.py +++ b/examples/python/dna/main.py @@ -9,7 +9,7 @@ from math import tau import numpy as np -import rerun as rr +import rerun as rr # pip install rerun-sdk from rerun_demo.data import build_color_spiral from rerun_demo.util import bounce_lerp, interleave diff --git a/examples/python/minimal/main.py b/examples/python/minimal/main.py index 62be7c58debf..44bcf6e465c5 100755 --- a/examples/python/minimal/main.py +++ b/examples/python/minimal/main.py @@ -4,7 +4,7 @@ import numpy as np -import rerun as rr +import rerun as rr # pip install rerun-sdk _, unknown = __import__("argparse").ArgumentParser().parse_known_args() [__import__("logging").warning(f"unknown arg: {arg}") for arg in unknown] diff --git a/examples/python/minimal_options/main.py b/examples/python/minimal_options/main.py index 6800b8fe1363..ad93c0c4b4c1 100755 --- a/examples/python/minimal_options/main.py +++ b/examples/python/minimal_options/main.py @@ -6,7 +6,7 @@ import argparse import numpy as np -import rerun as rr +import rerun as rr # pip install rerun-sdk parser = argparse.ArgumentParser(description="Logs rich data using the Rerun SDK.") rr.script_add_args(parser) diff --git a/examples/python/mp_pose/main.py b/examples/python/mp_pose/main.py index d254365db2a4..d91ecdba0420 100755 --- a/examples/python/mp_pose/main.py +++ b/examples/python/mp_pose/main.py @@ -13,7 +13,7 @@ import numpy as np import numpy.typing as npt import requests -import rerun as rr +import rerun as rr # pip install rerun-sdk EXAMPLE_DIR: Final = Path(os.path.dirname(__file__)) DATASET_DIR: Final = EXAMPLE_DIR / "dataset" / "pose_movement" diff --git a/examples/python/multiprocessing/main.py b/examples/python/multiprocessing/main.py index 4cc319b39405..c7ed437a1a0d 100755 --- a/examples/python/multiprocessing/main.py +++ b/examples/python/multiprocessing/main.py @@ -7,7 +7,7 @@ import os import threading -import rerun as rr +import rerun as rr # pip install rerun-sdk def task(title: str) -> None: diff --git a/examples/python/multithreading/main.py b/examples/python/multithreading/main.py index 61244e1722b3..d0c8973876fb 100755 --- a/examples/python/multithreading/main.py +++ b/examples/python/multithreading/main.py @@ -8,7 +8,7 @@ import numpy as np import numpy.typing as npt -import rerun as rr +import rerun as rr # pip install rerun-sdk def rect_logger(path: str, color: npt.NDArray[np.float32]) -> None: diff --git a/examples/python/notebook/blueprint.ipynb b/examples/python/notebook/blueprint.ipynb index b3ae3bef1b44..e58cba0a4ed5 100644 --- a/examples/python/notebook/blueprint.ipynb +++ b/examples/python/notebook/blueprint.ipynb @@ -15,7 +15,7 @@ "outputs": [], "source": [ "import numpy as np\n", - "import rerun as rr\n", + "import rerun as rr # pip install rerun-sdk\n", "import rerun.experimental as rr_exp # Note: blueprint support is still experimental" ] }, diff --git a/examples/python/notebook/cube.ipynb b/examples/python/notebook/cube.ipynb index ba5f4d9585b7..413210a46420 100644 --- a/examples/python/notebook/cube.ipynb +++ b/examples/python/notebook/cube.ipynb @@ -20,8 +20,7 @@ "import math\n", "\n", "import numpy as np\n", - "\n", - "import rerun as rr\n", + "import rerun as rr # pip install rerun-sdk\n", "\n", "rr.init(\"cube\")" ] diff --git a/examples/python/nyud/main.py b/examples/python/nyud/main.py index 37dcb2a668ad..cb5bbe9b7a1c 100755 --- a/examples/python/nyud/main.py +++ b/examples/python/nyud/main.py @@ -16,7 +16,7 @@ import numpy as np import numpy.typing as npt import requests -import rerun as rr +import rerun as rr # pip install rerun-sdk from tqdm import tqdm DEPTH_IMAGE_SCALING: Final = 1e4 diff --git a/examples/python/objectron/main.py b/examples/python/objectron/main.py index 5ccac9d91abf..cca79c67da92 100755 --- a/examples/python/objectron/main.py +++ b/examples/python/objectron/main.py @@ -18,7 +18,7 @@ import numpy as np import numpy.typing as npt -import rerun as rr +import rerun as rr # pip install rerun-sdk from download_dataset import ( ANNOTATIONS_FILENAME, AVAILABLE_RECORDINGS, diff --git a/examples/python/opencv_canny/main.py b/examples/python/opencv_canny/main.py index 0a6acc59851c..5067db962a7e 100755 --- a/examples/python/opencv_canny/main.py +++ b/examples/python/opencv_canny/main.py @@ -25,7 +25,7 @@ from typing import Optional import cv2 -import rerun as rr +import rerun as rr # pip install rerun-sdk def run_canny(num_frames: Optional[int]) -> None: diff --git a/examples/python/plots/main.py b/examples/python/plots/main.py index 065603126952..c296fae0a11b 100755 --- a/examples/python/plots/main.py +++ b/examples/python/plots/main.py @@ -15,7 +15,7 @@ from math import cos, sin, tau import numpy as np -import rerun as rr +import rerun as rr # pip install rerun-sdk def clamp(n, smallest, largest): # type: ignore[no-untyped-def] diff --git a/examples/python/raw_mesh/main.py b/examples/python/raw_mesh/main.py index 740ad98e291c..9639601eb405 100755 --- a/examples/python/raw_mesh/main.py +++ b/examples/python/raw_mesh/main.py @@ -15,7 +15,7 @@ from typing import Optional, cast import numpy as np -import rerun as rr +import rerun as rr # pip install rerun-sdk import trimesh from download_dataset import AVAILABLE_MESHES, ensure_mesh_downloaded diff --git a/examples/python/ros/main.py b/examples/python/ros/main.py index cda85aaecc40..cf09f4a448b9 100644 --- a/examples/python/ros/main.py +++ b/examples/python/ros/main.py @@ -14,7 +14,7 @@ import sys import numpy as np -import rerun as rr +import rerun as rr # pip install rerun-sdk try: import cv_bridge diff --git a/examples/python/ros/rerun_urdf.py b/examples/python/ros/rerun_urdf.py index 62cb11d2d98a..85b1642efbe2 100644 --- a/examples/python/ros/rerun_urdf.py +++ b/examples/python/ros/rerun_urdf.py @@ -4,7 +4,7 @@ from urllib.parse import urlparse import numpy as np -import rerun as rr +import rerun as rr # pip install rerun-sdk import trimesh from ament_index_python.packages import get_package_share_directory from std_msgs.msg import String diff --git a/examples/python/segment_anything/main.py b/examples/python/segment_anything/main.py index e55b6611855c..f8615875f5ef 100755 --- a/examples/python/segment_anything/main.py +++ b/examples/python/segment_anything/main.py @@ -28,7 +28,7 @@ import cv2 import numpy as np import requests -import rerun as rr +import rerun as rr # pip install rerun-sdk import torch import torchvision from cv2 import Mat diff --git a/examples/python/stable_diffusion/huggingface_pipeline.py b/examples/python/stable_diffusion/huggingface_pipeline.py index 3306c4c77757..cfc3c8fa4a4d 100644 --- a/examples/python/stable_diffusion/huggingface_pipeline.py +++ b/examples/python/stable_diffusion/huggingface_pipeline.py @@ -56,7 +56,7 @@ DPTForDepthEstimation, ) -import rerun as rr +import rerun as rr # pip install rerun-sdk logger = logging.get_logger(__name__) # pylint: disable=invalid-name logger.addHandler(rr.log.text.LoggingHandler("logs")) diff --git a/examples/python/stable_diffusion/main.py b/examples/python/stable_diffusion/main.py index 7e7e1d50c2cd..ff7d94e370d6 100755 --- a/examples/python/stable_diffusion/main.py +++ b/examples/python/stable_diffusion/main.py @@ -14,7 +14,7 @@ os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1" import requests -import rerun as rr +import rerun as rr # pip install rerun-sdk import torch from huggingface_pipeline import StableDiffusionDepth2ImgPipeline from PIL import Image diff --git a/examples/python/text_logging/main.py b/examples/python/text_logging/main.py index 7e30ea3e5266..20f2336c9082 100755 --- a/examples/python/text_logging/main.py +++ b/examples/python/text_logging/main.py @@ -13,7 +13,7 @@ import argparse import logging -import rerun as rr +import rerun as rr # pip install rerun-sdk def setup_logging() -> None: diff --git a/examples/python/tracking_hf_opencv/main.py b/examples/python/tracking_hf_opencv/main.py index d58f8d4fc334..2ba17bd2fea2 100755 --- a/examples/python/tracking_hf_opencv/main.py +++ b/examples/python/tracking_hf_opencv/main.py @@ -12,7 +12,7 @@ import numpy as np import numpy.typing as npt import requests -import rerun as rr +import rerun as rr # pip install rerun-sdk from PIL import Image EXAMPLE_DIR: Final = Path(os.path.dirname(__file__))