[WIP][TBD] Update how we handle dependencies and run environment for our Python examples #5890
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
This PR aims to update the way we handle the dependencies and run environment of our Python examples.
Goals:
In addition, we should support both dev environment (install
rerun-sdk
from the working directory) and end-user environment (installrerun-sdk
from PyPI).WIP: for now, here are 3 versions of the human_pose_tracking example, with handling by
uv
,poetry
, andhatch
, to serve a discussion basis.Using
uv
Example:
human_pose_tracking
Tooling Installation
Environment Setup
Must be manually created but
uv
has facilities for that:uv
yet, so the user must pick a compatible python version.Note: since this is basically based on a (locked) requirement file, "standard" Python tooling will also work:
In that sense,
uv
is only required for example authors (to update therequirements.txt
file).Run the example
Create/update the lockfile
The direct dependencies are specified in
requirements.in
. From that,uv
is able to generate arequirements.txt
which essentially is a lockfile:Using
poetry
withpackage-mode = false
Example:
human_pose_tracking_poetry
Note:
package-mode = false
is very nice for lone scripts that don't need to be "pip installed" to run, just like our examples.Tooling Installation
Environment Setup
poetry install # to use the local rerun-sdk (this triggers maturin compilation) poetry run pip install -e ../../../rerun_py
This will do the following:
pyproject.toml
.main
executable script as specified in thepyproject.toml
.Additional facilities provided by Poetry:
Run the example
Create/update the lockfile
Using
hatch
Example:
human_pose_tracking_hatch
hatch
is similar topoetry
, but with wider scope and a richer plug-in ecosystem to support it.Tooling Installation
Environment Setup
Basically nothing,
hatch
creates a venv on the fly.To use the dev rerun-sdk:
Run the example
hatch run python main.py # or hatch shell python main.py
Using pixi
Tooling Installation
curl -fsSL https://pixi.sh/install.sh | bash
Environment Setup
None
Run the example
Checklist
main
build: rerun.io/viewernightly
build: rerun.io/viewer