Skip to content

Commit

Permalink
Fix links to Python examples
Browse files Browse the repository at this point in the history
broken by #5966
  • Loading branch information
abey79 committed Apr 23, 2024
1 parent 72e80c6 commit bdf386d
Show file tree
Hide file tree
Showing 27 changed files with 26 additions and 103 deletions.
2 changes: 1 addition & 1 deletion BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Additionally, nightly dev wheels from head of `main` are available at <https://g

If you want to build from source, you can do so easily in the pixi environment:
* Run `pixi run py-build --release` to build SDK & viewer for python (or `pixi run py-build` for a debug build)
* Then you can run examples from the repository, either by making the pixi shell active with `pixi shell` and then running python or by using `pixi run`, e.g. `pixi run python examples/python/minimal/main.py`
* Then you can run examples from the repository, either by making the pixi shell active with `pixi shell` and then running python or by using `pixi run`, e.g. `pixi run python examples/python/minimal/minimal.py`


### Tests & Tooling
Expand Down
2 changes: 1 addition & 1 deletion crates/re_space_view_spatial/benches/bench_points.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use self::constants::*;

// ---

/// Mimics `examples/python/open_photogrammetry_format/main.py`
/// Mimics `examples/python/open_photogrammetry_format/open_photogrammetry_format.py`
fn bench_points(c: &mut criterion::Criterion) {
let timeline = Timeline::log_time();
let ent_path = EntityPath::from("points");
Expand Down
2 changes: 1 addition & 1 deletion crates/re_space_view_spatial/src/heuristics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ fn update_pinhole_property_heuristics(
if properties.pinhole_image_plane_distance.is_auto() {
let scene_size = scene_bbox_accum.size().length();
let default_image_plane_distance = if scene_size.is_finite() && scene_size > 0.0 {
scene_size * 0.02 // Works pretty well for `examples/python/open_photogrammetry_format/main.py --no-frames`
scene_size * 0.02 // Works pretty well for `examples/python/open_photogrammetry_format/open_photogrammetry_format.py --no-frames`
} else {
// This value somewhat arbitrary. In almost all cases where the scene has defined bounds
// the heuristic will change it or it will be user edited. In the case of non-defined bounds
Expand Down
2 changes: 1 addition & 1 deletion docs/content/getting-started/data-in/open-any-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ With the exception of `rrd` files that can be streamed from an HTTP URL (e.g. `r

## Logging file contents from the SDK

To log the contents of a file from the SDK you can use the `log_file_from_path` and `log_file_from_contents` methods ([C++](https://ref.rerun.io/docs/cpp/stable/classrerun_1_1RecordingStream.html#a8f253422a7adc2a19b89d1538c05bcac), [Python](https://ref.rerun.io/docs/python/stable/common/other_classes_and_functions/#rerun.log_file_from_path), [Rust](https://docs.rs/rerun/latest/rerun/struct.RecordingStream.html#method.log_file_from_path)) and the associated examples ([C++](https://github.com/rerun-io/rerun/blob/main/examples/cpp/log_file/main.cpp), [Python](https://github.com/rerun-io/rerun/blob/main/examples/python/log_file/main.py), [Rust](https://github.com/rerun-io/rerun/blob/main/examples/rust/log_file/src/main.rs)).
To log the contents of a file from the SDK you can use the `log_file_from_path` and `log_file_from_contents` methods ([C++](https://ref.rerun.io/docs/cpp/stable/classrerun_1_1RecordingStream.html#a8f253422a7adc2a19b89d1538c05bcac), [Python](https://ref.rerun.io/docs/python/stable/common/other_classes_and_functions/#rerun.log_file_from_path), [Rust](https://docs.rs/rerun/latest/rerun/struct.RecordingStream.html#method.log_file_from_path)) and the associated examples ([C++](https://github.com/rerun-io/rerun/blob/main/examples/cpp/log_file/main.cpp), [Python](https://github.com/rerun-io/rerun/blob/main/examples/python/log_file/log_file.py), [Rust](https://github.com/rerun-io/rerun/blob/main/examples/rust/log_file/src/main.rs)).

Note: when calling these APIs from the SDK, the data will be loaded by the process running the SDK, not the Viewer!

Expand Down
2 changes: 1 addition & 1 deletion docs/content/getting-started/data-in/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ In a few lines of code, we'll go from a blank sheet to something you don't see e
This guide aims to go wide instead of deep.
There are links to other doc pages where you can learn more about specific topics.

At any time, you can checkout the complete code listing for this tutorial [here](https://github.com/rerun-io/rerun/tree/latest/examples/python/dna/main.py) to better keep track of the overall picture.
At any time, you can checkout the complete code listing for this tutorial [here](https://github.com/rerun-io/rerun/tree/latest/examples/python/dna/dna.py) to better keep track of the overall picture.

## Prerequisites

Expand Down
2 changes: 1 addition & 1 deletion docs/content/reference/sdk-operating-modes.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Check out our [dedicated example](https://github.com/rerun-io/rerun/tree/latest/

Use [`rr.stdout`](https://ref.rerun.io/docs/python/stable/common/initialization_functions/#rerun.stdout).

Check out our [dedicated example](https://github.com/rerun-io/rerun/tree/latest/examples/python/stdio/main.py).
Check out our [dedicated example](https://github.com/rerun-io/rerun/tree/latest/examples/python/stdio/stdio.py).

#### Rust

Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/external_data_loader/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: External data-loader example
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/external_data_loader/main.py
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/external_data_loader/rerun-loader-python-file.py
rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/external_data_loader/src/main.rs
cpp: https://github.com/rerun-io/rerun/tree/latest/examples/cpp/external_data_loader/main.cpp
thumbnail: https://static.rerun.io/external_data_loader_cpp/83cd3c2a322911cf597cf74aeda01c8fe83e275f/480w.png
Expand Down
6 changes: 3 additions & 3 deletions examples/python/blueprint_stocks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ We show how Rerun blueprints can then be used to present many different views of


```bash
pip install -r examples/python/blueprint_stocks/requirements.txt
python examples/python/blueprint_stocks/blueprint_main.py
pip install -e examples/python/blueprint_stocks
python -m blueprint_stocks
```

The different blueprints can be explored using the `--blueprint` flag. For example:

```
python examples/python/blueprint_stocks/main.py --blueprint=one-stock
python -m blueprint_stocks --blueprint=one-stock
```

Available choices are:
Expand Down
5 changes: 0 additions & 5 deletions examples/python/controlnet/controlnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
Example running ControlNet conditioned on Canny edges.
Based on https://huggingface.co/docs/diffusers/using-diffusers/controlnet.
Run
```sh
examples/python/controlnet/main.py
```
"""

from __future__ import annotations
Expand Down
9 changes: 1 addition & 8 deletions examples/python/dicom_mri/dicom_mri.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
#!/usr/bin/env python3
"""
Example using MRI scan data in the DICOM format.
Run:
``` sh
python3 examples/python/dicom/main.py
```
"""
"""Example using MRI scan data in the DICOM format."""

from __future__ import annotations

Expand Down
6 changes: 1 addition & 5 deletions examples/python/dna/dna.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/usr/bin/env python3
"""
The example from our Getting Started page.
`examples/python/dna/main.py`
"""
"""The example from our Getting Started page."""

from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion examples/python/external_data_loader/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: External data-loader example
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/external_data_loader/main.py
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/external_data_loader/rerun-loader-python-file.py
rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/external_data_loader/src/main.rs
cpp: https://github.com/rerun-io/rerun/tree/latest/examples/cpp/external_data_loader/main.cpp
thumbnail: https://static.rerun.io/external_data_loader_py/6c5609f5dd7d1de373c81babe19221b72d616da3/480w.png
Expand Down
9 changes: 1 addition & 8 deletions examples/python/llm_embedding_ner/llm_embedding_ner.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
#!/usr/bin/env python3
"""
Example running BERT-based named entity recognition (NER).
Run
```sh
examples/python/llm_embedding_ner/main.py
```
"""
"""Example running BERT-based named entity recognition (NER)."""

from __future__ import annotations

Expand Down
5 changes: 0 additions & 5 deletions examples/python/log_file/log_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
Demonstrates how to log any file from the SDK using the `DataLoader` machinery.
See <https://www.rerun.io/docs/reference/data-loaders/overview> for more information.
Usage:
```
python examples/python/log_file/main.py -- examples/assets
```
"""

from __future__ import annotations
Expand Down
10 changes: 1 addition & 9 deletions examples/python/nv12/nv12.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
#!/usr/bin/env python3
"""
Stream NV12 images from a webcam.
Run:
```sh
pip install -r examples/python/nv12/requirements.txt
python examples/python/nv12/main.py
```
"""
"""Stream NV12 images from a webcam."""

from __future__ import annotations

Expand Down
6 changes: 1 addition & 5 deletions examples/python/objectron/objectron/__main__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/usr/bin/env python3
"""
Example of using the Rerun SDK to log the Objectron dataset.
Example: `examples/python/objectron/main.py --recording chair`
"""
"""Example of using the Rerun SDK to log the Objectron dataset."""

from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion examples/python/plots/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Run:
```sh
./examples/python/plot/main.py
./examples/python/plot/plots.py
```
"""

Expand Down
10 changes: 1 addition & 9 deletions examples/python/raw_mesh/raw_mesh/__main__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
#!/usr/bin/env python3
"""
Shows how to use the Rerun SDK to log raw 3D meshes (so-called "triangle soups") and their transform hierarchy.
Run:
```sh
# assuming your virtual env is up
examples/python/raw_mesh/main.py
```
"""
"""Shows how to use the Rerun SDK to log raw 3D meshes (so-called "triangle soups") and their transform hierarchy."""

from __future__ import annotations

Expand Down
6 changes: 0 additions & 6 deletions examples/python/rrt_star/rrt_star.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@
A more detailed explanation can be found in the original paper
Karaman, S. Frazzoli, S. 2011. "Sampling-based algorithms for optimal motion planning".
or in the following medium article: https://theclassytim.medium.com/robotic-path-planning-rrt-and-rrt-212319121378
Run:
```bash
pip install -r examples/python/rrt-star/requirements.txt
python examples/python/rrt-star/main.py
```
"""

from __future__ import annotations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@
Can be used to test mask-generation on one or more images. Images can be local file-paths
or remote urls.
Exa:
```
# Run on a remote image:
python main.py https://raw.githubusercontent.com/facebookresearch/segment-anything/main/notebooks/images/dog.jpg
# Use cuda and a different model on a local image
python main.py --device cuda --model vit_h /path/to/my_image.jpg
```
"""

from __future__ import annotations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@
month = {June},
year = {2019}
}
Run:
```sh
# assuming your virtual env is up
examples/python/signed_distance_fields/main.py
```
"""

from __future__ import annotations
Expand Down
10 changes: 1 addition & 9 deletions examples/python/template/template.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
#!/usr/bin/env python3
"""
Example template.
Run:
```sh
pip install -r examples/python/template/requirements.txt
python examples/python/template/main.py
```
"""
"""Example template."""

from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion examples/rust/external_data_loader/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: External data-loader example
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/external_data_loader/main.py
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/external_data_loader/rerun-loader-python-file.py
rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/external_data_loader/src/main.rs
cpp: https://github.com/rerun-io/rerun/tree/latest/examples/cpp/external_data_loader/main.cpp
thumbnail: https://static.rerun.io/external_data_loader_rs/74eecea3b16fee7fab01045e3bfdd90ba6c59bc9/480w.png
Expand Down
2 changes: 1 addition & 1 deletion examples/rust/objectron/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ fn run(rec: &rerun::RecordingStream, args: &Args) -> anyhow::Result<()> {
format!(
"Could not read the recording, have you downloaded the dataset? \
Try running the python version first to download it automatically \
(`examples/python/objectron/main.py --recording {}`).",
(`python -m objectron --recording {}`).",
args.recording.to_possible_value().unwrap().get_name(),
)
})?;
Expand Down
2 changes: 1 addition & 1 deletion examples/rust/raw_mesh/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl Args {
anyhow::bail!(
"Could not load the scene, have you downloaded the dataset? \
Try running the python version first to download it automatically \
(`examples/python/raw_mesh/main.py --scene {scene_name}`).",
(`python -m raw_mesh --scene {scene_name}`).",
)
}

Expand Down
4 changes: 2 additions & 2 deletions rerun_py/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ python3 -m rerun

In a second terminal, run the example with the `--connect` option:
```sh
python3 examples/python/plots/main.py --connect
python3 examples/python/plots/plots.py --connect
```
Note that SDK and Viewer can run on different machines!

Expand All @@ -63,7 +63,7 @@ pixi run py-build --release
```
To build SDK & viewer for python (or `pixi run py-build` for a debug build) and install it in the pixi environment.

You can then run examples from the repository, either by making the pixi shell active with `pixi shell` and then running python or by using `pixi run`, e.g. `pixi run python examples/python/minimal/main.py`.
You can then run examples from the repository, either by making the pixi shell active with `pixi shell` and then running python or by using `pixi run`, e.g. `pixi run python examples/python/minimal/minimal.py`.

Respectively, to build a wheel instead for manual install use:
```sh
Expand Down
4 changes: 2 additions & 2 deletions tests/python/test_api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
It uses a lot of different aspects of the Rerun API in order to test it.
Example usage:
* Run all tests: `examples/python/test_api/main.py`
* Run specific test: `examples/python/test_api/main.py --test rects`
* Run all tests: `examples/python/test_api/test_api.py`
* Run specific test: `examples/python/test_api/test_api.py --test rects`
"""

from __future__ import annotations
Expand Down

0 comments on commit bdf386d

Please sign in to comment.