modal 0.73.31__py3-none-any.whl → 0.73.32__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
@@ -27,7 +27,7 @@ class _Client:
27
27
  _snapshotted: bool
28
28
 
29
29
  def __init__(
30
- self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.73.31"
30
+ self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.73.32"
31
31
  ): ...
32
32
  def is_closed(self) -> bool: ...
33
33
  @property
@@ -85,7 +85,7 @@ class Client:
85
85
  _snapshotted: bool
86
86
 
87
87
  def __init__(
88
- self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.73.31"
88
+ self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.73.32"
89
89
  ): ...
90
90
  def is_closed(self) -> bool: ...
91
91
  @property
modal/functions.pyi CHANGED
@@ -198,11 +198,11 @@ class Function(
198
198
 
199
199
  _call_generator_nowait: ___call_generator_nowait_spec[typing_extensions.Self]
200
200
 
201
- class __remote_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
201
+ class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
202
202
  def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
203
203
  async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
204
204
 
205
- remote: __remote_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
205
+ remote: __remote_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
206
206
 
207
207
  class __remote_gen_spec(typing_extensions.Protocol[SUPERSELF]):
208
208
  def __call__(self, *args, **kwargs) -> typing.Generator[typing.Any, None, None]: ...
@@ -217,19 +217,19 @@ class Function(
217
217
  self, *args: modal._functions.P.args, **kwargs: modal._functions.P.kwargs
218
218
  ) -> modal._functions.OriginalReturnType: ...
219
219
 
220
- class ___experimental_spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
220
+ class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
221
221
  def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
222
222
  async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
223
223
 
224
224
  _experimental_spawn: ___experimental_spawn_spec[
225
- modal._functions.P, modal._functions.ReturnType, typing_extensions.Self
225
+ modal._functions.ReturnType, modal._functions.P, typing_extensions.Self
226
226
  ]
227
227
 
228
- class __spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
228
+ class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
229
229
  def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
230
230
  async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
231
231
 
232
- spawn: __spawn_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
232
+ spawn: __spawn_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
233
233
 
234
234
  def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]: ...
235
235
 
modal/sandbox.py CHANGED
@@ -42,10 +42,28 @@ from .stream_type import StreamType
42
42
  _default_image: _Image = _Image.debian_slim()
43
43
 
44
44
 
45
+ # The maximum number of bytes that can be passed to an exec on Linux.
46
+ # Though this is technically a 'server side' limit, it is unlikely to change.
47
+ # getconf ARG_MAX will show this value on a host.
48
+ ARG_MAX_BYTES = 2_097_152 # 2MiB
49
+
45
50
  if TYPE_CHECKING:
46
51
  import modal.app
47
52
 
48
53
 
54
+ def _validate_exec_args(entrypoint_args: Sequence[str]) -> None:
55
+ # Entrypoint args must be strings.
56
+ if not all(isinstance(arg, str) for arg in entrypoint_args):
57
+ raise InvalidError("All entrypoint arguments must be strings")
58
+ # Avoid "[Errno 7] Argument list too long" errors.
59
+ total_arg_len = sum(len(arg) for arg in entrypoint_args)
60
+ if total_arg_len > ARG_MAX_BYTES:
61
+ raise InvalidError(
62
+ f"Total length of entrypoint arguments must be less than {ARG_MAX_BYTES} bytes (ARG_MAX). "
63
+ f"Got {total_arg_len} bytes."
64
+ )
65
+
66
+
49
67
  class _Sandbox(_Object, type_prefix="sb"):
