Skip to content

Commit

Permalink
proper deprecation annotations for python
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Oct 28, 2024
1 parent 10fed50 commit 85fe543
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions rerun_py/rerun_sdk/rerun/sinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import warnings

import rerun_bindings as bindings # type: ignore[attr-defined]
from typing_extensions import deprecated # type: ignore[misc, unused-ignore]

from rerun.blueprint.api import BlueprintLike, create_in_memory_blueprint
from rerun.recording_stream import RecordingStream, get_application_id
Expand All @@ -20,6 +21,10 @@ def is_recording_enabled(recording: RecordingStream | None) -> bool:
return bindings.is_enabled() # type: ignore[no-any-return]


@deprecated(
"""Please migrate to `rr.connect_tcp(…)`.
See: https://www.rerun.io/docs/reference/migration-0-20 for more details."""
)
def connect(
addr: str | None = None,
*,
Expand All @@ -28,10 +33,12 @@ def connect(
recording: RecordingStream | None = None,
) -> None:
"""
⚠️ DEPRECATED ⚠️ - `connect` is deprecated. Use `connect_tcp` instead.
Connect to a remote Rerun Viewer on the given ip:port.
!!! Warning "Deprecated"
Please migrate to [rerun.connect_tcp][].
See [the migration guide](https://www.rerun.io/docs/reference/migration-0-20) for more details.
Requires that you first start a Rerun Viewer by typing 'rerun' in a terminal.
This function returns immediately.
Expand Down Expand Up @@ -66,9 +73,6 @@ def connect(
)


_connect = connect # we need this because Python scoping is horrible


def connect_tcp(
addr: str | None = None,
*,
Expand Down Expand Up @@ -243,6 +247,10 @@ def disconnect(recording: RecordingStream | None = None) -> None:
bindings.disconnect(recording=recording)


@deprecated(
"""Please migrate to `rr.serve_web(…)`.
See: https://www.rerun.io/docs/reference/migration-0-20 for more details."""
)
def serve(
*,
open_browser: bool = True,
Expand All @@ -253,10 +261,12 @@ def serve(
server_memory_limit: str = "25%",
) -> None:
"""
⚠️ DEPRECATED ⚠️ - `serve` is deprecated. Use `serve_web` instead.
Serve log-data over WebSockets and serve a Rerun web viewer over HTTP.
!!! Warning "Deprecated"
Please migrate to [rerun.serve_web][].
See [the migration guide](https://www.rerun.io/docs/reference/migration-0-20) for more details.
You can also connect to this server with the native viewer using `rerun localhost:9090`.
The WebSocket server will buffer all log data in memory so that late connecting viewers will get all the data.
Expand Down Expand Up @@ -467,4 +477,4 @@ def spawn(
_spawn_viewer(port=port, memory_limit=memory_limit, hide_welcome_screen=hide_welcome_screen)

if connect:
_connect(f"127.0.0.1:{port}", recording=recording, default_blueprint=default_blueprint)
connect_tcp(f"127.0.0.1:{port}", recording=recording, default_blueprint=default_blueprint)

0 comments on commit 85fe543

Please sign in to comment.