The Rerun Logging SDK
Project description
The Rerun Python Log SDK
Use the Rerun SDK to log data like images, tensors, point clouds, and text. Logs are streamed to the Rerun Viewer for live visualization or to file for later use.
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.init("rerun_example_app", spawn=True)
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("points3d", rr.Points3D(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 python examples/python/plots/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 --version
prints1.74.0
once 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!
source venv/bin/activate
just py-build
Test
# Run the unit tests
just py-test
# Run the linting checks
just py-lint
# Run an example
python examples/python/minimal/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/writing_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.74
If you want to switch back, this is how:
rustup set default-host x86_64-apple-darwin && rustup install 1.74
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for rerun_sdk-0.15.0rc3-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78516cb649543c4a7d7d0e70f9685fb83cc8a9a0d010cc85a2bbebc90598f563 |
|
MD5 | 1513b1b96b762371e3bf75516ce3196a |
|
BLAKE2b-256 | fe845f2ecc1dda9214cd391dfaaef8e0cdbb89e16497f88d95112e3855e2d74d |
Hashes for rerun_sdk-0.15.0rc3-cp38-abi3-manylinux_2_31_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 611069926a0c491b458911f942d6ab5fc43706df4bcc764d138d942698d837c4 |
|
MD5 | b8cd53c80a79b3c54fc4d0e547ffc880 |
|
BLAKE2b-256 | 26609d4c5b90d225f688fe98cc5358a5d2a2dbf09e8b9a4600c350e12a041e12 |
Hashes for rerun_sdk-0.15.0rc3-cp38-abi3-manylinux_2_31_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e39d33b48455eb9e6f1497e0a6f3f23f48874f37df74645e3ec904aa3de4a9c4 |
|
MD5 | 3ad0dafd55f94d9269abdb33487749d2 |
|
BLAKE2b-256 | a621b5ec8667a96147f5f72a8d7e5bc825ecf125d0f68918353dd5938f6f80fb |
Hashes for rerun_sdk-0.15.0rc3-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7becfcc854cc57d6ad9a1f8c5c068e0683e605109e12f5379f02a900f3281011 |
|
MD5 | ecd60eab10288926e4015b2ec55a4a85 |
|
BLAKE2b-256 | 31dae6cd25e7496233d144882de8801ea7c5fef98289a34a0eaceb8514e44a62 |
Hashes for rerun_sdk-0.15.0rc3-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbe982bd4347eb8efa17c143e11c344b0613c798a43664e13f0e01ae9f8dd0d4 |
|
MD5 | 04341b83fdc7616ba6ba11fcd1a4a044 |
|
BLAKE2b-256 | d9ba1f36ec716e4d61b6352f454da1564e42cfce430082bab2306ca0810903dd |