modal 0.73.142__py3-none-any.whl → 0.73.144__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
@@ -31,7 +31,7 @@ class _Client:
31
31
  server_url: str,
32
32
  client_type: int,
33
33
  credentials: typing.Optional[tuple[str, str]],
34
- version: str = "0.73.142",
34
+ version: str = "0.73.144",
35
35
  ): ...
36
36
  def is_closed(self) -> bool: ...
37
37
  @property
@@ -93,7 +93,7 @@ class Client:
93
93
  server_url: str,
94
94
  client_type: int,
95
95
  credentials: typing.Optional[tuple[str, str]],
96
- version: str = "0.73.142",
96
+ version: str = "0.73.144",
97
97
  ): ...
98
98
  def is_closed(self) -> bool: ...
99
99
  @property
modal/functions.pyi CHANGED
@@ -199,11 +199,11 @@ class Function(
199
199
 
200
200
  _call_generator_nowait: ___call_generator_nowait_spec[typing_extensions.Self]
201
201
 
202
- class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
202
+ class __remote_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
203
203
  def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
204
204
  async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
205
205
 
206
- remote: __remote_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
206
+ remote: __remote_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
207
207
 
208
208
  class __remote_gen_spec(typing_extensions.Protocol[SUPERSELF]):
209
209
  def __call__(self, *args, **kwargs) -> typing.Generator[typing.Any, None, None]: ...
@@ -218,19 +218,19 @@ class Function(
218
218
  self, *args: modal._functions.P.args, **kwargs: modal._functions.P.kwargs
219
219
  ) -> modal._functions.OriginalReturnType: ...
220
220
 
221
- class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
221
+ class ___experimental_spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
222
222
  def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
223
223
  async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
224
224
 
225
225
  _experimental_spawn: ___experimental_spawn_spec[
226
- modal._functions.ReturnType, modal._functions.P, typing_extensions.Self
226
+ modal._functions.P, modal._functions.ReturnType, typing_extensions.Self
227
227
  ]
228
228
 
229
- class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
229
+ class __spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
230
230
  def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
231
231
  async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
232
232
 
233
- spawn: __spawn_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
233
+ spawn: __spawn_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
234
234
 
235
235
  def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]: ...
236
236
 
