Skip to content

Commit

Permalink
In all our Python examples, show how to pip install rerun-sdk (#2221)
Browse files Browse the repository at this point in the history
### 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)

<!-- This line will get updated when the PR build summary job finishes.
-->
PR Build Summary: https://build.rerun.io/pr/2221
  • Loading branch information
emilk authored May 25, 2023
1 parent a18c71b commit 5a1acda
Show file tree
Hide file tree
Showing 28 changed files with 28 additions and 29 deletions.
2 changes: 1 addition & 1 deletion examples/python/api_demo/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion examples/python/arkitscenes/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/python/blueprint/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion examples/python/car/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion examples/python/clock/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/python/colmap/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion examples/python/deep_sdf/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/python/dicom/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion examples/python/dna/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion examples/python/minimal/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion examples/python/minimal_options/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/python/mp_pose/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion examples/python/multiprocessing/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion examples/python/multithreading/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion examples/python/notebook/blueprint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
Expand Down
3 changes: 1 addition & 2 deletions examples/python/notebook/cube.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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\")"
]
Expand Down
2 changes: 1 addition & 1 deletion examples/python/nyud/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/python/objectron/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion examples/python/opencv_canny/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion examples/python/plots/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion examples/python/raw_mesh/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion examples/python/ros/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/python/ros/rerun_urdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/python/segment_anything/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/python/stable_diffusion/huggingface_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
2 changes: 1 addition & 1 deletion examples/python/stable_diffusion/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/python/text_logging/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import argparse
import logging

import rerun as rr
import rerun as rr # pip install rerun-sdk


def setup_logging() -> None:
Expand Down
2 changes: 1 addition & 1 deletion examples/python/tracking_hf_opencv/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__))
Expand Down

0 comments on commit 5a1acda

Please sign in to comment.