The Rerun Python Log SDK
Rerun is an SDK for logging computer vision and robotics data paired with a visualizer for exploring that data over time. It lets you debug and understand the internal state and data of your systems with minimal code.
Install
pip3 install rerun-sdk
ℹ️ Note:
The Python module is called rerun, while the package published on PyPI is rerun-sdk.
Example
import rerun as rr
import numpy as np
rr.spawn()
positions = np.vstack([xyz.ravel() for xyz in np.mgrid[3 * [slice(-5, 5, 10j)]]]).T
colors = np.vstack([rgb.ravel() for rgb in np.mgrid[3 * [slice(0, 255, 10j)]]]).astype(np.uint8).T
rr.log_points("my_points", positions=positions, colors=colors)
Resources
Logging and viewing in different processes
You can run the viewer and logger in different processes.
In one terminal, start up a viewer with a server that the SDK can connect to:
python3 -m rerun
In a second terminal, run the example with the --connect option:
python3 examples/python/car/main.py --connect
From Source
Setup:
- Install the Rust toolchain: https://rustup.rs/
git clone git@github.com:rerun-io/rerun.git && cd rerun- Run
./scripts/setup_dev.sh. - Make sure
cargo --versionprints1.67.0once you are done
Building
To build from source and install Rerun into your current Python environment run:
python3 -m pip install --upgrade pip
pip3 install -r rerun_py/requirements-build.txt
pip3 install "./rerun_py"
ℹ️ Note:
If you are unable to upgrade pip to version >=21.3, you need to pass --use-feature=in-tree-build to the pip3 install command.
Development
To set up a new virtualenv for development:
just py-dev-env
# For bash/zsh users:
source venv/bin/activate
# Or if you're using fish:
source venv/bin/activate.fish
Build, test, and run
For ease of development you can build and install in "editable" mode. This means you can edit the rerun Python code without having to re-build and install to see changes.
# Build the SDK and install in develop mode into the virtualenv
# Re-run this if the Rust code has changed!
just py-build
Test
# Run the unit tests
just py-test
# Run the linting checks
just py-lint
# Run an example
python examples/python/car/main.py
Building an installable Python Wheel
The Python bindings to the core Rust library are built using https://github.com/PyO3/pyo3.
To build an installable Python wheel run:
pip install -r rerun_py/requirements-build.txt
maturin build -m rerun_py/Cargo.toml --release
By default the wheels will be built to target/wheels (use the -o flag to set a different output directory).
Now you can install rerun in any Python3 environment using:
pip3 install target/wheels/*.whl
Viewing the docs locally
The rerun python docs are generated using mkdocs
Install the doc requirements:
pip install -r rerun_py/requirements-doc.txt
Serve the docs:
mkdocs serve -f rerun_py/mkdocs.yml -w rerun_py
or
just py-docs-serve
For information on how the docs system works, see: docs/docs.md
Troubleshooting
You can run with RUST_LOG=debug to get more output out of the rerun SDK.
If you are using an Apple-silicon Mac, make sure rustc -vV outputs host: aarch64-apple-darwin. If not, this should fix it:
rustup set default-host aarch64-apple-darwin && rustup install 1.67
If you want to switch back, this is how:
rustup set default-host x86_64-apple-darwin && rustup install 1.67
Release files for rerun-sdk 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| rerun_sdk-0.3.0-cp38-abi3-win_amd64.whl | CPython 3.8 | abi3 | Windows x86-64 | Details |
| rerun_sdk-0.3.0-cp38-abi3-manylinux_2_31_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.31+ x86-64 | Details |
| rerun_sdk-0.3.0-cp38-abi3-macosx_11_0_arm64.whl | CPython 3.8 | abi3 | macOS 11.0+ ARM64 | Details |
| rerun_sdk-0.3.0-cp38-abi3-macosx_10_7_x86_64.whl | CPython 3.8 | abi3 | macOS 10.7+ x86-64 | Details |
Total release size: 104.6 MB
Release files / rerun_sdk-0.3.0-cp38-abi3-win_amd64.whl
| Download URL | rerun_sdk-0.3.0-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 22.0 MB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
38d497840b1aa1b3a7d98c33b12dab6d0837c185be1752b09d2a3937ecd2bc82
|
|
BLAKE2b-256 checksum How to use checksums |
96d374698b5cae9bd1b952dd926102e6d74495a6de0438d18e214928380de0b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.15
|
Release files / rerun_sdk-0.3.0-cp38-abi3-manylinux_2_31_x86_64.whl
| Download URL | rerun_sdk-0.3.0-cp38-abi3-manylinux_2_31_x86_64.whl |
|---|---|
| Size | 36.8 MB |
| Tags | CPython 3.8 Linux glibc 2.31+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
9bcbcc1ad06671b5666bc69362d866a5e832e65f9624f87a2bb605e2031b5809
|
|
BLAKE2b-256 checksum How to use checksums |
fef8c499aecf19411bb22fac62351d3926f058a61d69a11cb826aa1da0b7d19c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.15
|
Release files / rerun_sdk-0.3.0-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | rerun_sdk-0.3.0-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 22.4 MB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c6ba8ba3c21d5ae353d8cf11f95ea35b3a3748ddd9d30e20985bea44b524f311
|
|
BLAKE2b-256 checksum How to use checksums |
d43c8db32dbce61e0f16d9e981eb36b8f79e3203631db635e0269903895f7f7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.15
|
Release files / rerun_sdk-0.3.0-cp38-abi3-macosx_10_7_x86_64.whl
| Download URL | rerun_sdk-0.3.0-cp38-abi3-macosx_10_7_x86_64.whl |
|---|---|
| Size | 23.3 MB |
| Tags | CPython 3.8 abi3 macOS 10.7+ x86-64 |
|
SHA-256 checksum How to use checksums |
f5e753d7b8f8ae9dd32c0099e812dd2a0a5e7fd3098a53fb8e703a5987f98981
|
|
BLAKE2b-256 checksum How to use checksums |
4b5476fa598d8cb936bca7897aaabf00a2da329b69a21f789b32f4e99ab9df8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.15
|