Package: rerun-sdk
The Rerun Python Log SDKUse 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.Installpip3installrerun-sdkℹ️ Note:
The Python module is calledrerun, while the package published on PyPI isrerun-sdk.Exampleimportrerunasrrimportnumpyasnprr.init("rerun_example_app",spawn=True)positions=np.vstack([xyz.ravel()forxyzinnp.mgrid[3*[slice(-5,5,10j)]]]).Tcolors=np.vstack([rgb.ravel()forrgbinnp.mgrid[3*[slice(0,255,10j)]]]).astype(np.uint8).Trr.log("points3d",rr.Points3D(positions,colors=colors))ResourcesExamplesPython API docsQuick startTutorialTroubleshootingDiscord ServerLogging and viewing in different processesYou 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-mrerunIn a second terminal, run the example with the--connectoption:python3examples/python/car/main.py--connectFrom SourceSetup:Install the Rust toolchain:https://rustup.rs/git clone git@github.com:rerun-io/rerun.git && cd rerunRun./scripts/setup_dev.sh.Make surecargo --versionprints1.74.0once you are doneBuildingTo build from source and install Rerun into yourcurrentPython environment run:python3-mpipinstall--upgradepip
pip3install-rrerun_py/requirements-build.txt
pip3install"./rerun_py"ℹ️ Note:
If you are unable to upgrade pip to version>=21.3, you need to pass--use-feature=in-tree-buildto thepip3 installcommand.DevelopmentTo set up a new virtualenv for development:justpy-dev-env# For bash/zsh users:sourcevenv/bin/activate# Or if you're using fish:sourcevenv/bin/activate.fishBuild, test, and runFor ease of development you can build and install in "editable" mode. This means you can edit thererunPython 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!sourcevenv/bin/activate
justpy-buildTest# Run the unit testsjustpy-test# Run the linting checksjustpy-lint# Run an examplepythonexamples/python/car/main.pyBuilding an installable Python WheelThe Python bindings to the core Rust library are built usinghttps://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 --releaseBy default the wheels will be built totarget/wheels(use the-oflag to set a different output directory).Now you can installrerunin any Python3 environment using:pip3installtarget/wheels/*.whlViewing the docs locallyThe rerun python docs are generated usingmkdocsInstall the doc requirements:pip install -r rerun_py/requirements-doc.txtServe the docs:mkdocsserve-frerun_py/mkdocs.yml-wrerun_pyorjustpy-docs-serveFor information on how the docs system works, see:docs/writing_docs.mdTroubleshootingYou can run withRUST_LOG=debugto get more output out of the rerun SDK.If you are using an Apple-silicon Mac, make surerustc -vVoutputshost: aarch64-apple-darwin. If not, this should fix it:rustupsetdefault-hostaarch64-apple-darwin&&rustupinstall1.74If you want to switch back, this is how:rustupsetdefault-hostx86_64-apple-darwin&&rustupinstall1.74