Skip to main content

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.

Rerun Viewer

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 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 --version prints 1.72.1 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/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/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.72

If you want to switch back, this is how:

rustup set default-host x86_64-apple-darwin && rustup install 1.72

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rerun_sdk-0.10.0-cp38-abi3-win_amd64.whl (23.8 MB view details)

Uploaded CPython 3.8+Windows x86-64

rerun_sdk-0.10.0-cp38-abi3-manylinux_2_31_x86_64.whl (30.6 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.31+ x86-64

rerun_sdk-0.10.0-cp38-abi3-macosx_11_0_arm64.whl (24.8 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

rerun_sdk-0.10.0-cp38-abi3-macosx_10_7_x86_64.whl (25.9 MB view details)

Uploaded CPython 3.8+macOS 10.7+ x86-64

File details

Details for the file rerun_sdk-0.10.0-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for rerun_sdk-0.10.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b55cc47efd5683e8306a0d3c7bbab2466b72b13a627df1cf8e34b732e1795765
MD5 65541c9312607713557c309fe192df7e
BLAKE2b-256 04a45332606599bd54434a5ac901fc7f6586668546e6a916eaf397fa06a7373d

See more details on using hashes here.

File details

Details for the file rerun_sdk-0.10.0-cp38-abi3-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for rerun_sdk-0.10.0-cp38-abi3-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 2a819f1e291fa4e2a0f20625f4f051b2a2270173aa61a073047e26ac72194fb5
MD5 99a318ab62c9a4f2f8d012966285794e
BLAKE2b-256 2cbe117fc2a4af9783ad1ad275604fff7eed67041008d5e766c30e5a3b02b432

See more details on using hashes here.

File details

Details for the file rerun_sdk-0.10.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rerun_sdk-0.10.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ba8fa5a53aa140beb8be99c203c7e83e710ef1ecd594a1d69631e86325f0bfd0
MD5 ec2ab5b0f2837323a1a0c0c7d209cda3
BLAKE2b-256 bb573d300a45e1b0806f29755ecad05f8f172e5ee4a0708e0ef9b746163faccd

See more details on using hashes here.

File details

Details for the file rerun_sdk-0.10.0-cp38-abi3-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for rerun_sdk-0.10.0-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 59681ee9b3cdb74940c4d4026895ac25eb9a54e338b7bdbbdc7500f334f0a50c
MD5 b433a96d2f1342a35a541d88678bf63d
BLAKE2b-256 851d2a654bbf28495fb1ee2926d7f6ee36db0455567b21683773a9746b36e541

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page