diff --git a/src/viam/proto/robot/__init__.py b/src/viam/proto/robot/__init__.py index a860e990d..fd3e5d3bc 100644 --- a/src/viam/proto/robot/__init__.py +++ b/src/viam/proto/robot/__init__.py @@ -10,8 +10,8 @@ CancelOperationRequest, CancelOperationResponse, ConfigStatus, - DiscoverComponentsRequest, - DiscoverComponentsResponse, + DiscoverComponentsRequest, # deprecated, remove on march 10th + DiscoverComponentsResponse, # deprecated, remove on march 10th Discovery, DiscoveryQuery, FrameSystemConfig, @@ -73,8 +73,8 @@ "CancelOperationRequest", "CancelOperationResponse", "ConfigStatus", - "DiscoverComponentsRequest", - "DiscoverComponentsResponse", + "DiscoverComponentsRequest", # deprecated, remove on march 10th + "DiscoverComponentsResponse", # deprecated, remove on march 10th "Discovery", "DiscoveryQuery", "FrameSystemConfig", diff --git a/src/viam/robot/client.py b/src/viam/robot/client.py index 29d66fe1d..0ea996fa2 100644 --- a/src/viam/robot/client.py +++ b/src/viam/robot/client.py @@ -1,5 +1,6 @@ import asyncio import sys +import warnings from dataclasses import dataclass from datetime import datetime from threading import RLock @@ -732,6 +733,7 @@ async def discover_components( queries: List[DiscoveryQuery], ) -> List[Discovery]: """ + Deprecated: v0.38.0, use the Discovery Service APIs instead. Get a list of discovered potential component configurations, for example listing different supported resolutions. Currently only works for some cameras. Returns module names for modules. @@ -759,6 +761,11 @@ async def discover_components( """ request = DiscoverComponentsRequest(queries=queries) response: DiscoverComponentsResponse = await self._client.DiscoverComponents(request) + warnings.warn( + "RobotClient.discover_components is deprecated. It will be removed on March 10 2025. Use the DiscoveryService APIs instead.", + DeprecationWarning, stacklevel=2) + LOGGER.warning( + "RobotClient.discover_components is deprecated. It will be removed on March 10 2025. Use the DiscoveryService APIs instead.") return list(response.discovery) ############ diff --git a/tests/mocks/robot.py b/tests/mocks/robot.py index 99857f3a6..3532f2b53 100644 --- a/tests/mocks/robot.py +++ b/tests/mocks/robot.py @@ -9,8 +9,6 @@ BlockForOperationResponse, CancelOperationRequest, CancelOperationResponse, - DiscoverComponentsRequest, - DiscoverComponentsResponse, FrameSystemConfigRequest, FrameSystemConfigResponse, GetCloudMetadataRequest, @@ -100,9 +98,6 @@ async def FrameSystemConfig(self, stream: Stream[FrameSystemConfigRequest, Frame async def TransformPose(self, stream: Stream[TransformPoseRequest, TransformPoseResponse]) -> None: raise MethodNotImplementedError("TransformPose").grpc_error - async def DiscoverComponents(self, stream: Stream[DiscoverComponentsRequest, DiscoverComponentsResponse]) -> None: - raise MethodNotImplementedError("DiscoverComponents").grpc_error - async def StopAll(self, stream: Stream[StopAllRequest, StopAllResponse]) -> None: raise MethodNotImplementedError("StopAll").grpc_error diff --git a/tests/test_robot.py b/tests/test_robot.py index b52aa5b1c..024a8d8fa 100644 --- a/tests/test_robot.py +++ b/tests/test_robot.py @@ -21,8 +21,6 @@ BlockForOperationResponse, CancelOperationRequest, CancelOperationResponse, - DiscoverComponentsRequest, - DiscoverComponentsResponse, Discovery, DiscoveryQuery, FrameSystemConfig, @@ -168,12 +166,6 @@ async def TransformPose(stream: Stream[TransformPoseRequest, TransformPoseRespon response = TransformPoseResponse(pose=TRANSFORM_RESPONSE) await stream.send_message(response) - async def DiscoverComponents(stream: Stream[DiscoverComponentsRequest, DiscoverComponentsResponse]) -> None: - request = await stream.recv_message() - assert request is not None - response = DiscoverComponentsResponse(discovery=DISCOVERY_RESPONSE) - await stream.send_message(response) - async def GetOperations(stream: Stream[GetOperationsRequest, GetOperationsResponse]) -> None: request = await stream.recv_message() assert request is not None @@ -205,7 +197,6 @@ async def Shutdown(stream: Stream[ShutdownRequest, ShutdownResponse]) -> None: service = RobotService(manager) service.FrameSystemConfig = Config service.TransformPose = TransformPose - service.DiscoverComponents = DiscoverComponents service.GetOperations = GetOperations service.GetCloudMetadata = GetCloudMetadata service.Shutdown = Shutdown @@ -374,13 +365,6 @@ async def test_transform_pose(self, service: RobotService): assert pose == TRANSFORM_RESPONSE await client.close() - async def test_discover_components(self, service: RobotService): - async with ChannelFor([service]) as channel: - client = await RobotClient.with_channel(channel, RobotClient.Options()) - discoveries = await client.discover_components([DISCOVERY_QUERY]) - assert discoveries == DISCOVERY_RESPONSE - await client.close() - async def test_get_cloud_metadata(self, service: RobotService): async with ChannelFor([service]) as channel: client = await RobotClient.with_channel(channel, RobotClient.Options())