Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated rerun_demo package #4293

Merged
merged 10 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,3 @@ plugins = numpy.typing.mypy_plugin
ignore_missing_imports = True
no_implicit_reexport = False
disallow_untyped_calls = False

# Don't lint demo helpers.
[mypy-rerun_demo.*]
ignore_errors = True
14 changes: 7 additions & 7 deletions docs/content/getting-started/logging-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ We will do so incrementally, but if you just want to update your imports once an
```python
from math import tau
import numpy as np
from rerun_demo.data import build_color_spiral
from rerun_demo.util import bounce_lerp
from rerun.utilities import build_color_spiral
from rerun.utilities import bounce_lerp
```
---

Expand All @@ -81,7 +81,7 @@ Add the following to your file:

```python
# new imports
from rerun_demo.data import build_color_spiral
from rerun.utilities import build_color_spiral
from math import tau

NUM_POINTS = 100
Expand Down Expand Up @@ -128,7 +128,7 @@ archetypes altogether.

For more information on how the rerun data model works, refer to our section on [Entities and Components](../concepts/entity-component.md).

Our [Python SDK](https://ref.rerun.io/docs/python) integrates with the rest of the Python ecosystem: the points and colors returned by [`build_color_spiral`](https://ref.rerun.io/docs/python/stable/common/demo_utilities/#rerun_demo.data.build_color_spiral) in this example are vanilla `numpy` arrays.
Our [Python SDK](https://ref.rerun.io/docs/python) integrates with the rest of the Python ecosystem: the points and colors returned by [`build_color_spiral`](https://ref.rerun.io/docs/python/stable/common/utilities/?speculative-link#rerun.utilities.data.build_color_spiral) in this example are vanilla `numpy` arrays.
Rerun takes care of mapping those arrays to actual Rerun components depending on the context (e.g. we're calling [`rr.Points3D`](https://ref.rerun.io/docs/python/stable/common/archetypes/#rerun.archetypes.Points3D) in this case).

### Entities & hierarchies
Expand Down Expand Up @@ -163,7 +163,7 @@ Which only leaves the beads:
```python
# new imports
import numpy as np
from rerun_demo.util import bounce_lerp
from rerun.utilities import bounce_lerp

offsets = np.random.rand(NUM_POINTS)
beads = [bounce_lerp(points1[n], points2[n], offsets[n]) for n in range(NUM_POINTS)]
Expand All @@ -174,7 +174,7 @@ rr.log(
)
```

Once again, although we are getting fancier and fancier with our [`numpy` incantations](https://ref.rerun.io/docs/python/stable/common/demo_utilities/#rerun_demo.util.bounce_lerp),
Once again, although we are getting fancier and fancier with our [`numpy` incantations](https://ref.rerun.io/docs/python/stable/common/utilities/?speculative-link#rerun.utilities.util.bounce_lerp),
there is nothing new here: it's all about building out `numpy` arrays and feeding them to the Rerun API.

<picture>
Expand Down Expand Up @@ -211,7 +211,7 @@ Rerun has rich support for time: whether you want concurrent or disjoint timelin
Let's add our custom timeline:
```python
# new imports
from rerun_demo.util import bounce_lerp
from rerun.utilities import bounce_lerp

time_offsets = np.random.rand(NUM_POINTS)
for i in range(400):
Expand Down
34 changes: 22 additions & 12 deletions docs/content/getting-started/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,33 @@ You are now ready to start logging and visualizing data.

## Trying out the viewer

The Rerun SDK comes packaged with a simple demo to quickly get a feel for the viewer. You can launch it with:
Rerun comes packaged with integrated examples to make it easy to explore the viewer. Launch it with:
```bash
$ python3 -m rerun_demo
$ rerun
```

If everything is installed and working correctly, you should end up with a window like below.
Try looping the recording to see the fun animation.
This command is automatically installed by the `rerun-sdk` Python package. When running it, you should end up with a window like below:

