modal 0.67.46__py3-none-any.whl → 0.67.47__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/_traceback.py CHANGED
@@ -1,16 +1,21 @@
1
1
  # Copyright Modal Labs 2022
2
- """Helper functions related to operating on traceback objects.
2
+ """Helper functions related to operating on exceptions, warnings, and traceback objects.
3
3
 
4
4
  Functions related to *displaying* tracebacks should go in `modal/cli/_traceback.py`
5
5
  so that Rich is not a dependency of the container Client.
6
6
  """
7
+
7
8
  import re
8
9
  import sys
9
10
  import traceback
11
+ import warnings
10
12
  from types import TracebackType
11
- from typing import Any, Optional
13
+ from typing import Any, Iterable, Optional
14
+
15
+ from modal_proto import api_pb2
12
16
 
13
17
  from ._vendor.tblib import Traceback as TBLibTraceback
18
+ from .exception import ServerWarning
14
19
 
15
20
  TBDictType = dict[str, Any]
16
21
  LineCacheType = dict[tuple[str, str], str]
@@ -109,3 +114,12 @@ def print_exception(exc: Optional[type[BaseException]], value: Optional[BaseExce
109
114
  if sys.version_info < (3, 11) and value is not None:
110
115
  notes = getattr(value, "__notes__", [])
111
116
  print(*notes, sep="\n", file=sys.stderr)
117
+
118
+
119
+ def print_server_warnings(server_warnings: Iterable[api_pb2.Warning]):
120
+ """Issue a warning originating from the server with empty metadata about local origin.
121
+
122
+ When using the Modal CLI, these warnings should get caught and coerced into Rich panels.
123
+ """
124
+ for warning in server_warnings:
125
+ warnings.warn_explicit(warning.message, ServerWarning, "<modal-server>", 0)
modal/cli/_traceback.py CHANGED
@@ -1,5 +1,6 @@
1
1
  # Copyright Modal Labs 2024
2
2
  """Helper functions related to displaying tracebacks in the CLI."""
3
+
3
4
  import functools
4
5
  import re
5
6
  import warnings
@@ -11,7 +12,7 @@ from rich.syntax import Syntax
11
12
  from rich.text import Text
12
13
  from rich.traceback import PathHighlighter, Stack, Traceback, install
13
14
 
14
- from ..exception import DeprecationError, PendingDeprecationError
15
+ from ..exception import DeprecationError, PendingDeprecationError, ServerWarning
15
16
 
16
17
 
17
18
  @group()
@@ -165,7 +166,7 @@ def highlight_modal_deprecation_warnings() -> None:
165
166
  base_showwarning = warnings.showwarning
166
167
 
167
168
  def showwarning(warning, category, filename, lineno, file=None, line=None):
168
- if issubclass(category, (DeprecationError, PendingDeprecationError)):
169
+ if issubclass(category, (DeprecationError, PendingDeprecationError, ServerWarning)):
169
170
  content = str(warning)
170
171
  if re.match(r"^\d{4}-\d{2}-\d{2}", content):
171
172
  date = content[:10]
@@ -180,10 +181,16 @@ def highlight_modal_deprecation_warnings() -> None:
180
181
  except OSError:
181
182
  # e.g., when filename is "<unknown>"; raises FileNotFoundError on posix but OSError on windows
182
183
  pass
184
+ if issubclass(category, ServerWarning):
185
+ title = "Modal Warning"
186
+ else:
187
+ title = "Modal Deprecation Warning"
188
+ if date:
189
+ title += f" ({date})"
183
190
  panel = Panel(
184
191
  message,
185
- style="yellow",
186
- title=f"Modal Deprecation Warning ({date})" if date else "Modal Deprecation Warning",
192
+ border_style="yellow",
193
+ title=title,
187
194
  title_align="left",
188
195
  )
189
196
  Console().print(panel)
modal/cli/run.py CHANGED
@@ -13,8 +13,6 @@ from typing import Any, Callable, Optional, get_type_hints
13
13
 
14
14
  import click
15
15
  import typer
16
- from rich.console import Console
17
- from rich.panel import Panel
18
16
  from typing_extensions import TypedDict
19
17
 
20
18
  from .. import Cls
@@ -306,14 +304,7 @@ def deploy(
306
304
  if name is None:
307
305
  name = app.name
308
306
 
309
- with enable_output():
310
- res = deploy_app(app, name=name, environment_name=env or "", tag=tag)
311
- if res.warnings:
312
- console = Console()
313
- for warning in res.warnings:
314
- panel = Panel(warning, title="Warning", title_align="left", border_style="yellow")
315
- console.print(panel, highlight=False)
316
-
307
+ res = deploy_app(app, name=name, environment_name=env or "", tag=tag)
317
308
  if stream_logs:
318
309
  stream_app_logs(app_id=res.app_id, app_logs_url=res.app_logs_url)
319
310
 
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.46"
29
+ self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.67.47"
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.46"
84
+ self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.67.47"
85
85
  ): ...
86
86
  def is_closed(self) -> bool: ...
87
87
  @property
modal/cls.py CHANGED
@@ -14,11 +14,12 @@ from modal_proto import api_pb2
14
14
  from ._resolver import Resolver
15
15
  from ._resources import convert_fn_config_to_resources_config
16
16
  from ._serialization import check_valid_cls_constructor_arg
17
+ from ._traceback import print_server_warnings
17
18
  from ._utils.async_utils import synchronize_api, synchronizer
18
19
  from ._utils.grpc_utils import retry_transient_errors
19
20
  from ._utils.mount_utils import validate_volumes
20
21
  from .client import _Client
21
- from .exception import InvalidError, NotFoundError, VersionError, print_server_warnings
22
+ from .exception import InvalidError, NotFoundError, VersionError
22
23
  from .functions import _Function, _parse_retries
23
24
  from .gpu import GPU_T
24
25
  from .object import _get_environment_name, _Object
modal/exception.py CHANGED
@@ -110,6 +110,10 @@ class PendingDeprecationError(UserWarning):
110
110
  """Soon to be deprecated feature. Only used intermittently because of multi-repo concerns."""
111
111
 
112
112
 
113
+ class ServerWarning(UserWarning):
114
+ """Warning originating from the Modal server and re-issued in client code."""
115
+
116
+
113
117
  class _CliUserExecutionError(Exception):
114
118
  """mdmd:hidden
