modAL 1.2.5.dev9__py3-none-any.whl → 1.2.5.dev11__py3-none-any.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.
modal/client.pyi CHANGED
@@ -32,7 +32,7 @@ class _Client:
32
32
  server_url: str,
33
33
  client_type: int,
34
34
  credentials: typing.Optional[tuple[str, str]],
35
- version: str = "1.2.5.dev9",
35
+ version: str = "1.2.5.dev11",
36
36
  ):
37
37
  """mdmd:hidden
38
38
  The Modal client object is not intended to be instantiated directly by users.
@@ -163,7 +163,7 @@ class Client:
163
163
  server_url: str,
164
164
  client_type: int,
165
165
  credentials: typing.Optional[tuple[str, str]],
166
- version: str = "1.2.5.dev9",
166
+ version: str = "1.2.5.dev11",
167
167
  ):
168
168
  """mdmd:hidden
169
169
  The Modal client object is not intended to be instantiated directly by users.
modal/dict.py CHANGED
@@ -28,7 +28,7 @@ from ._utils.name_utils import check_object_name
28
28
  from ._utils.time_utils import as_timestamp, timestamp_to_localized_dt
29
29
  from .client import _Client
30
30
  from .config import logger
31
- from .exception import AlreadyExistsError, InvalidError, NotFoundError, RequestSizeError
31
+ from .exception import AlreadyExistsError, DeserializationError, InvalidError, NotFoundError, RequestSizeError
32
32
 
33
33
 
34
34
  class _NoDefaultSentinel:
@@ -43,6 +43,25 @@ def _serialize_dict(data):
43
43
  return [api_pb2.DictEntry(key=serialize(k), value=serialize(v)) for k, v in data.items()]
44
44
 
45
45
 
46
+ def _deserialize_dict_key(dict: "_Dict", data: bytes) -> Any:
47
+ try:
48
+ return deserialize(data, dict._client)
49
+ except DeserializationError as exc:
50
+ dict_identifier = f"Dict '{dict.name}'" if dict.name else f"ephemeral Dict {dict.object_id}"
51
+ raise DeserializationError(f"Failed to deserialize a key from {dict_identifier}: {exc}") from exc
52
+
53
+
54
+ def _deserialize_dict_value(dict: "_Dict", data: bytes, key: Any = _NO_DEFAULT) -> Any:
55
+ try:
56
+ return deserialize(data, dict._client)
57
+ except DeserializationError as exc:
58
+ key_identifier = "" if key is _NO_DEFAULT else f" for key {key!r}"
59
+ dict_identifier = f"Dict '{dict.name}'" if dict.name else f"ephemeral Dict {dict.object_id}"
60
+ raise DeserializationError(
61
+ f"Failed to deserialize value{key_identifier} from {dict_identifier}: {exc}"
62
+ ) from exc
63
+
64
+
46
65
  @dataclass
47
66
  class DictInfo:
48
67
  """Information about a Dict object."""
@@ -439,7 +458,7 @@ class _Dict(_Object, type_prefix="di"):
439
458
  resp = await self._client.stub.DictGet(req)
440
459
  if not resp.found:
441
460
  return default
442
- return deserialize(resp.value, self._client)
461
+ return _deserialize_dict_value(self, resp.value, key)
443
462
 
444
463
  @live_method
445
464
  async def contains(self, key: Any) -> bool:
@@ -530,7 +549,7 @@ class _Dict(_Object, type_prefix="di"):
530
549
  if default is not _NO_DEFAULT:
531
550
  return default
532
551
  raise KeyError(f"{key} not in dict {self.object_id}")
533
- return deserialize(resp.value, self._client)
552
+ return _deserialize_dict_value(self, resp.value, key)
534
553
 
535
554
  @live_method
536
555
  async def __delitem__(self, key: Any) -> Any:
@@ -557,7 +576,7 @@ class _Dict(_Object, type_prefix="di"):
557
576
  """
558
577
  req = api_pb2.DictContentsRequest(dict_id=self.object_id, keys=True)
559
578
  async for resp in self._client.stub.DictContents.unary_stream(req):
560
- yield deserialize(resp.key, self._client)
579
+ yield _deserialize_dict_key(self, resp.key)
561
580
 
562
581
  @live_method_gen
563
582
  async def values(self) -> AsyncIterator[Any]:
@@ -568,7 +587,11 @@ class _Dict(_Object, type_prefix="di"):
568
587
  """
569
588
  req = api_pb2.DictContentsRequest(dict_id=self.object_id, values=True)
570
589
  async for resp in self._client.stub.DictContents.unary_stream(req):
