modal 0.73.143__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.143",
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.143",
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,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: modal
3
- Version: 0.73.143
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=CfDyx-Nfu0CC1bs8CypPA7qvaTvjCabL-FpRgUm6cog,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
@@ -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=Swo3V9IveICUpIFVpIVccS8muTG9yF2vONXjcIswZwg,150
174
- modal-0.73.143.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
175
- modal-0.73.143.dist-info/METADATA,sha256=RIQlD3ToI9VKKHLrS0I7OnNSeHbBVL6WfzoINs9kuZA,2453
176
- modal-0.73.143.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
177
- modal-0.73.143.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
178
- modal-0.73.143.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
179
- modal-0.73.143.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 = 143 # git: 1eee221
4
+ build_number = 144 # git: d3f70c8