modal/image.py CHANGED
@@ -285,7 +285,7 @@ def _create_context_mount(
285
285
 
286
286
  return False
287
287
 
288
- return _Mount._add_local_dir(Path("./"), PurePosixPath("/"), ignore=ignore_with_include)
288
+ return _Mount._add_local_dir(context_dir, PurePosixPath("/"), ignore=ignore_with_include)
289
289
 
290
290
 
291
291
  def _create_context_mount_function(
@@ -293,6 +293,7 @@ def _create_context_mount_function(
293
293
  dockerfile_cmds: list[str] = [],
294
294
  dockerfile_path: Optional[Path] = None,
295
295
  context_mount: Optional[_Mount] = None,
296
+ context_dir: Optional[Union[Path, str]] = None,
296
297
  ):
297
298
  if dockerfile_path and dockerfile_cmds:
298
299
  raise InvalidError("Cannot provide both dockerfile and docker commands")
@@ -300,15 +301,19 @@ def _create_context_mount_function(
300
301
  if context_mount:
301
302
  if ignore is not AUTO_DOCKERIGNORE:
302
303
  raise InvalidError("Cannot set both `context_mount` and `ignore`")
304
+ if context_dir is not None:
305
+ raise InvalidError("Cannot set both `context_mount` and `context_dir`")
303
306
 
304
307
  def identity_context_mount_fn() -> Optional[_Mount]:
305
308
  return context_mount
306
309
 
307
310
  return identity_context_mount_fn
311
+
308
312
  elif ignore is AUTO_DOCKERIGNORE:
309
313
 
310
314
  def auto_created_context_mount_fn() -> Optional[_Mount]:
311
- context_dir = Path.cwd()
315
+ nonlocal context_dir
316
+ context_dir = Path.cwd() if context_dir is None else Path(context_dir).absolute()
312
317
  dockerignore_file = find_dockerignore_file(context_dir, dockerfile_path)
313
318
  ignore_fn = (
314
319
  FilePatternMatcher(*dockerignore_file.read_text("utf8").splitlines())
@@ -321,12 +326,16 @@ def _create_context_mount_function(
321
326
 
322
327
  return auto_created_context_mount_fn
323
328
 
324
- def auto_created_context_mount_fn() -> Optional[_Mount]:
325
- # use COPY commands and ignore patterns to construct implicit context mount
326
- cmds = dockerfile_path.read_text("utf8").splitlines() if dockerfile_path else dockerfile_cmds
327
- return _create_context_mount(cmds, ignore_fn=_ignore_fn(ignore), context_dir=Path.cwd())
329
+ else:
330
+
331
+ def auto_created_context_mount_fn() -> Optional[_Mount]:
332
+ # use COPY commands and ignore patterns to construct implicit context mount
333
+ nonlocal context_dir
334
+ context_dir = Path.cwd() if context_dir is None else Path(context_dir).absolute()
335
+ cmds = dockerfile_path.read_text("utf8").splitlines() if dockerfile_path else dockerfile_cmds
336
+ return _create_context_mount(cmds, ignore_fn=_ignore_fn(ignore), context_dir=context_dir)
328
337
 
329
- return auto_created_context_mount_fn
338
+ return auto_created_context_mount_fn
330
339
 
331
340
 
332
341
  class _ImageRegistryConfig:
@@ -1310,6 +1319,7 @@ class _Image(_Object, type_prefix="im"):
1310
1319
  secrets: Sequence[_Secret] = [],
1311
1320
  gpu: GPU_T = None,
1312
1321
  context_mount: Optional[_Mount] = None, # Deprecated: the context is now inferred
1322
+ context_dir: Optional[Union[Path, str]] = None, # Context for relative COPY commands
1313
1323
  force_build: bool = False, # Ignore cached builds, similar to 'docker build --no-cache'
1314
1324
  ignore: Union[Sequence[str], Callable[[Path], bool]] = AUTO_DOCKERIGNORE,
1315
1325
  ) -> "_Image":
@@ -1374,7 +1384,7 @@ class _Image(_Object, type_prefix="im"):
1374
1384
  secrets=secrets,
1375
1385
  gpu_config=parse_gpu_config(gpu),
1376
1386
  context_mount_function=_create_context_mount_function(
1377
- ignore=ignore, dockerfile_cmds=cmds, context_mount=context_mount
1387
+ ignore=ignore, dockerfile_cmds=cmds, context_mount=context_mount, context_dir=context_dir
1378
1388
  ),
1379
1389
  force_build=self.force_build or force_build,
1380
1390
  )
@@ -1709,6 +1719,7 @@ class _Image(_Object, type_prefix="im"):
1709
1719
  # Ignore cached builds, similar to 'docker build --no-cache'
1710
1720
  force_build: bool = False,
1711
1721
  *,
1722
+ context_dir: Optional[Union[Path, str]] = None, # Context for relative COPY commands
1712
1723
  secrets: Sequence[_Secret] = [],
1713
1724
  gpu: GPU_T = None,
1714
1725
  add_python: Optional[str] = None,
@@ -1782,7 +1793,7 @@ class _Image(_Object, type_prefix="im"):
1782
1793
  base_image = _Image._from_args(
1783
1794
  dockerfile_function=build_dockerfile_base,
1784
1795
  context_mount_function=_create_context_mount_function(
1785
- ignore=ignore, dockerfile_path=Path(path), context_mount=context_mount
1796
+ ignore=ignore, dockerfile_path=Path(path), context_mount=context_mount, context_dir=context_dir
1786
1797
  ),
1787
1798
  gpu_config=gpu_config,
1788
1799
  secrets=secrets,
modal/image.pyi CHANGED
@@ -66,6 +66,7 @@ def _create_context_mount_function(
66
66
  dockerfile_cmds: list[str] = [],
67
67
  dockerfile_path: typing.Optional[pathlib.Path] = None,
68
68
  context_mount: typing.Optional[modal.mount._Mount] = None,
69
+ context_dir: typing.Union[pathlib.Path, str, None] = None,
69
70
  ): ...
70
71
 
71
72
  class _ImageRegistryConfig:
@@ -222,6 +223,7 @@ class _Image(modal._object._Object):
222
223
  secrets: collections.abc.Sequence[modal.secret._Secret] = [],
223
224
  gpu: typing.Union[None, str, modal.gpu._GPUConfig] = None,
224
225
  context_mount: typing.Optional[modal.mount._Mount] = None,
226
+ context_dir: typing.Union[pathlib.Path, str, None] = None,
225
227
  force_build: bool = False,
226
228
  ignore: typing.Union[
227
229
  collections.abc.Sequence[str], collections.abc.Callable[[pathlib.Path], bool]
@@ -290,6 +292,7 @@ class _Image(modal._object._Object):
290
292
  context_mount: typing.Optional[modal.mount._Mount] = None,
291
293
  force_build: bool = False,
292
294
  *,
295
+ context_dir: typing.Union[pathlib.Path, str, None] = None,
293
296
  secrets: collections.abc.Sequence[modal.secret._Secret] = [],
294
297
  gpu: typing.Union[None, str, modal.gpu._GPUConfig] = None,
295
298
  add_python: typing.Optional[str] = None,
@@ -482,6 +485,7 @@ class Image(modal.object.Object):
482
485
  secrets: collections.abc.Sequence[modal.secret.Secret] = [],
483
486
  gpu: typing.Union[None, str, modal.gpu._GPUConfig] = None,
484
487
  context_mount: typing.Optional[modal.mount.Mount] = None,
488
+ context_dir: typing.Union[pathlib.Path, str, None] = None,
485
489
  force_build: bool = False,
486
490
  ignore: typing.Union[
487
491
  collections.abc.Sequence[str], collections.abc.Callable[[pathlib.Path], bool]
@@ -550,6 +554,7 @@ class Image(modal.object.Object):
550
554
  context_mount: typing.Optional[modal.mount.Mount] = None,
551
555
  force_build: bool = False,
552
556
  *,
557
+ context_dir: typing.Union[pathlib.Path, str, None] = None,
553
558
  secrets: collections.abc.Sequence[modal.secret.Secret] = [],
554
559
  gpu: typing.Union[None, str, modal.gpu._GPUConfig] = None,
555
560
  add_python: typing.Optional[str] = None,
modal/parallel_map.py CHANGED
@@ -70,10 +70,7 @@ class _OutputValue:
70
70
  value: Any
71
71
 
72
72
 
73
- # maximum number of inputs that can be in progress (either queued to be sent,
74
- # or waiting for completion). if this limit is reached, we will block sending
75
- # more inputs to the server until some of the existing inputs are completed.
76
- MAP_MAX_INPUTS_OUTSTANDING = 1000
73
+ MAX_INPUTS_OUTSTANDING_DEFAULT = 1000
77
74
 
78
75
  # maximum number of inputs to send to the server in a single request
79
76
  MAP_INVOCATION_CHUNK_SIZE = 49
@@ -105,6 +102,9 @@ async def _map_invocation(
105
102
  function_call_jwt = response.function_call_jwt
106
103
  retry_policy = response.retry_policy
107
104
  sync_client_retries_enabled = response.sync_client_retries_enabled
105
+ # The server should always send a value back for max_inputs_outstanding.
106
+ # Falling back to a default just in case something very unexpected happens.
107
+ max_inputs_outstanding = response.max_inputs_outstanding or MAX_INPUTS_OUTSTANDING_DEFAULT
108
108
 
109
109
  have_all_inputs = False
110
110
  inputs_created = 0
@@ -127,7 +127,7 @@ async def _map_invocation(
127
127
  completed_outputs: set[str] = set() # Set of input_ids whose outputs are complete (expecting no more values)
128
128
  input_queue: asyncio.Queue[api_pb2.FunctionPutInputsItem | None] = asyncio.Queue()
129
129
  map_items_manager = _MapItemsManager(
130
- retry_policy, function_call_invocation_type, retry_queue, sync_client_retries_enabled
130
+ retry_policy, function_call_invocation_type, retry_queue, sync_client_retries_enabled, max_inputs_outstanding
131
131
  )
132
132
 
133
133
  async def create_input(argskwargs):
@@ -700,13 +700,17 @@ class _MapItemsManager:
700
700
  retry_policy: api_pb2.FunctionRetryPolicy,
701
701
  function_call_invocation_type: "api_pb2.FunctionCallInvocationType.ValueType",
702
702
  retry_queue: TimestampPriorityQueue,
703
- sync_client_retries_enabled: bool
703
+ sync_client_retries_enabled: bool,
704
+ max_inputs_outstanding: int
705
+
704
706
  ):
705
707
  self._retry_policy = retry_policy
706
708
  self.function_call_invocation_type = function_call_invocation_type
707
709
  self._retry_queue = retry_queue
708
- # semaphore to limit the number of inputs that can be in progress at once
709
- self._inputs_outstanding = asyncio.BoundedSemaphore(MAP_MAX_INPUTS_OUTSTANDING)
710
+ # semaphore to control the maximum number of inputs that can be in progress (either queued to be sent,
711
+ # or waiting for completion). if this limit is reached, we will block sending more inputs to the server
712
+ # until some of the existing inputs are completed.
713
+ self._inputs_outstanding = asyncio.BoundedSemaphore(max_inputs_outstanding)
710
714
  self._item_context: dict[int, _MapItemContext] = {}
711
715
  self._sync_client_retries_enabled = sync_client_retries_enabled
712
716
 
modal/parallel_map.pyi CHANGED
@@ -138,6 +138,7 @@ class _MapItemsManager:
138
138
  function_call_invocation_type: int,
139
139
  retry_queue: modal._utils.async_utils.TimestampPriorityQueue,
140
140
  sync_client_retries_enabled: bool,
141
+ max_inputs_outstanding: int,
141
142
  ): ...
142
143
  async def add_items(self, items: list[modal_proto.api_pb2.FunctionPutInputsItem]): ...
143
144
  async def prepare_items_for_retry(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: modal
3
- Version: 0.73.142
3
+ Version: 0.73.144
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License: Apache-2.0
@@ -23,7 +23,7 @@ modal/app.py,sha256=NKH7Cw1M6eyyrMXFbhWfdo3uRd28-8kv0Pcw56kPiPU,47312
23
23
  modal/app.pyi,sha256=pUEqciyGZ446sc_QoG8XcQ_oc6oU-U4dqjkxjhgOX98,26968
24
24
  modal/call_graph.py,sha256=1g2DGcMIJvRy-xKicuf63IVE98gJSnQsr8R_NVMptNc,2581
25
25
  modal/client.py,sha256=j9D3hNis1lfhnz9lVFGgJgowbH3PaGUzNKgHPWYG778,15372
26
- modal/client.pyi,sha256=BCM6nyI_UUcw2DC2vuM9qp3Q9QH28HJEZ37PzXj4eTM,7661
26
+ modal/client.pyi,sha256=TPAHOAvhShPn02XTJTDuDHKZCGHH4NR5g0cg63AGJn0,7661
27
27
  modal/cloud_bucket_mount.py,sha256=YOe9nnvSr4ZbeCn587d7_VhE9IioZYRvF9VYQTQux08,5914
28
28
  modal/cloud_bucket_mount.pyi,sha256=30T3K1a89l6wzmEJ_J9iWv9SknoGqaZDx59Xs-ZQcmk,1607
29
29
  modal/cls.py,sha256=PJimWA9q_sbQJNLbYy7fzjZGBm_hdfXuuZ7O_pKLXdk,31586
@@ -40,10 +40,10 @@ modal/file_io.py,sha256=lcMs_E9Xfm0YX1t9U2wNIBPnqHRxmImqjLW1GHqVmyg,20945
40
40
  modal/file_io.pyi,sha256=NTRft1tbPSWf9TlWVeZmTlgB5AZ_Zhu2srWIrWr7brk,9445
41
41
  modal/file_pattern_matcher.py,sha256=trosX-Bp7dOubudN1bLLhRAoidWy1TcoaR4Pv8CedWw,6497
42
42
  modal/functions.py,sha256=kcNHvqeGBxPI7Cgd57NIBBghkfbeFJzXO44WW0jSmao,325
43
- modal/functions.pyi,sha256=0Au1n37DimTZVvxCIR7HWALuNGxfJ_fcNR-or37eo5k,14438
43
+ modal/functions.pyi,sha256=PqApQjvICj11NIMEVCmaUIUyJUfEIuY_KkEzCZ4t6iI,14438
44
44
  modal/gpu.py,sha256=Kbhs_u49FaC2Zi0TjCdrpstpRtT5eZgecynmQi5IZVE,6752
45
- modal/image.py,sha256=JVnSSAm7wmull3H_plU-bdPkc4Dx_2EPG_229YJd81U,92174
46
- modal/image.pyi,sha256=DQ4DLOCPr6_yV7z4LS0bTY0rOyvQP9-dQOrzaW7pPG8,25260
45
+ modal/image.py,sha256=5LQt3gqIUg-OCsrNgDBgnGxxjc-qpoKALh7orazzfns,92835
46
+ modal/image.pyi,sha256=iWclz2rxaP-LSsYMgU0X3ZcN5mEFvpyKzIPKJbohmsg,25591
47
47
  modal/io_streams.py,sha256=h5O2LmbRoT9l777z3TQhCAm-JF1r7avZ2ykXlejztDs,15163
48
48
  modal/io_streams.pyi,sha256=bJ7ZLmSmJ0nKoa6r4FJpbqvzdUVa0lEe0Fa-MMpMezU,5071
49
49
  modal/mount.py,sha256=JII0zTS1fPCcCbZgO18okkOuTDqYCxY1DIVa6i1E9cI,32196
@@ -53,8 +53,8 @@ modal/network_file_system.pyi,sha256=4N3eqMbTSlqmS8VV_aJK-uvrgJC8xnf_YtW5FHfRfc8
53
53
  modal/object.py,sha256=bTeskuY8JFrESjU4_UL_nTwYlBQdOLmVaOX3X6EMxsg,164
54
54
  modal/object.pyi,sha256=kyJkRQcVv3ct7zSAxvvXcuhBVeH914v80uSlqeS7cA4,5632
55
55
  modal/output.py,sha256=q4T9uHduunj4NwY-YSwkHGgjZlCXMuJbfQ5UFaAGRAc,1968
56
- modal/parallel_map.py,sha256=AB4YH4ZBGmCOe-X_1kB3hm-kNoRnOxCMzpkTUim4tT8,33586
57
- modal/parallel_map.pyi,sha256=-D_z-K1GOpQcMSUMVHRVLr2rgEA5CXlX6dU5P6msa58,5671
56
+ modal/parallel_map.py,sha256=2d30AM43g8SazkhGbbP1t2sACa4NRqeZrw3JEAqqZDg,33867
57
+ modal/parallel_map.pyi,sha256=mEenHruPiZDq3ucV_6RM8ctc0c_Qpqra5MBagXeHiiQ,5708
58
58
  modal/partial_function.py,sha256=y0h-EvlPnfvZr7nlJLOFk7NB-K-ZO41XJnsGtQTesAI,1200
59
59
  modal/partial_function.pyi,sha256=-xWrvFMhLT6ulx9B82u1g8kL69vt3nYAvp8pV0d__uw,5407
60
60
  modal/proxy.py,sha256=NrOevrWxG3G7-zlyRzG6BcIvop7AWLeyahZxitbBaOk,1418
@@ -170,10 +170,10 @@ modal_proto/options_pb2_grpc.pyi,sha256=CImmhxHsYnF09iENPoe8S4J-n93jtgUYD2JPAc0y
170
170
  modal_proto/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
171
171
  modal_version/__init__.py,sha256=wiJQ53c-OMs0Xf1UeXOxQ7FwlV1VzIjnX6o-pRYZ_Pk,470
172
172
  modal_version/__main__.py,sha256=2FO0yYQQwDTh6udt1h-cBnGd1c4ZyHnHSI4BksxzVac,105
173
- modal_version/_version_generated.py,sha256=gjIWC1jTVRMVU8UBLDDBBgEilqkQn5dwbC7UsB5cb8M,150
174
- modal-0.73.142.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
175
- modal-0.73.142.dist-info/METADATA,sha256=aR9ASz69bJHSvqH7EQqdMOgnTEJATwKaUy2-GielRP0,2453
176
- modal-0.73.142.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
177
- modal-0.73.142.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
178
- modal-0.73.142.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
179
- modal-0.73.142.dist-info/RECORD,,
173
+ modal_version/_version_generated.py,sha256=oP8FBwJ_HKXD6yAhf1l_IrgPeFJSa6ZQvwv4tNoQVCI,150
174
+ modal-0.73.144.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
175
+ modal-0.73.144.dist-info/METADATA,sha256=w8KwgQdaRx180ZIspfveM_SM3EGHff-v9LndELGyNqA,2453
176
+ modal-0.73.144.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
177
+ modal-0.73.144.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
178
+ modal-0.73.144.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
179
+ modal-0.73.144.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 = 142 # git: a537dcd
4
+ build_number = 144 # git: d3f70c8