115
119
  Private wrapper for exceptions during when importing or running stubs from the CLI.
modal/functions.py CHANGED
@@ -32,6 +32,7 @@ from ._resolver import Resolver
32
32
  from ._resources import convert_fn_config_to_resources_config
33
33
  from ._runtime.execution_context import current_input_id, is_local
34
34
  from ._serialization import serialize, serialize_proto_params
35
+ from ._traceback import print_server_warnings
35
36
  from ._utils.async_utils import (
36
37
  TaskContext,
37
38
  async_merge,
@@ -64,7 +65,6 @@ from .exception import (
64
65
  NotFoundError,
65
66
  OutputExpiredError,
66
67
  deprecation_warning,
67
- print_server_warnings,
68
68
  )
69
69
  from .gpu import GPU_T, parse_gpu_config
70
70
  from .image import _Image
modal/runner.py CHANGED
@@ -17,7 +17,7 @@ from modal_proto import api_pb2
17
17
  from ._pty import get_pty_info
18
18
  from ._resolver import Resolver
19
19
  from ._runtime.execution_context import is_local
20
- from ._traceback import traceback_contains_remote_call
20
+ from ._traceback import print_server_warnings, traceback_contains_remote_call
21
21
  from ._utils.async_utils import TaskContext, gather_cancel_on_exc, synchronize_api
22
22
  from ._utils.grpc_utils import retry_transient_errors
23
23
  from ._utils.name_utils import check_object_name, is_valid_tag
@@ -206,6 +206,7 @@ async def _publish_app(
206
206
  raise InvalidError(exc.message)
207
207
  raise
208
208
 
209
+ print_server_warnings(response.server_warnings)
209
210
  return response.url, response.server_warnings
210
211
 
211
212
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: modal
3
- Version: 0.67.46
3
+ Version: 0.67.47
4
4
  Summary: Python client library for Modal
5
5
  Author: Modal Labs
6
6
  Author-email: support@modal.com
@@ -11,7 +11,7 @@ modal/_pty.py,sha256=JZfPDDpzqICZqtyPI_oMJf_9w-p_lLNuzHhwhodUXio,1329
11
11
  modal/_resolver.py,sha256=TtowKu2LdZ7NpiYkSXs058BZ4ivY8KVYdchqLfREkiA,6775
12
12
  modal/_resources.py,sha256=5qmcirXUI8dSH926nwkUaeX9H25mqYu9mXD_KuT79-o,1733
13
13
  modal/_serialization.py,sha256=qPLH6OUEBas1CT-a6i5pOP1hPGt5AfKr9q7RMUTFOMc,18722
14
- modal/_traceback.py,sha256=tueIGN5DbPaQlo23F-GrFMjl-HpDxBxfSAkqjU39zwg,4389
14
+ modal/_traceback.py,sha256=orZ7rsCk9ekV7ZoFjZTH_H00azCypwRKaLh0MZb1dR8,4898
15
15
  modal/_tunnel.py,sha256=o-jJhS4vQ6-XswDhHcJWGMZZmD03SC0e9i8fEu1JTjo,6310
16
16
  modal/_tunnel.pyi,sha256=JmmDYAy9F1FpgJ_hWx0xkom2nTOFQjn4mTPYlU3PFo4,1245
17
17
  modal/_watcher.py,sha256=K6LYnlmSGQB4tWWI9JADv-tvSvQ1j522FwT71B51CX8,3584
@@ -19,10 +19,10 @@ 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
21
  modal/client.py,sha256=aLZvv10NPNQAzmF8o7gCT1CgTElZCFct4ANg05ohAzA,16183
22
- modal/client.pyi,sha256=b3-MwPdUfIRHJTmkRwZBX3DYBjBa8W30HSJZpwTv0DM,7354
22
+ modal/client.pyi,sha256=kCSi7pkC4olHh9Ss-Pw1O64drwgyvASCqXYokdHdS8I,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=FirmKYI_9SjomwplqYzhpaBAeHjn7NcjokB8uwVmKls,27449
25
+ modal/cls.py,sha256=pMirIOmb59YzaIK2rn7Vd756E1QKDDweYT90GYIHiMk,27472
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,9 +31,9 @@ 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=hgAtpD4jvbjLc-gA1pet4hrj9MJMAcpzldaDRVX9zW8,6879
34
+ modal/exception.py,sha256=eSQZ0u1z-RPMW9x6AGMySi-LWyqkTtjZM-RnvhyfWWQ,6997
35
35
  modal/experimental.py,sha256=jFuNbwrNHos47viMB9q-cHJSvf2RDxDdoEcss9plaZE,2302
36
- modal/functions.py,sha256=vJK0AOZ11PhSb8dqp8UokIJofTyHl31IC6MguM6qC_g,66773
36
+ modal/functions.py,sha256=Z2g1CuDTz_491ReOJKs66qGlodPDpKAiKHVwARL2zYA,66792
37
37
  modal/functions.pyi,sha256=4k5CaJ9iTuEyHQ2rC5OysNHBLv1CZrD7zBMU1zXIU4w,24988
38
38
  modal/gpu.py,sha256=r4rL6uH3UJIQthzYvfWauXNyh01WqCPtKZCmmSX1fd4,6881
39
39
  modal/image.py,sha256=cQ6WP1xHXZT_nY8z3aEFiGwKzrTV0yxi3Ab8JzF91eo,79653
@@ -57,7 +57,7 @@ modal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
57
  modal/queue.py,sha256=fJYFfpdrlVj_doc3QxgvJvv7c8BGHjjja5q_9HCtSqs,18658
58
58
  modal/queue.pyi,sha256=di3ownBw4jc6d4X7ygXtbpjlUMOK69qyaD3lVsJbpoM,9900
59
59
  modal/retries.py,sha256=HKR2Q9aNPWkMjQ5nwobqYTuZaSuw0a8lI2zrtY5IW98,5230
60
- modal/runner.py,sha256=bGTOGmbAodyJvuoZo9XuK8mCU9vopDgjWXlZaN_DT6Y,24505
60
+ modal/runner.py,sha256=Q02VdfLCO7YKpnOSqqh58XL3hR2XHaDeiJVYW3MKz_8,24580
61
61
  modal/runner.pyi,sha256=BvMS1ZVzWSn8B8q0KnIZOJKPkN5L-i5b-USbV6SWWHQ,5177
62
62
  modal/running_app.py,sha256=CshNvGDJtagOdKW54uYjY8HY73j2TpnsL9jkPFZAsfA,560
63
63
  modal/sandbox.py,sha256=Yd__KipEINH2euDPOcm5MPBnagRv19Sa5z5tJCvGOQs,26360
@@ -101,7 +101,7 @@ modal/_vendor/cloudpickle.py,sha256=Loq12qo7PBNbE4LFVEW6BdMMwY10MG94EOW1SCpcnQ0,
101
101
  modal/_vendor/tblib.py,sha256=g1O7QUDd3sDoLd8YPFltkXkih7r_fyZOjgmGuligv3s,9722
102
102
  modal/cli/__init__.py,sha256=waLjl5c6IPDhSsdWAm9Bji4e2PVxamYABKAze6CHVXY,28
103
103
  modal/cli/_download.py,sha256=t6BXZwjTd9MgznDvbsV8rp0FZWggdzC-lUAGZU4xx1g,3984
104
- modal/cli/_traceback.py,sha256=Tm0g4V_fr4XAlmuh_4MNgZKtjJly9wsWtnKKvOJFM7Q,7130
104
+ modal/cli/_traceback.py,sha256=QlLa_iw3fAOA-mqCqjS8qAxvNT48J3YY3errtVVc2cw,7316
105
105
  modal/cli/app.py,sha256=KOU3tKdcw50612rmN2LmO-N8cT1M1-UgLs7tw68Kgds,7717
106
106
  modal/cli/config.py,sha256=pXPLmX0bIoV57rQNqIPK7V-yllj-GPRY4jiBO_EklGg,1667
107
107
  modal/cli/container.py,sha256=nCySVD10VJPzmX3ghTsGmpxdYeVYYMW6ofjsyt2gQcM,3667
@@ -113,7 +113,7 @@ modal/cli/launch.py,sha256=uyI-ouGvYRjHLGxGQ2lYBZq32BiRT1i0L8ksz5iy7K8,2935
113
113
  modal/cli/network_file_system.py,sha256=3QbAxKEoRc6RCMsYE3OS-GcuiI4GMkz_wAKsIBbN1qg,8186
114
114
  modal/cli/profile.py,sha256=rLXfjJObfPNjaZvNfHGIKqs7y9bGYyGe-K7V0w-Ni0M,3110
115
115
  modal/cli/queues.py,sha256=MIh2OsliNE2QeL1erubfsRsNuG4fxqcqWA2vgIfQ4Mg,4494
116
- modal/cli/run.py,sha256=MitoSFA_QaqkIVjBRi91w1ekz6UlCwL3htE3_RI3yjA,17353
116
+ modal/cli/run.py,sha256=RrlGrWFCfKY3ihviBwUMyvBiosUWtfxe2BN56CB4xpc,17009
117
117
  modal/cli/secret.py,sha256=uQpwYrMY98iMCWeZOQTcktOYhPTZ8IHnyealDc2CZqo,4206
118
118
  modal/cli/token.py,sha256=mxSgOWakXG6N71hQb1ko61XAR9ZGkTMZD-Txn7gmTac,1924
119
119
  modal/cli/utils.py,sha256=hZmjyzcPjDnQSkLvycZD2LhGdcsfdZshs_rOU78EpvI,3717
@@ -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=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,,
162
+ modal_version/_version_generated.py,sha256=qtSNSDiEoxsg_ECGv99Dy3iDFgiHUqYwpknhUJqJZhE,149
163
+ modal-0.67.47.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
164
+ modal-0.67.47.dist-info/METADATA,sha256=C1l6wnl5jd7fbVeXvbFG_ZQnjIDMbAEaKWTSFsEgOEQ,2329
165
+ modal-0.67.47.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
166
+ modal-0.67.47.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
167
+ modal-0.67.47.dist-info/top_level.txt,sha256=1nvYbOSIKcmU50fNrpnQnrrOpj269ei3LzgB6j9xGqg,64
168
+ modal-0.67.47.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 = 46 # git: 3fa1b34
4
+ build_number = 47 # git: a3d399f