<picture>
<source media="(max-width: 480px)" srcset="https://static.rerun.io/quickstart0_cube/770ffcd66ebc020bb0ff00ec123e19f1fcb0a3a4/480w.png">
<source media="(max-width: 768px)" srcset="https://static.rerun.io/quickstart0_cube/770ffcd66ebc020bb0ff00ec123e19f1fcb0a3a4/768w.png">
<source media="(max-width: 1024px)" srcset="https://static.rerun.io/quickstart0_cube/770ffcd66ebc020bb0ff00ec123e19f1fcb0a3a4/1024w.png">
<source media="(max-width: 1200px)" srcset="https://static.rerun.io/quickstart0_cube/770ffcd66ebc020bb0ff00ec123e19f1fcb0a3a4/1200w.png">
<img src="https://static.rerun.io/quickstart0_cube/770ffcd66ebc020bb0ff00ec123e19f1fcb0a3a4/full.png" alt="colored cube">
<img src="https://static.rerun.io/welcome_screen/f3119e719c64d7c18e56ccd34e3ec0eff7039ef6/full.png" alt="">
<source media="(max-width: 480px)" srcset="https://static.rerun.io/welcome_screen/f3119e719c64d7c18e56ccd34e3ec0eff7039ef6/480w.png">
<source media="(max-width: 768px)" srcset="https://static.rerun.io/welcome_screen/f3119e719c64d7c18e56ccd34e3ec0eff7039ef6/768w.png">
<source media="(max-width: 1024px)" srcset="https://static.rerun.io/welcome_screen/f3119e719c64d7c18e56ccd34e3ec0eff7039ef6/1024w.png">
<source media="(max-width: 1200px)" srcset="https://static.rerun.io/welcome_screen/f3119e719c64d7c18e56ccd34e3ec0eff7039ef6/1200w.png">
</picture>

Click on the "View Examples" button, and then on the "Helix" example. This should bring you to this screen:

<picture>
<img src="https://static.rerun.io/helix/7afe34b3150dd09b017724331459bd694e7069ac/full.png" alt="">
<source media="(max-width: 480px)" srcset="https://static.rerun.io/helix/7afe34b3150dd09b017724331459bd694e7069ac/480w.png">
<source media="(max-width: 768px)" srcset="https://static.rerun.io/helix/7afe34b3150dd09b017724331459bd694e7069ac/768w.png">
<source media="(max-width: 1024px)" srcset="https://static.rerun.io/helix/7afe34b3150dd09b017724331459bd694e7069ac/1024w.png">
<source media="(max-width: 1200px)" srcset="https://static.rerun.io/helix/7afe34b3150dd09b017724331459bd694e7069ac/1200w.png">
</picture>


Try looping the recording to see the fun animation.

*Note: If this is your first time launching Rerun you will see a notification in the terminal about the Rerun anonymous
data usage policy. Rerun collects anonymous usage data to help improve the project, though you may choose to opt out if you
Expand All @@ -56,7 +67,7 @@ This is just a taste of some of what you can do with the viewer. We will cover o
more detail later in the [Viewer Walkthrough](viewer-walkthrough.md)

## Logging your own data
Now instead of using a prepackaged demo, let's create some data ourselves. We will start with an
After exploring a built-in example, let's create some data ourselves. We will start with an
extremely simplified version of this dataset that just logs 1 dimension of points instead of 3.