571
- yield deserialize(resp.value, self._client)
590
+ try:
591
+ key_deser = _deserialize_dict_key(self, resp.key)
592
+ except DeserializationError:
593
+ key_deser = _NO_DEFAULT
594
+ yield _deserialize_dict_value(self, resp.value, key_deser)
572
595
 
573
596
  @live_method_gen
574
597
  async def items(self) -> AsyncIterator[tuple[Any, Any]]:
@@ -579,7 +602,9 @@ class _Dict(_Object, type_prefix="di"):
579
602
  """
580
603
  req = api_pb2.DictContentsRequest(dict_id=self.object_id, keys=True, values=True)
581
604
  async for resp in self._client.stub.DictContents.unary_stream(req):
582
- yield (deserialize(resp.key, self._client), deserialize(resp.value, self._client))
605
+ key_deser = _deserialize_dict_key(self, resp.key)
606
+ value_deser = _deserialize_dict_value(self, resp.value, key_deser)
607
+ yield (key_deser, value_deser)
583
608
 
584
609
 
585
610
  Dict = synchronize_api(_Dict)
modal/dict.pyi CHANGED
@@ -18,6 +18,8 @@ class _NoDefaultSentinel:
18
18
  _NO_DEFAULT: _NoDefaultSentinel
19
19
 
20
20
  def _serialize_dict(data): ...
21
+ def _deserialize_dict_key(dict: _Dict, data: bytes) -> typing.Any: ...
22
+ def _deserialize_dict_value(dict: _Dict, data: bytes, key: typing.Any = ...) -> typing.Any: ...
21
23
 
22
24
  class DictInfo:
23
25
  """Information about a Dict object."""
modal/functions.pyi CHANGED
@@ -409,7 +409,7 @@ class Function(
409
409
 
410
410
  _call_generator: ___call_generator_spec[typing_extensions.Self]
411
411
 
412
- class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
412
+ class __remote_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
413
413
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER:
414
414
  """Calls the function remotely, executing it with the given arguments and returning the execution's result."""
415
415
  ...
