viam-sdk 0.54.1b0__py3-none-linux_armv7l.whl → 0.54.2b0__py3-none-linux_armv7l.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of viam-sdk might be problematic. Click here for more details.

@@ -63,14 +63,7 @@ class Camera(ComponentBase):
63
63
  ...
64
64
 
65
65
  @abc.abstractmethod
66
- async def get_images(
67
- self,
68
- *,
69
- filter_source_names: Optional[List[str]] = None,
70
- extra: Optional[Dict[str, Any]] = None,
71
- timeout: Optional[float] = None,
72
- **kwargs,
73
- ) -> Tuple[List[NamedImage], ResponseMetadata]:
66
+ async def get_images(self, *, timeout: Optional[float] = None, **kwargs) -> Tuple[List[NamedImage], ResponseMetadata]:
74
67
  """Get simultaneous images from different imagers, along with associated metadata.
75
68
  This should not be used for getting a time series of images from the same imager.
76
69
 
@@ -41,26 +41,20 @@ class CameraClient(Camera, ReconfigurableResourceRPCClientBase):
41
41
  md = kwargs.get("metadata", self.Metadata()).proto
42
42
  request = GetImageRequest(name=self.name, mime_type=mime_type, extra=dict_to_struct(extra))
43
43
  response: GetImageResponse = await self.client.GetImage(request, timeout=timeout, metadata=md)
44
- return ViamImage(response.image, response.mime_type)
44
+ return ViamImage(response.image, CameraMimeType.from_string(response.mime_type))
45
45
 
46
46
  async def get_images(
47
47
  self,
48
48
  *,
49
- filter_source_names: Optional[List[str]] = None,
50
- extra: Optional[Dict[str, Any]] = None,
51
49
  timeout: Optional[float] = None,
52
50
  **kwargs,
53
51
  ) -> Tuple[List[NamedImage], ResponseMetadata]:
54
52
  md = kwargs.get("metadata", self.Metadata()).proto
55
- request = GetImagesRequest(name=self.name, extra=dict_to_struct(extra), filter_source_names=filter_source_names)
53
+ request = GetImagesRequest(name=self.name)
56
54
  response: GetImagesResponse = await self.client.GetImages(request, timeout=timeout, metadata=md)
57
55
  imgs = []
58
56
  for img_data in response.images:
59
- if img_data.mime_type:
60
- mime_type = img_data.mime_type
61
- else:
62
- # TODO(RSDK-11728): remove this once we deleted the format field
63
- mime_type = str(CameraMimeType.from_proto(img_data.format))
57
+ mime_type = CameraMimeType.from_proto(img_data.format)
64
58
  img = NamedImage(img_data.source_name, img_data.image, mime_type)
65
59
  imgs.append(img)
66
60
  resp_metadata: ResponseMetadata = response.response_metadata
@@ -3,11 +3,9 @@
3
3
  from google.api.httpbody_pb2 import HttpBody # type: ignore
4
4
  from grpclib.server import Stream
5
5
 
6
- from viam.media.video import CameraMimeType
7
6
  from viam.proto.common import DoCommandRequest, DoCommandResponse, GetGeometriesRequest, GetGeometriesResponse
8
7
  from viam.proto.component.camera import (
9
8
  CameraServiceBase,
10
- Format,
11
9
  GetImageRequest,
12
10
  GetImageResponse,
13
11
  GetImagesRequest,
@@ -50,23 +48,12 @@ class CameraRPCService(CameraServiceBase, ResourceRPCServiceBase[Camera]):
50
48
  camera = self.get_resource(name)
51
49
 
52
50
  timeout = stream.deadline.time_remaining() if stream.deadline else None
53
- images, metadata = await camera.get_images(
54
- timeout=timeout,
55
- metadata=stream.metadata,
56
- extra=struct_to_dict(request.extra),
57
- filter_source_names=list(request.filter_source_names),
58
- )
51
+ images, metadata = await camera.get_images(timeout=timeout, metadata=stream.metadata)
59
52
  img_bytes_lst = []
60
53
  for img in images:
61
- try:
62
- mime_type = CameraMimeType.from_string(img.mime_type) # this can ValueError if the mime_type is not a CameraMimeType
63
- fmt = mime_type.to_proto()
64
- except ValueError:
65
- # TODO(RSDK-11728): remove this once we deleted the format field
66
- fmt = Format.FORMAT_UNSPECIFIED
67
-
54
+ fmt = img.mime_type.to_proto()
68
55
  img_bytes = img.data
69
- img_bytes_lst.append(Image(source_name=name, mime_type=img.mime_type, format=fmt, image=img_bytes))
56
+ img_bytes_lst.append(Image(source_name=name, format=fmt, image=img_bytes))
70
57
  response = GetImagesResponse(images=img_bytes_lst, response_metadata=metadata)
71
58
  await stream.send_message(response)
72
59
 
viam/media/video.py CHANGED
@@ -28,10 +28,7 @@ class CameraMimeType(str, Enum):
28
28
  Self: The mimetype
29
29
  """
