Skip to content

Commit 21d5858

Browse files
authored
Py builds withpixi run py-build-release now spawn release viewer (#10127)
1 parent ab21a0f commit 21d5858

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

rerun_py/rerun/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
print(f"DEV ENVIRONMENT DETECTED! Re-importing rerun from: {real_path}", file=sys.stderr)
2828

2929
if "RERUN_CLI_PATH" not in os.environ:
30-
target_path = pathlib.Path(__file__).parent.parent.parent.joinpath("target/debug/rerun").resolve()
30+
import rerun_bindings as bindings
31+
32+
flavor = "debug" if bindings.is_dev_build() else "release"
33+
target_path = pathlib.Path(__file__).parent.parent.parent.joinpath(f"target/{flavor}/rerun").resolve()
3134
os.environ["RERUN_CLI_PATH"] = str(target_path)
3235

3336
sys.path.insert(0, str(real_path))

rerun_py/rerun_bindings/rerun_bindings.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,9 @@ def send_recording(rrd: Recording, recording: Optional[PyRecordingStream] = None
940940
def version() -> str:
941941
"""Return a verbose version string."""
942942

943+
def is_dev_build() -> bool:
944+
"""Return True if the Rerun SDK is a dev/debug build."""
945+
943946
def get_app_url() -> str:
944947
"""
945948
Get an url to an instance of the web-viewer.

rerun_py/src/python_bridge.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ fn rerun_bindings(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
180180

181181
// misc
182182
m.add_function(wrap_pyfunction!(version, m)?)?;
183+
m.add_function(wrap_pyfunction!(is_dev_build, m)?)?;
183184
m.add_function(wrap_pyfunction!(get_app_url, m)?)?;
184185
m.add_function(wrap_pyfunction!(start_web_viewer_server, m)?)?;
185186
m.add_function(wrap_pyfunction!(escape_entity_path_part, m)?)?;
@@ -1450,6 +1451,12 @@ fn version() -> String {
14501451
re_build_info::build_info!().to_string()
14511452
}
14521453

1454+
/// Return True if the Rerun SDK is a dev/debug build.
1455+
#[pyfunction]
1456+
fn is_dev_build() -> bool {
1457+
cfg!(debug_assertions)
1458+
}
1459+
14531460
/// Get an url to an instance of the web-viewer.
14541461
///
14551462
/// This may point to app.rerun.io or localhost depending on

0 commit comments

Comments
 (0)