50
68
  """A `Sandbox` object lets you interact with a running sandbox. This API is similar to Python's
51
69
  [asyncio.subprocess.Process](https://docs.python.org/3/library/asyncio-subprocess.html#asyncio.subprocess.Process).
@@ -245,6 +263,8 @@ class _Sandbox(_Object, type_prefix="sb"):
245
263
  max_sleep_time = 60 * 60 * 24 * 2 # 2 days is plenty since workers roll every 24h
246
264
  entrypoint_args = ("sleep", str(max_sleep_time))
247
265
 
266
+ _validate_exec_args(entrypoint_args)
267
+
248
268
  # TODO(erikbern): Get rid of the `_new` method and create an already-hydrated object
249
269
  obj = _Sandbox._new(
250
270
  entrypoint_args,
@@ -521,6 +541,7 @@ class _Sandbox(_Object, type_prefix="sb"):
521
541
 
522
542
  if workdir is not None and not workdir.startswith("/"):
523
543
  raise InvalidError(f"workdir must be an absolute path, got: {workdir}")
544
+ _validate_exec_args(cmds)
524
545
 
525
546
  # Force secret resolution so we can pass the secret IDs to the backend.
526
547
  secret_coros = [secret.hydrate(client=self._client) for secret in secrets]
modal/sandbox.pyi CHANGED
@@ -25,6 +25,8 @@ import os
25
25
  import typing
26
26
  import typing_extensions
27
27
 
28
+ def _validate_exec_args(entrypoint_args: collections.abc.Sequence[str]) -> None: ...
29
+
28
30
  class _Sandbox(modal._object._Object):
29
31
  _result: typing.Optional[modal_proto.api_pb2.GenericResult]
30
32
  _stdout: modal.io_streams._StreamReader[str]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: modal
3
- Version: 0.73.31
3
+ Version: 0.73.32
4
4
  Summary: Python client library for Modal
5
5
  Author: Modal Labs
6
6
  Author-email: support@modal.com
@@ -22,7 +22,7 @@ modal/app.py,sha256=rCOPD51gVyow8muyaqMuV65qfTnAZKf_w1OCZdSF_6o,44636
22
22
  modal/app.pyi,sha256=0MMCgskIL4r3eq8oBcfm2lLyeao2gXjS3iXaIfmaJ-o,25959
23
23
  modal/call_graph.py,sha256=1g2DGcMIJvRy-xKicuf63IVE98gJSnQsr8R_NVMptNc,2581
24
24
  modal/client.py,sha256=8SQawr7P1PNUCq1UmJMUQXG2jIo4Nmdcs311XqrNLRE,15276
25
- modal/client.pyi,sha256=TT9wOEgIzzEkyCBPOf4iEWhdNqduK3Bg869sRX-lO3Y,7593
25
+ modal/client.pyi,sha256=pxFu0T3BrokSyDj5XWlvDeV8k35RQo60dwVV3PQ5jh0,7593
26
26
  modal/cloud_bucket_mount.py,sha256=YOe9nnvSr4ZbeCn587d7_VhE9IioZYRvF9VYQTQux08,5914
27
27
  modal/cloud_bucket_mount.pyi,sha256=30T3K1a89l6wzmEJ_J9iWv9SknoGqaZDx59Xs-ZQcmk,1607
28
28
  modal/cls.py,sha256=5Er9L9tGpLGIrbiHOI7c9266gPG6nhxoJ_BX8op96nU,31096
@@ -41,7 +41,7 @@ modal/file_io.py,sha256=lcMs_E9Xfm0YX1t9U2wNIBPnqHRxmImqjLW1GHqVmyg,20945
41
41
  modal/file_io.pyi,sha256=NTRft1tbPSWf9TlWVeZmTlgB5AZ_Zhu2srWIrWr7brk,9445
42
42
  modal/file_pattern_matcher.py,sha256=trosX-Bp7dOubudN1bLLhRAoidWy1TcoaR4Pv8CedWw,6497
43
43
  modal/functions.py,sha256=kcNHvqeGBxPI7Cgd57NIBBghkfbeFJzXO44WW0jSmao,325
44
- modal/functions.pyi,sha256=R8aCATbAInu3ujJjWh4kASdTmref8Ysnj3X4Bu77ID0,14255
44
+ modal/functions.pyi,sha256=B6sPrnpt34Z_DVz_5SpHV7NVpfk2nTXuS215Xcu4kK0,14255
45
45
  modal/gpu.py,sha256=Kbhs_u49FaC2Zi0TjCdrpstpRtT5eZgecynmQi5IZVE,6752
46
46
  modal/image.py,sha256=KYc6bg-m9A6wiLF38dWcFBMrEATyR2KOF0sp-6O9uC0,91508
47
47
  modal/image.pyi,sha256=kMkIDHcyyhA7BC2Vrx0RfrLEsqK8Ng2-IqUKL-CJexI,26250
@@ -67,8 +67,8 @@ modal/retries.py,sha256=HKR2Q9aNPWkMjQ5nwobqYTuZaSuw0a8lI2zrtY5IW98,5230
67
67
  modal/runner.py,sha256=fdUyDGN-bWu_aZBvxBO_MIgEuucsA0PgDKDHBn5k8J0,24451
68
68
  modal/runner.pyi,sha256=RYEYsnofrvVroYefWLhWAy8I_uwXV9fRNuJaVgcNzrg,5278
69
69
  modal/running_app.py,sha256=v61mapYNV1-O-Uaho5EfJlryMLvIT9We0amUOSvSGx8,1188
70
- modal/sandbox.py,sha256=fPStBypgDjclm388u5v3q26gAub0mP4c1pZYLlrJcUY,31777
71
- modal/sandbox.pyi,sha256=0E8aEejCcI5ySes0sifpRqIkmI584wiOPNp6J3L6Fs0,22633
70
+ modal/sandbox.py,sha256=Vp-LlqbeRz4HNAFQW2oIh9RlfsurUyp5bKKUuKEGlMQ,32670
71
+ modal/sandbox.pyi,sha256=cLmSwI1ab-2DgEuXNf6S1PiK63wfUR9dHtxlZtSOuX8,22719
72
72
  modal/schedule.py,sha256=0ZFpKs1bOxeo5n3HZjoL7OE2ktsb-_oGtq-WJEPO4tY,2615
73
73
  modal/scheduler_placement.py,sha256=BAREdOY5HzHpzSBqt6jDVR6YC_jYfHMVqOzkyqQfngU,1235
74
74
  modal/secret.py,sha256=U2Jivqdb94eI_BrGCMVbCots8F2gDcbXLMia_gVlej0,10455
@@ -172,10 +172,10 @@ modal_proto/options_pb2_grpc.pyi,sha256=CImmhxHsYnF09iENPoe8S4J-n93jtgUYD2JPAc0y
172
172
  modal_proto/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
173
173
  modal_version/__init__.py,sha256=wiJQ53c-OMs0Xf1UeXOxQ7FwlV1VzIjnX6o-pRYZ_Pk,470
174
174
  modal_version/__main__.py,sha256=2FO0yYQQwDTh6udt1h-cBnGd1c4ZyHnHSI4BksxzVac,105
175
- modal_version/_version_generated.py,sha256=J1oAwbWNkSUn5KRSMgTkUcnTmLQuB4j_XhHlcX7WIuE,149
176
- modal-0.73.31.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
177
- modal-0.73.31.dist-info/METADATA,sha256=40QP2R389PZVjhdg4DKclsWxlXD6G4uA6Xw3jbAV2D0,2330
178
- modal-0.73.31.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
179
- modal-0.73.31.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
180
- modal-0.73.31.dist-info/top_level.txt,sha256=1nvYbOSIKcmU50fNrpnQnrrOpj269ei3LzgB6j9xGqg,64
181
- modal-0.73.31.dist-info/RECORD,,
175
+ modal_version/_version_generated.py,sha256=qB711bhl6L8MqhOCkiWQLqBZrWYWZ-dYKuWSPvtQmec,149
176
+ modal-0.73.32.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
177
+ modal-0.73.32.dist-info/METADATA,sha256=MUHy26_qys8dtiKDfQ_fcHmgDnbWcpgAOWKx0mEqdFw,2330
178
+ modal-0.73.32.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
179
+ modal-0.73.32.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
180
+ modal-0.73.32.dist-info/top_level.txt,sha256=1nvYbOSIKcmU50fNrpnQnrrOpj269ei3LzgB6j9xGqg,64
181
+ modal-0.73.32.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  # Copyright Modal Labs 2025
2
2
 
3
3
  # Note: Reset this value to -1 whenever you make a minor `0.X` release of the client.
4
- build_number = 31 # git: 08cdea1
4
+ build_number = 32 # git: b3dec0b