30
30
  value_mime = value[:-5] if value.endswith("+lazy") else value # ViamImage lazy encodes by default
31
- try:
32
- return cls(value_mime)
33
- except ValueError:
34
- raise ValueError(f"Invalid mimetype: {value}")
31
+ return cls(value_mime)
35
32
 
36
33
  @classmethod
37
34
  def from_proto(cls, format: Format.ValueType) -> "CameraMimeType":
@@ -73,11 +70,11 @@ class ViamImage:
73
70
  """
74
71
 
75
72
  _data: bytes
76
- _mime_type: str
73
+ _mime_type: CameraMimeType
77
74
  _height: Optional[int] = None
78
75
  _width: Optional[int] = None
79
76
 
80
- def __init__(self, data: bytes, mime_type: str) -> None:
77
+ def __init__(self, data: bytes, mime_type: CameraMimeType) -> None:
81
78
  self._data = data
82
79
  self._mime_type = mime_type
83
80
  self._width, self._height = _getDimensions(data, mime_type)
@@ -88,7 +85,7 @@ class ViamImage:
88
85
  return self._data
89
86
 
90
87
  @property
91
- def mime_type(self) -> str:
88
+ def mime_type(self) -> CameraMimeType:
92
89
  """The mime type of the image"""
93
90
  return self._mime_type
94
91
 
@@ -131,12 +128,12 @@ class NamedImage(ViamImage):
131
128
  """The name of the image
