Skip to content

Commit

Permalink
Remove show from Python SDK (#1429)
Browse files Browse the repository at this point in the history
* Remove show() function from Python SDK

* py-format/lint
  • Loading branch information
emilk authored Feb 28, 2023
1 parent 1f52337 commit 9c3ee1b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 36 deletions.
19 changes: 4 additions & 15 deletions rerun_py/rerun_sdk/rerun/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,25 +306,14 @@ def serve(open_browser: bool = True) -> None:


def disconnect() -> None:
"""Disconnect from the remote rerun server (if any)."""
bindings.disconnect()


def show() -> None:
"""
Show previously logged data.
This only works if you have not called `connect`.
NOTE: There is a bug which causes this function to only work once on some platforms.
Closes all TCP connections, servers, and files.
Closes all TCP connections, servers, and files that have been opened with
[`rerun.connect`], [`rerun.serve`], [`rerun.save`] or [`rerun.spawn`].
"""

if not bindings.is_enabled():
print("Rerun is disabled - show() call ignored")
return

bindings.show()
bindings.disconnect()


def save(path: str) -> None:
Expand Down
22 changes: 1 addition & 21 deletions rerun_py/src/python_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,7 @@ fn rerun_bindings(py: Python<'_>, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(shutdown, m)?)?;
m.add_function(wrap_pyfunction!(is_enabled, m)?)?;
m.add_function(wrap_pyfunction!(set_enabled, m)?)?;

#[cfg(feature = "native_viewer")]
{
m.add_function(wrap_pyfunction!(disconnect, m)?)?;
m.add_function(wrap_pyfunction!(show, m)?)?;
}
m.add_function(wrap_pyfunction!(disconnect, m)?)?;
m.add_function(wrap_pyfunction!(save, m)?)?;

m.add_function(wrap_pyfunction!(set_time_sequence, m)?)?;
Expand Down Expand Up @@ -330,26 +325,11 @@ fn set_enabled(enabled: bool) {
///
/// Subsequent log messages will be buffered and either sent on the next call to `connect`,
/// or shown with `show`.
#[cfg(feature = "native_viewer")]
#[pyfunction]
fn disconnect() {
global_session().disconnect();
}

/// Show the buffered log data.
///
/// NOTE: currently this only works _once_.
/// Calling this function more than once is undefined behavior.
/// We will try to fix this in the future.
/// Blocked on <https://github.com/emilk/egui/issues/1918>.
#[cfg(feature = "native_viewer")]
#[pyfunction]
fn show() -> PyResult<()> {
global_session()
.show()
.map_err(|err| PyRuntimeError::new_err(format!("Failed to show Rerun Viewer: {err}")))
}

#[pyfunction]
fn save(path: &str) -> PyResult<()> {
let mut session = global_session();
Expand Down

0 comments on commit 9c3ee1b

Please sign in to comment.