Create a new python script with the following code:
Expand Down Expand Up @@ -97,8 +108,7 @@ call that can accept a variety of correctly-formatted data—including your own.
one of the built-in *archetype* class, such as [`rr.Points3D`](https://ref.rerun.io/docs/python/stable/common/archetypes/#rerun.archetypes.Points3D). Archetypes take care of gathering the various
components representing, in this case, a batch of 3D points such that it is recognized and correctly displayed by the Rerun viewer. The `rr.Points3D` archetype accepts any collection of positions that can be converted to a Nx3 Numpy array, along with other components such as colors, radii, etc.

Feel free to modify the code to log a different set of points. If you want to generate the colored cube from the
built-in demo, you can use the following numpy incantation.
Feel free to modify the code to log a different set of points. For example, this code generates a more elaborate 3D colored cube:
```python
import rerun as rr
import numpy as np
Expand Down
27 changes: 17 additions & 10 deletions docs/content/getting-started/viewer-walkthrough.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,31 @@ pip install rerun-sdk

You can also find `rerun-sdk` on [`conda`](https://github.com/conda-forge/rerun-sdk-feedstock).

## Launching the demo
## Launching an example

If you have already followed the Python Quickstart you may have used `rerun_demo` already to run the cube demo.
If you have already followed the Python Quickstart you may have already check the "Helix" integrated example. This time, we will use the "Structure from Motion" example.

Start by running the viewer:

This time, we will pass an additional flag:
```bash
$ python -m rerun_demo --structure-from-motion
$ rerun
```

*Note: If this is your first time launching Rerun you will see a notification about the Rerun anonymous data usage
policy. Rerun collects anonymous usage data to help improve the SDK, though you may choose to opt out if you would
like.*

In your terminal you should see an output along the lines of:
```
2023-02-13T05:16:06.835424Z INFO rerun::run: Loading "/home/rerun/venv/lib/python3.10/site-packages/rerun_sdk/rerun_demo/colmap_fiat.rrd"…
```
This will bring you the Rerun viewer's Welcome screen:

<picture>
<img src="https://static.rerun.io/welcome_screen/f3119e719c64d7c18e56ccd34e3ec0eff7039ef6/full.png" alt="">
<source media="(max-width: 480px)" srcset="https://static.rerun.io/welcome_screen/f3119e719c64d7c18e56ccd34e3ec0eff7039ef6/480w.png">
<source media="(max-width: 768px)" srcset="https://static.rerun.io/welcome_screen/f3119e719c64d7c18e56ccd34e3ec0eff7039ef6/768w.png">
<source media="(max-width: 1024px)" srcset="https://static.rerun.io/welcome_screen/f3119e719c64d7c18e56ccd34e3ec0eff7039ef6/1024w.png">
<source media="(max-width: 1200px)" srcset="https://static.rerun.io/welcome_screen/f3119e719c64d7c18e56ccd34e3ec0eff7039ef6/1200w.png">
</picture>

And a window that looks like this will appear:
Click on the "View Examples" button, and then chose the "Structure from Motion" example. A window that looks like this will appear:

<picture>
<source media="(max-width: 480px)" srcset="https://static.rerun.io/viewer_walkthrough1_first_launch/793d828d867a8d341cd3ec35bc553f2d65fba549/480w.png">
Expand Down Expand Up @@ -314,7 +320,8 @@ system to transform or project all data into the space root for the given view.

That brings us to the end of this walkthrough. To recap, you have learned how to:
- Install the `rerun-sdk` pypi package.
- Run the Rerun Viewer using the `rerun_demo` helper.
- Run the Rerun Viewer using the `rerun` command.
- Open the examples integrated in the viewer.
- Work with the [Blueprint](../reference/viewer/blueprint.md), [Selection](../reference/viewer/selection.md) and [Timeline](../reference/viewer/timeline.md) panels.
- Rearrange space view layouts.
- Explore data through hover and selection.
Expand Down
3 changes: 1 addition & 2 deletions examples/python/dna/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

import numpy as np
import rerun as rr # pip install rerun-sdk
from rerun_demo.data import build_color_spiral
from rerun_demo.util import bounce_lerp
from rerun.utilities import bounce_lerp, build_color_spiral

DESCRIPTION = """
# DNA
Expand Down
5 changes: 2 additions & 3 deletions examples/python/notebook/cube.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@
"source": [
"## Helper to create the colored cube\n",
"\n",
"This is the same as the color cube demo from `rerun -m rerun_demo`, but the code\n",
"is repeated here for context."
"This code exists in the `rerun.utilities` package, but is repeated here for context."
]
},
{
Expand Down Expand Up @@ -263,7 +262,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.7"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
3 changes: 1 addition & 2 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
],

"ignore": [
"rerun_py/rerun",
"rerun_py/rerun_demo"
"rerun_py/rerun"
],

"defineConstant": {
Expand Down
4 changes: 2 additions & 2 deletions rerun_py/docs/gen_common_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ class Section:
class_list=["RecordingStream", "LoggingHandler", "MemoryRecording"],
),
Section(
title="Demo utilities",
title="Utilities",
show_tables=False,
mod_path="rerun_demo",
mod_path="rerun.utilities",
show_submodules=True,
),
Section(
Expand Down
6 changes: 3 additions & 3 deletions rerun_py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ required-imports = ["from __future__ import annotations"]
# with the other `rerun` pypi package. The rerun_sdk.pth adds this to the pythonpath
# which then allows `import rerun` to work as expected.
# See https://github.com/rerun-io/rerun/pull/1085 for more details
include = ["rerun_sdk.pth", "rerun_sdk/rerun_demo/colmap_fiat.rrd"]
include = ["rerun_sdk.pth"]
locked = true
name = "rerun_bindings" # name of the .so library that the Python module will import
python-packages = ["rerun_sdk/rerun", "rerun_sdk/rerun_demo"]
name = "rerun_bindings"
python-packages = ["rerun_sdk/rerun"]

[tool.pytest.ini_options]
# These conform to Python's Warning Filter syntax:
Expand Down
26 changes: 0 additions & 26 deletions rerun_py/rerun_demo/__init__.py

This file was deleted.

33 changes: 33 additions & 0 deletions rerun_py/rerun_sdk/rerun/utilities/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from __future__ import annotations

from .data import (
ColorGrid,
ColorSpiral,
RectPyramid,
build_color_grid,
build_color_spiral,
build_rect_pyramid,
color_grid,
color_spiral,
rect_pyramid,
)
from .turbo import turbo_colormap_data
from .util import bounce_lerp, interleave

__all__ = [
# data
"ColorGrid",
"build_color_grid",
"color_grid",
"RectPyramid",
"build_rect_pyramid",
"rect_pyramid",
"ColorSpiral",
"build_color_spiral",
"color_spiral",
# turbo
"turbo_colormap_data",
# util
"bounce_lerp",
"interleave",
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,27 @@
from math import cos, sin, tau

import numpy as np

from rerun import Box2DFormat

from rerun_demo.turbo import turbo_colormap_data
from .turbo import turbo_colormap_data

__all__ = [
"ColorGrid",
"build_color_grid",
"color_grid",
"RectPyramid",
"build_rect_pyramid",
"rect_pyramid",
"ColorSpiral",
"build_color_spiral",
"color_spiral",
]

ColorGrid = namedtuple("ColorGrid", ["positions", "colors"])


def build_color_grid(x_count=10, y_count=10, z_count=10, twist=0):
def build_color_grid(x_count: int = 10, y_count: int = 10, z_count: int = 10, twist: float = 0) -> ColorGrid:
"""
Create a cube of points with colors.

Expand Down Expand Up @@ -63,7 +76,7 @@ def build_color_grid(x_count=10, y_count=10, z_count=10, twist=0):
RectPyramid = namedtuple("RectPyramid", ["rects", "format", "colors"])


def build_rect_pyramid(count=20, width=100, height=100):
def build_rect_pyramid(count: int = 20, width: int = 100, height: int = 100) -> RectPyramid:
"""
Create a stack of N colored rectangles.

Expand Down Expand Up @@ -94,7 +107,13 @@ def build_rect_pyramid(count=20, width=100, height=100):
ColorSpiral = namedtuple("ColorSpiral", ["positions", "colors"])


def build_color_spiral(num_points=100, radius=2, angular_step=0.02, angular_offset=0, z_step=0.1):
def build_color_spiral(
num_points: int = 100,
radius: float = 2,
angular_step: float = 0.02,
angular_offset: float = 0,
z_step: float = 0.1,
) -> ColorSpiral:
"""
Create a spiral of points with colors along the Z axis.

Expand All @@ -105,9 +124,9 @@ def build_color_spiral(num_points=100, radius=2, angular_step=0.02, angular_offs
radius:
The radius of the spiral.
angular_step:
The factor applied between each step along the trigonemetric circle.
The factor applied between each step along the trigonometric circle.
angular_offset:
Offsets the starting position on the trigonemetric circle.
Offsets the starting position on the trigonometric circle.
z_step:
The factor applied between each step along the Z axis.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import numpy as np

__all__ = ["turbo_colormap_data"]

turbo_colormap_data = np.array(
[
[0.18995, 0.07176, 0.23217],
Expand Down
Loading
Loading