@@ -418,7 +418,7 @@ class Function(
418
418
  """Calls the function remotely, executing it with the given arguments and returning the execution's result."""
419
419
  ...
420
420
 
421
- remote: __remote_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
421
+ remote: __remote_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
422
422
 
423
423
  class __remote_gen_spec(typing_extensions.Protocol[SUPERSELF]):
424
424
  def __call__(self, /, *args, **kwargs) -> typing.Generator[typing.Any, None, None]:
@@ -445,7 +445,7 @@ class Function(
445
445
  """
446
446
  ...
447
447
 
448
- class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
448
+ class ___experimental_spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
449
449
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
450
450
  """[Experimental] Calls the function with the given arguments, without waiting for the results.
451
451
 
@@ -469,7 +469,7 @@ class Function(
469
469
  ...
470
470
 
471
471
  _experimental_spawn: ___experimental_spawn_spec[
472
- modal._functions.ReturnType, modal._functions.P, typing_extensions.Self
472
+ modal._functions.P, modal._functions.ReturnType, typing_extensions.Self
473
473
  ]
474
474
 
475
475
  class ___spawn_map_inner_spec(typing_extensions.Protocol[P_INNER, SUPERSELF]):
@@ -478,7 +478,7 @@ class Function(
478
478
 
479
479
  _spawn_map_inner: ___spawn_map_inner_spec[modal._functions.P, typing_extensions.Self]
480
480
 
481
- class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
481
+ class __spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
482
482
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
483
483
  """Calls the function with the given arguments, without waiting for the results.
484
484
 
@@ -499,7 +499,7 @@ class Function(
499
499
  """
500
500
  ...
501
501
 
502
- spawn: __spawn_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
502
+ spawn: __spawn_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
503
503
 
504
504
  def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]:
505
505
  """Return the inner Python object wrapped by this Modal Function."""
modal/runner.py CHANGED
@@ -628,7 +628,7 @@ async def _interactive_shell(
628
628
  try:
629
629
  if pty:
630
630
  container_process = await sandbox._exec(
631
- *sandbox_cmds, pty_info=get_pty_info(shell=True) if pty else None
631
+ *sandbox_cmds, pty_info=get_pty_info(shell=True) if pty else None, text=False
632
632
  )
633
633
  await container_process.attach()
634
634
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 1.2.5.dev9
3
+ Version: 1.2.5.dev11
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License: Apache-2.0
@@ -26,7 +26,7 @@ modal/app.pyi,sha256=nI_Tibj-rI5I7dJFJnczbHvcmVzCvvCih0tMzoQlr_Y,50835
26
26
  modal/billing.py,sha256=zmQ3bcCJlwa4KD1IA_QgdWpm1pn13c-7qfy79iEauYI,195
27
27
  modal/call_graph.py,sha256=1g2DGcMIJvRy-xKicuf63IVE98gJSnQsr8R_NVMptNc,2581
28
28
  modal/client.py,sha256=k1CqQ_0t4-vHylkqYZgYCnClg-FT0QrTPAKivL01A_k,14354
29
- modal/client.pyi,sha256=OL1m-Si0RVah2542uxu2xkKZbk9IS0l1MZF-16_chfg,13146
29
+ modal/client.pyi,sha256=g7qbToFmtD6iVG1MPHSTopmDDAs9_FxVPO5_4kpfqyA,13148
30
30
  modal/cloud_bucket_mount.py,sha256=cvVj5Rt4nDHoQbTneoJPTaAcnl_Ab_mrsjnnzd0v9OI,6013
31
31
  modal/cloud_bucket_mount.pyi,sha256=vXusGMOUk9HjCs4lhxteuCK4xLQclPfugGWKo7LECEA,7539
32
32
  modal/cls.py,sha256=4T__mtYlQUnkatif1Wnr8Ld9DN_ySydHj2UwhRg89ok,41984
@@ -34,8 +34,8 @@ modal/cls.pyi,sha256=p8Unbfr0yUdAzYYnD7erSRO7dH-87HkAg4oAn6srBzA,27424
34
34
  modal/config.py,sha256=byOUVfUibX9Ixrhbz5z4HDcgn-8S5OFicD6xGUErqZs,13415
35
35
  modal/container_process.py,sha256=KG2ZkFOWe2KN1b8dFSBLBoW5pWoRxBzJ20MLhDTicJs,16749
36
36
  modal/container_process.pyi,sha256=xMKr-VbQsydS8AbhAys9UTpHHnH2QRyINpPtPG7NwmI,8373
37
- modal/dict.py,sha256=Omfmj3fUyg7ijTI33Z97geyK7MW8T31LRm-N7pZqSwU,21582
38
- modal/dict.pyi,sha256=wemd-RTH3__HUsF2zfcVojb2ixE0-Xm0RVKOh5ZSDYE,31835
37
+ modal/dict.py,sha256=fI2-NbERnu8I8KuxOp2av2IV2cx_XO-v-JE8m8NAYnE,22765
38
+ modal/dict.pyi,sha256=yQHHZe98M6gB2ahzrmqlq8KUXvqFy6vamsijI2H0RdE,32002
39
39
  modal/environments.py,sha256=wMiMNpPkvIl_BdxRb81CY9Djzhczp_y4GEYKWp0JyBc,6135
40
40
  modal/environments.pyi,sha256=bMIxvwahckgaolGD3-hP2iovRHDXewvgbVs_nx4ze0o,3808
41
41
  modal/exception.py,sha256=HrvKRJO4EMwkoqa77PBeZyrGIgEZ-yqLIA10cqZndqI,5768
@@ -43,7 +43,7 @@ modal/file_io.py,sha256=Whs3QSl3pQbSoLzSRIIWfK4XyP-kwgyZmWgx3bhJ9u0,20933
43
43
  modal/file_io.pyi,sha256=xtO6Glf_BFwDE7QiQQo24QqcMf_Vv-iz7WojcGVlLBU,15932
44
44
  modal/file_pattern_matcher.py,sha256=A_Kdkej6q7YQyhM_2-BvpFmPqJ0oHb54B6yf9VqvPVE,8116
45
45
  modal/functions.py,sha256=kcNHvqeGBxPI7Cgd57NIBBghkfbeFJzXO44WW0jSmao,325
46
- modal/functions.pyi,sha256=Gyb8fhedU4BlEXIlgSBdDpQKNL-QIYvRxuf50WrN04k,38111
46
+ modal/functions.pyi,sha256=iaFyXiAZEdzd2e7vwB5sLzoLB1kSWCQrIiqmTaczFgQ,38111
47
47
  modal/gpu.py,sha256=Fe5ORvVPDIstSq1xjmM6OoNgLYFWvogP9r5BgmD3hYg,6769
48
48
  modal/image.py,sha256=Pi1tpi41rklU-7PvXyJxPBYKdG3FcW-H_2pWjjeLYzs,108165
49
49
  modal/image.pyi,sha256=grkqK9BfyKDXmJYNme-lGa0O3u7pOU5GifyLOAhG3sc,78202
@@ -66,7 +66,7 @@ modal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
66
  modal/queue.py,sha256=ABXb1eaGBfl5lKh-O60B0wNi0rT7lZ8gCntMOA4piLQ,25801
67
67
  modal/queue.pyi,sha256=XD-VwX9m-lH8Rc4KZXmvuaNZ8f5Sip1clQSTJPdUBZo,37445
68
68
  modal/retries.py,sha256=IvNLDM0f_GLUDD5VgEDoN09C88yoxSrCquinAuxT1Sc,5205
69
- modal/runner.py,sha256=EkEAzZNJyYQa2TNHwCEP0-y_almtOfrfiUoYWv27JGg,25813
69
+ modal/runner.py,sha256=uLpQpIE4lxTKAfmcdFR_OkDUFqdGorbWB4ehxS_Ps7o,25825
70
70
  modal/runner.pyi,sha256=HYBi04nUrZN9-L-cTlvDDHFiJS-N6M3usKk1_QzGnpc,8736
71
71
  modal/running_app.py,sha256=v61mapYNV1-O-Uaho5EfJlryMLvIT9We0amUOSvSGx8,1188
72
72
  modal/sandbox.py,sha256=9XO3d_UV3-FB-KLxak-3jS4YMFZ9mMoi7XMVzayy4dU,49594
@@ -160,7 +160,7 @@ modal/experimental/__init__.py,sha256=ls4ScjJOdCXW0HagDOrNTTnkP4_N7y93HUl10jNDrD
160
160
  modal/experimental/flash.py,sha256=vIZ9qO5-Hb-QViVOAFsY1nfr3vh2yOZQwn-4vTQrOY4,29645
161
161
  modal/experimental/flash.pyi,sha256=26YB9wCeAkjykwFJ4ppmWzVF0L8MJw5VW68w-Wi1-as,16105
162
162
  modal/experimental/ipython.py,sha256=TrCfmol9LGsRZMeDoeMPx3Hv3BFqQhYnmD_iH0pqdhk,2904
163
- modal-1.2.5.dev9.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
163
+ modal-1.2.5.dev11.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
164
164
  modal_docs/__init__.py,sha256=svYKtV8HDwDCN86zbdWqyq5T8sMdGDj0PVlzc2tIxDM,28
165
165
  modal_docs/gen_cli_docs.py,sha256=c1yfBS_x--gL5bs0N4ihMwqwX8l3IBWSkBAKNNIi6bQ,3801
166
166
  modal_docs/gen_reference_docs.py,sha256=d_CQUGQ0rfw28u75I2mov9AlS773z9rG40-yq5o7g2U,6359
@@ -188,10 +188,10 @@ modal_proto/task_command_router_pb2.py,sha256=_pD2ZpU0bNzhwBdzmLoLyLtAtftI_Agxwn
188
188
  modal_proto/task_command_router_pb2.pyi,sha256=EyDgXPLr7alqjXYERV8w_MPuO404x0uCppmSkrfE9IE,14589
189
189
  modal_proto/task_command_router_pb2_grpc.py,sha256=uEQ0HdrCp8v-9bB5yIic9muA8spCShLHY6Bz9cCgOUE,10114
190
190
  modal_proto/task_command_router_pb2_grpc.pyi,sha256=s3Yxsrawdj4nr8vqQqsAxyX6ilWaGbdECy425KKbLIA,3301
191
- modal_version/__init__.py,sha256=ZHyLamwsFXMP7SmvR_XWby5lrQVBaC1K7vYxyG1PxJQ,120
191
+ modal_version/__init__.py,sha256=uyjfSYfYbDG3cRcp_kAxYg8H3JRpRNsPW1avUQEEXBg,121
192
192
  modal_version/__main__.py,sha256=2FO0yYQQwDTh6udt1h-cBnGd1c4ZyHnHSI4BksxzVac,105
193
- modal-1.2.5.dev9.dist-info/METADATA,sha256=FcKbMmq0Arln3ySDv6O130fU8g9HOhDNd-hE0qqKFiA,2489
194
- modal-1.2.5.dev9.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
195
- modal-1.2.5.dev9.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
196
- modal-1.2.5.dev9.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
197
- modal-1.2.5.dev9.dist-info/RECORD,,
193
+ modal-1.2.5.dev11.dist-info/METADATA,sha256=Ll0B1CorfTJRy7-lxcXL1Lb6eWcZ84lBQPmvQKyUPos,2490
194
+ modal-1.2.5.dev11.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
195
+ modal-1.2.5.dev11.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
196
+ modal-1.2.5.dev11.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
197
+ modal-1.2.5.dev11.dist-info/RECORD,,
modal_version/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # Copyright Modal Labs 2025
2
2
  """Supplies the current version of the modal client library."""
3
3
 
4
- __version__ = "1.2.5.dev9"
4
+ __version__ = "1.2.5.dev11"