modal 0.67.45__py3-none-any.whl → 0.67.46__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.py CHANGED
@@ -27,7 +27,7 @@ from ._utils import async_utils
27
27
  from ._utils.async_utils import TaskContext, synchronize_api
28
28
  from ._utils.grpc_utils import connect_channel, create_channel, retry_transient_errors
29
29
  from .config import _check_config, _is_remote, config, logger
30
- from .exception import AuthError, ClientClosed, ConnectionError, DeprecationError, VersionError
30
+ from .exception import AuthError, ClientClosed, ConnectionError, VersionError
31
31
 
32
32
  HEARTBEAT_INTERVAL: float = config.get("heartbeat_interval")
33
33
  HEARTBEAT_TIMEOUT: float = HEARTBEAT_INTERVAL + 0.1
@@ -139,15 +139,12 @@ class _Client:
139
139
  logger.debug(f"Client ({id(self)}): Starting")
140
140
  try:
141
141
  req = empty_pb2.Empty()
142
- resp = await retry_transient_errors(
142
+ await retry_transient_errors(
143
143
  self.stub.ClientHello,
144
144
  req,
145
145
  attempt_timeout=CLIENT_CREATE_ATTEMPT_TIMEOUT,
146
146
  total_timeout=CLIENT_CREATE_TOTAL_TIMEOUT,
147
147
  )
148
- if resp.warning:
149
- ALARM_EMOJI = chr(0x1F6A8)
150
- warnings.warn_explicit(f"{ALARM_EMOJI} {resp.warning} {ALARM_EMOJI}", DeprecationError, "<unknown>", 0)
151
148
  except GRPCError as exc:
152
149
  if exc.status == Status.FAILED_PRECONDITION:
153
150
  raise VersionError(
modal/client.pyi CHANGED
@@ -26,7 +26,7 @@ class _Client:
26
26
  _stub: typing.Optional[modal_proto.api_grpc.ModalClientStub]
27
27
 
28
28
  def __init__(
29
- self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.67.45"
29
+ self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.67.46"
30
30
  ): ...
31
31
  def is_closed(self) -> bool: ...
32
32
  @property
@@ -81,7 +81,7 @@ class Client:
81
81
  _stub: typing.Optional[modal_proto.api_grpc.ModalClientStub]
82
82
 
83
83
  def __init__(
84
- self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.67.45"
84
+ self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.67.46"
85
85
  ): ...
86
86
  def is_closed(self) -> bool: ...
87
87
  @property
modal/cls.py CHANGED
@@ -18,11 +18,8 @@ from ._utils.async_utils import synchronize_api, synchronizer
18
18
  from ._utils.grpc_utils import retry_transient_errors
19
19
  from ._utils.mount_utils import validate_volumes
20
20
  from .client import _Client
21
- from .exception import InvalidError, NotFoundError, VersionError
22
- from .functions import (
23
- _Function,
24
- _parse_retries,
25
- )
21
+ from .exception import InvalidError, NotFoundError, VersionError, print_server_warnings
22
+ from .functions import _Function, _parse_retries
26
23
  from .gpu import GPU_T
27
24
  from .object import _get_environment_name, _Object
28
25
  from .partial_function import (
@@ -486,6 +483,8 @@ class _Cls(_Object, type_prefix="cs"):
486
483
  else:
487
484
  raise
488
485
 
486
+ print_server_warnings(response.server_warnings)
487
+
489
488
  class_function_tag = f"{tag}.*" # special name of the base service function for the class
490
489
 
491
490
  class_service_function = _Function.from_name(
modal/exception.py CHANGED
@@ -4,6 +4,9 @@ import signal
4
4
  import sys
5
5
  import warnings
6
6
  from datetime import date
7
+ from typing import Iterable
8
+
9
+ from modal_proto import api_pb2
7
10
 
8
11
 
9
12
  class Error(Exception):
@@ -213,3 +216,12 @@ class ModuleNotMountable(Exception):
213
216
 
214
217
  class ClientClosed(Error):
215
218
  pass
219
+
220
+
221
+ def print_server_warnings(server_warnings: Iterable[api_pb2.Warning]):
222
+ # TODO(erikbern): move this to modal._utils.deprecation
223
+ for warning in server_warnings:
224
+ if warning.type == api_pb2.Warning.WARNING_TYPE_CLIENT_DEPRECATION:
225
+ warnings.warn_explicit(warning.message, DeprecationError, "<unknown>", 0)
226
+ else:
227
+ warnings.warn_explicit(warning.message, UserWarning, "<unknown>", 0)
modal/functions.py CHANGED
@@ -64,6 +64,7 @@ from .exception import (
64
64
  NotFoundError,
65
65
  OutputExpiredError,
66
66
  deprecation_warning,
67
+ print_server_warnings,
67
68
  )
68
69
  from .gpu import GPU_T, parse_gpu_config
69
70
  from .image import _Image
@@ -1061,6 +1062,8 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
1061
1062
  else:
1062
1063
  raise
1063
1064
 
1065
+ print_server_warnings(response.server_warnings)
1066
+
1064
1067
  self._hydrate(response.function_id, resolver.client, response.handle_metadata)
1065
1068
 
1066
1069
  rep = f"Ref({app_name})"
modal/functions.pyi CHANGED
@@ -455,11 +455,11 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
455
455
 
456
456
  _call_generator_nowait: ___call_generator_nowait_spec
457
457
 
458
- class __remote_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
458
+ class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
459
459
  def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
460
460
  async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
461
461
 
462
- remote: __remote_spec[P, ReturnType]
462
+ remote: __remote_spec[ReturnType, P]
463
463
 
464
464
  class __remote_gen_spec(typing_extensions.Protocol):
465
465
  def __call__(self, *args, **kwargs) -> typing.Generator[typing.Any, None, None]: ...
@@ -471,17 +471,17 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
471
471
  def _get_obj(self) -> typing.Optional[modal.cls.Obj]: ...
472
472
  def local(self, *args: P.args, **kwargs: P.kwargs) -> OriginalReturnType: ...
473
473
 
474
- class ___experimental_spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
474
+ class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
475
475
  def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
476
476
  async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
477
477
 
478
- _experimental_spawn: ___experimental_spawn_spec[P, ReturnType]
478
+ _experimental_spawn: ___experimental_spawn_spec[ReturnType, P]
479
479
 
480
- class __spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
480
+ class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
481
481
  def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
482
482
  async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
483
483
 
484
- spawn: __spawn_spec[P, ReturnType]
484
+ spawn: __spawn_spec[ReturnType, P]
485
485
 
486
486
  def get_raw_f(self) -> typing.Callable[..., typing.Any]: ...
487
487
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: modal
3
- Version: 0.67.45
3
+ Version: 0.67.46
4
4
  Summary: Python client library for Modal
5
5
  Author: Modal Labs
6
6
  Author-email: support@modal.com
@@ -18,11 +18,11 @@ modal/_watcher.py,sha256=K6LYnlmSGQB4tWWI9JADv-tvSvQ1j522FwT71B51CX8,3584
18
18
  modal/app.py,sha256=EJ7FUN6rWnSwLJoYJh8nmKg_t-8hdN8_rt0OrkP7JvQ,46084
19
19
  modal/app.pyi,sha256=BE5SlR5tRECuc6-e2lUuOknDdov3zxgZ4N0AsLb5ZVQ,25270
20
20
  modal/call_graph.py,sha256=1g2DGcMIJvRy-xKicuf63IVE98gJSnQsr8R_NVMptNc,2581
21
- modal/client.py,sha256=cmylZhU35txmrx4nltNYuuqXRgeoMtm0ow1J9wJkEYQ,16400
22
- modal/client.pyi,sha256=y8nXEuVZfpdltIFALC-93zNmAP_8s-EQ45UUzvsF-zc,7354
21
+ modal/client.py,sha256=aLZvv10NPNQAzmF8o7gCT1CgTElZCFct4ANg05ohAzA,16183
22
+ modal/client.pyi,sha256=b3-MwPdUfIRHJTmkRwZBX3DYBjBa8W30HSJZpwTv0DM,7354
23
23
  modal/cloud_bucket_mount.py,sha256=G7T7jWLD0QkmrfKR75mSTwdUZ2xNfj7pkVqb4ipmxmI,5735
24
24
  modal/cloud_bucket_mount.pyi,sha256=CEi7vrH3kDUF4LAy4qP6tfImy2UJuFRcRbsgRNM1wo8,1403
25
- modal/cls.py,sha256=OJqzj_V-n1g48BY_4Jg_BOTQdftEEl4kTWN0X4FOOdg,27378
25
+ modal/cls.py,sha256=FirmKYI_9SjomwplqYzhpaBAeHjn7NcjokB8uwVmKls,27449
26
26
  modal/cls.pyi,sha256=47jaIT06fz8PSUrs-MaNn6r03PHsAyUGsKuK5e9RMhQ,8140
27
27
  modal/config.py,sha256=1KhNJkjYsJkX1V8RPPdRYPlM2HE-ZZs0JVSxbiXjmrw,11010
28
28
  modal/container_process.py,sha256=zDxCLk6KfJT1G9FfNtjom6gekBQ46op3TWepT7-Hkbg,6077
@@ -31,10 +31,10 @@ modal/dict.py,sha256=RmJlEwFJOdSfAYcVa50hbbFccV8e7BvC5tc5g1HXF-c,12622
31
31
  modal/dict.pyi,sha256=2cYgOqBxYZih4BYgMV0c3rNPuxYR6-cB1GBXzFkHA5c,7265
32
32
  modal/environments.py,sha256=5cgA-zbm6ngKLsRA19zSOgtgo9-BarJK3FJK0BiF2Lo,6505
33
33
  modal/environments.pyi,sha256=XalNpiPkAtHWAvOU2Cotq0ozmtl-Jv0FDsR8h9mr27Q,3521
34
- modal/exception.py,sha256=EBkdWVved2XEPsXaoPRu56xfxFFHL9iuqvUsdj42WDA,6392
34
+ modal/exception.py,sha256=hgAtpD4jvbjLc-gA1pet4hrj9MJMAcpzldaDRVX9zW8,6879
35
35
  modal/experimental.py,sha256=jFuNbwrNHos47viMB9q-cHJSvf2RDxDdoEcss9plaZE,2302
36
- modal/functions.py,sha256=3GjjFbf40XciWAa4rTmh0erkZjPzRjKHqWxUu91mHOU,66685
37
- modal/functions.pyi,sha256=IyuM9TV79JfrtfTaJ4yq3EcWp3yHuxLavpxTOwSWEDw,24988
36
+ modal/functions.py,sha256=vJK0AOZ11PhSb8dqp8UokIJofTyHl31IC6MguM6qC_g,66773
37
+ modal/functions.pyi,sha256=4k5CaJ9iTuEyHQ2rC5OysNHBLv1CZrD7zBMU1zXIU4w,24988
38
38
  modal/gpu.py,sha256=r4rL6uH3UJIQthzYvfWauXNyh01WqCPtKZCmmSX1fd4,6881
39
39
  modal/image.py,sha256=cQ6WP1xHXZT_nY8z3aEFiGwKzrTV0yxi3Ab8JzF91eo,79653
40
40
  modal/image.pyi,sha256=PIKH6JBA4L5TfdJrQu3pm2ykyIITmiP920TpP8cdyQA,24585
@@ -159,10 +159,10 @@ modal_proto/options_pb2_grpc.pyi,sha256=CImmhxHsYnF09iENPoe8S4J-n93jtgUYD2JPAc0y
159
159
  modal_proto/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
160
160
  modal_version/__init__.py,sha256=3IY-AWLH55r35_mQXIaut0jrJvoPuf1NZJBQQfSbPuo,470
161
161
  modal_version/__main__.py,sha256=2FO0yYQQwDTh6udt1h-cBnGd1c4ZyHnHSI4BksxzVac,105
162
- modal_version/_version_generated.py,sha256=-VFiF4qacxYMf0vhJMpp_zoDFmrwsxYeuuEwC_srSyU,149
163
- modal-0.67.45.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
164
- modal-0.67.45.dist-info/METADATA,sha256=DPnf58e8tR6Otli4VYsyIQgtY329ncBkTRIaMp-Nvf0,2329
165
- modal-0.67.45.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
166
- modal-0.67.45.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
167
- modal-0.67.45.dist-info/top_level.txt,sha256=1nvYbOSIKcmU50fNrpnQnrrOpj269ei3LzgB6j9xGqg,64
168
- modal-0.67.45.dist-info/RECORD,,
162
+ modal_version/_version_generated.py,sha256=pjgSs4CUHp9hTXomUdMFNTRsfsGVvp6o72NElEE4tHQ,149
163
+ modal-0.67.46.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
164
+ modal-0.67.46.dist-info/METADATA,sha256=PHYR8Qz3pB0AUuCuTdgYLEQ3y5pbX-LvxM2naPhVuVk,2329
165
+ modal-0.67.46.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
166
+ modal-0.67.46.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
167
+ modal-0.67.46.dist-info/top_level.txt,sha256=1nvYbOSIKcmU50fNrpnQnrrOpj269ei3LzgB6j9xGqg,64
168
+ modal-0.67.46.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  # Copyright Modal Labs 2024
2
2
 
3
3
  # Note: Reset this value to -1 whenever you make a minor `0.X` release of the client.
4
- build_number = 45 # git: 3e8e42d
4
+ build_number = 46 # git: 3fa1b34