132
129
  """
133
130
 
134
- def __init__(self, name: str, data: bytes, mime_type: str) -> None:
131
+ def __init__(self, name: str, data: bytes, mime_type: CameraMimeType) -> None:
135
132
  self.name = name
136
133
  super().__init__(data, mime_type)
137
134
 
138
135
 
139
- def _getDimensions(image: bytes, mime_type: str) -> Tuple[Optional[int], Optional[int]]:
136
+ def _getDimensions(image: bytes, mime_type: CameraMimeType) -> Tuple[Optional[int], Optional[int]]:
140
137
  try:
141
138
  if mime_type == CameraMimeType.JPEG:
142
139
  return _getDimensionsFromJPEG(image)
@@ -79,7 +79,8 @@ class VisionRPCService(UnimplementedVisionServiceBase, ResourceRPCServiceBase):
79
79
  extra = struct_to_dict(request.extra)
80
80
  timeout = stream.deadline.time_remaining() if stream.deadline else None
81
81
 
82
- image = ViamImage(request.image, request.mime_type)
82
+ mime_type = CameraMimeType.from_string(request.mime_type)
83
+ image = ViamImage(request.image, mime_type)
83
84
 
84
85
  result = await vision.get_detections(image, extra=extra, timeout=timeout)
85
86
  response = GetDetectionsResponse(detections=result)
@@ -104,7 +105,8 @@ class VisionRPCService(UnimplementedVisionServiceBase, ResourceRPCServiceBase):
104
105
  extra = struct_to_dict(request.extra)
105
106
  timeout = stream.deadline.time_remaining() if stream.deadline else None
106
107
 
107
- image = ViamImage(request.image, request.mime_type)
108
+ mime_type = CameraMimeType.from_string(request.mime_type)
109
+ image = ViamImage(request.image, mime_type)
108
110
 
109
111
  result = await vision.get_classifications(image, request.n, extra=extra, timeout=timeout)
110
112
  response = GetClassificationsResponse(classifications=result)
viam/version_metadata.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "0.54.1b0"
1
+ __version__ = "0.54.2b0"
2
2
 
3
3
  API_VERSION = "v0.1.474"
4
4
  SDK_VERSION = __version__
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: viam-sdk
3
- Version: 0.54.1b0
3
+ Version: 0.54.2b0
4
4
  Summary: Viam Robotics Python SDK
5
5
  Project-URL: Homepage, https://www.viam.com
6
6
  Project-URL: Documentation, https://python.viam.dev
@@ -7,7 +7,7 @@ viam/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  viam/sessions_client.py,sha256=E4ThFCK1HCX_iAvEymvCdJ-H0ZlouzgoIwIE_nywfqc,9414
8
8
  viam/streams.py,sha256=VoM8FSMuGZmv4RPDHQy4FfHvJq36r4NY--gkQoaFkzs,1042
9
9
  viam/utils.py,sha256=xz7qb6bM-2qzOSQSsYHBheBidMbUAlQ2dHCi_GyPFnk,13579
10
- viam/version_metadata.py,sha256=FvWa4TEEJIU_XdFpKm3Y2HEWLWf7J4KEU-43uoQq50g,77
10
+ viam/version_metadata.py,sha256=aIIuyI5xRKMbDLpsKkIYOfLw1dqDtvbfJpW3y__nino,77
11
11
  viam/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  viam/app/_logs.py,sha256=hWxRELRJCux-fQIQtDwztD3odjkBm7Vo8HUQ7XGICek,806
13
13
  viam/app/app_client.py,sha256=65PJBo8el0Mni59N9t4X1ca1LAnzhAAjLGARJoN-f98,115050
@@ -39,9 +39,9 @@ viam/components/button/button.py,sha256=JxDDnh0L1R7ssNEcgw6AiiytTgOBPfzTBrUoCg-B
39
39
  viam/components/button/client.py,sha256=nLXYVU9EBqz_mxCcotqrOpIpK_i2wlLZiOlHhTa7l54,1613
40
40
  viam/components/button/service.py,sha256=b60T2QK9EMNaKyfF-MoICFGxbEoxu4LOU9-_hHJW6Xc,1641
41
41
  viam/components/camera/__init__.py,sha256=A6qRK8YNTcGndum2dGrKsytnrzoVRptC-El9U8GDjW0,546
42
- viam/components/camera/camera.py,sha256=ZDomdim313xw3olU0tfIbVr1-8uae1x-bxLg1GMluog,5248
43
- viam/components/camera/client.py,sha256=rtcnUFyuFUTTiiRuOE3shiND-8fi9da3iXIHTczrbaI,4185
44
- viam/components/camera/service.py,sha256=O8GjtOLqFfW4ZFoOBHjqHBp4wNZkop5MhMXS7oyH4JE,5513
42
+ viam/components/camera/camera.py,sha256=-y96Tie8kV1YXj8VZC5CUHda1e7HVpZ_WKrVYxhjs70,5104
43
+ viam/components/camera/client.py,sha256=A-hqrNoC8QhPQnanxWtw_HFgoVggMGO4_efzAXcPSpU,3848
44
+ viam/components/camera/service.py,sha256=0Aaqz5W3nvLkfvtETA6XKvXJpMZoDC8U14WHmKqLthE,4969
45
45
  viam/components/encoder/__init__.py,sha256=J31WFCzGPqHkPTYJEQOzdpB68EoQLdMWpyzBWqhHhYs,362
46
46
  viam/components/encoder/client.py,sha256=KmhyzTkcsbuduNgceEIQHFYO6hIbwg3cM1BgSRWJU4o,3244
47
47
  viam/components/encoder/encoder.py,sha256=rfqQX2MqUwTjndbCOEKefxb4NKuQFQ86fCOhgH9ZEu8,4074
@@ -355,7 +355,7 @@ viam/gen/tagger/v1/tagger_pb2.pyi,sha256=HCFLlOxnXs7VX3S8FTyrh0Q-kZLPaP1KRE8p1Tw
355
355
  viam/media/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
356
356
  viam/media/audio.py,sha256=uWwpzYQZCfuLldNfsombV61ju-Tkx8CeVUR6fJyhFdc,380
357
357
  viam/media/viam_rgba.py,sha256=641MhSgRdo3q0FgxaxaPzRk-o8FP1EZx_kdTBOy-A7M,429
358
- viam/media/video.py,sha256=RnM11rG9V1iS0hnfJm2VfPVVVYMBli0dNecaj6E0WrY,6879
358
+ viam/media/video.py,sha256=5HOnaqwBuhj2vETNOPwaL3olAw9-i4XCc3pQspV51cs,6831
359
359
  viam/media/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
360
360
  viam/media/utils/pil/__init__.py,sha256=b8jSuxOzm1o9CMaJ186V5dMufw4_jXZG5g2U_EJ3bKQ,1466
361
361
  viam/media/utils/pil/viam_rgba_plugin.py,sha256=3vIevKK4pnB9EJV_n7bho3XEAzFyuMb3uRTedsvizxI,2563
@@ -469,9 +469,9 @@ viam/services/slam/service.py,sha256=e0tu63sja2EbeS3OOJTZdjY9pU1ToPzFEuxztS097Dc
469
469
  viam/services/slam/slam.py,sha256=2VgAXcFrAGkckfu2YOR9NGnioKau47E83JroNzbvExE,3964
470
470
  viam/services/vision/__init__.py,sha256=g4Dnz6BFgVZpvE6j6sNwxAc2baZfAKLA6XS2GaGgDcc,464
471
471
  viam/services/vision/client.py,sha256=uaFMlYwKE5N_Qp803aFGfk8k6KCWPKNwUxyV_fnlBp4,7776
472
- viam/services/vision/service.py,sha256=zQFcnWXSFYDwZQlnfTH5_bH5uXzMej5qjyABWdeV9nk,6826
472
+ viam/services/vision/service.py,sha256=NWV3yY1ZyEbl4rrp28CtX9n-uIgyxSQbbKJTeoIVjCg,6942
473
473
  viam/services/vision/vision.py,sha256=MrQsTarahwGMEmqWX4ODCJT5wLOGHXNEuEyTQgOvsg4,12527
474
- viam_sdk-0.54.1b0.dist-info/METADATA,sha256=RB-ucRQBaAkUtW5cJYkmIhaq3eFgRGA9MXbK3aJKjtM,10322
475
- viam_sdk-0.54.1b0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
476
- viam_sdk-0.54.1b0.dist-info/licenses/LICENSE,sha256=yVuuHRzgI17MzTVgt3LsHvuX80innw--CmNPDCzO_iw,11358
477
- viam_sdk-0.54.1b0.dist-info/RECORD,,
474
+ viam_sdk-0.54.2b0.dist-info/METADATA,sha256=PecYp3B2ZosE8bcHxrfLxqZzfxF8MuL-5hKYsmKFrPs,10322
475
+ viam_sdk-0.54.2b0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
476
+ viam_sdk-0.54.2b0.dist-info/licenses/LICENSE,sha256=yVuuHRzgI17MzTVgt3LsHvuX80innw--CmNPDCzO_iw,11358
477
+ viam_sdk-0.54.2b0.dist-info/RECORD,,