modAL 1.4.3.dev20__py3-none-any.whl → 1.4.3.dev22__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.
@@ -40,10 +40,19 @@ def extract_copy_command_patterns(dockerfile_lines: Sequence[str]) -> list[str]:
40
40
 
41
41
  # COPY --from=... commands reference external sources and do not need a context mount.
42
42
  # https://docs.docker.com/reference/dockerfile/#copy---from
43
- if parts[0].startswith("--from="):
43
+ if any(p.startswith("--from=") for p in parts):
44
44
  current_command = ""
45
45
  continue
46
46
 
47
+ # Strip known COPY flags (--chmod, --chown, --link) before processing sources.
48
+ known_flag_prefixes = ("--chmod=", "--chown=", "--link=")
49
+ parts = [
50
+ p
51
+ for p in parts
52
+ # link has a special handling - it can be "--link" or like "--link=true"
53
+ if p != "--link" and not any(p.startswith(prefix) for prefix in known_flag_prefixes)
54
+ ]
55
+
47
56
  if len(parts) >= 2:
48
57
  # Last part is destination, everything else is a mount source
49
58
  sources = parts[:-1]
modal/cli/environment.py CHANGED
@@ -67,7 +67,8 @@ def list_(json: bool = False):
67
67
  def create(name: str, restricted: bool = False):
68
68
  check_environment_name(name)
69
69
  Environment.objects.create(name, restricted=restricted)
70
- rich.print(f"[green]✓[/green] Environment created: {name}")
70
+ prefix = "Restricted " if restricted else ""
71
+ rich.print(f"[green]✓[/green] {prefix}Environment created: {name}")
71
72
 
72
73
 
73
74
  ENVIRONMENT_DELETE_HELP = """Delete an environment in the current workspace.
modal/client.pyi CHANGED
@@ -35,7 +35,7 @@ class _Client:
35
35
  server_url: str,
36
36
  client_type: int,
37
37
  credentials: typing.Optional[tuple[str, str]],
38
- version: str = "1.4.3.dev20",
38
+ version: str = "1.4.3.dev22",
39
39
  ):
40
40
  """mdmd:hidden
41
41
  The Modal client object is not intended to be instantiated directly by users.
@@ -175,7 +175,7 @@ class Client:
175
175
  server_url: str,
176
176
  client_type: int,
177
177
  credentials: typing.Optional[tuple[str, str]],
178
- version: str = "1.4.3.dev20",
178
+ version: str = "1.4.3.dev22",
179
179
  ):
180
180
  """mdmd:hidden
181
181
  The Modal client object is not intended to be instantiated directly by users.
modal/functions.pyi CHANGED
@@ -347,7 +347,7 @@ class Function(
347
347
 
348
348
  _call_generator: ___call_generator_spec
349
349
 
350
- class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
350
+ class __remote_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
351
351
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER:
352
352
  """Calls the function remotely, executing it with the given arguments and returning the execution's result."""
353
353
  ...
@@ -356,7 +356,7 @@ class Function(
356
356
  """Calls the function remotely, executing it with the given arguments and returning the execution's result."""
357
357
  ...
358
358
 
359
- remote: __remote_spec[modal._functions.ReturnType, modal._functions.P]
359
+ remote: __remote_spec[modal._functions.P, modal._functions.ReturnType]
360
360
 
361
361
  class __remote_gen_spec(typing_extensions.Protocol):
362
362
  def __call__(self, /, *args, **kwargs) -> typing.Generator[typing.Any, None, None]:
@@ -383,7 +383,7 @@ class Function(
383
383
  """
384
384
  ...
385
385
 
386
- class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
386
+ class ___experimental_spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
387
387
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
388
388
  """[Experimental] Calls the function with the given arguments, without waiting for the results.
389
389
 
@@ -406,7 +406,7 @@ class Function(
406
406
  """
407
407
  ...
408
408
 
409
- _experimental_spawn: ___experimental_spawn_spec[modal._functions.ReturnType, modal._functions.P]
409
+ _experimental_spawn: ___experimental_spawn_spec[modal._functions.P, modal._functions.ReturnType]
410
410
 
411
411
  class ___spawn_map_inner_spec(typing_extensions.Protocol[P_INNER]):
412
412
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> None: ...
@@ -414,7 +414,7 @@ class Function(
414
414
 
415
415
  _spawn_map_inner: ___spawn_map_inner_spec[modal._functions.P]
416
416
 
417
- class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
417
+ class __spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
418
418
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
419
419
  """Calls the function with the given arguments, without waiting for the results.
420
420
 
@@ -435,7 +435,7 @@ class Function(
435
435
  """
436
436
  ...
437
437
 
438
- spawn: __spawn_spec[modal._functions.ReturnType, modal._functions.P]
438
+ spawn: __spawn_spec[modal._functions.P, modal._functions.ReturnType]
439
439
 
440
440
  def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]:
441
441
  """Return the inner Python object wrapped by this Modal Function."""
modal/image.py CHANGED
@@ -24,7 +24,7 @@ from typing import (
24
24
  import typing_extensions
25
25
  from google.protobuf.message import Message
26
26
  from grpclib.exceptions import StreamTerminatedError
27
- from typing_extensions import Self
27
+ from typing_extensions import Concatenate, Self
28
28
 
29
29
  from modal._serialization import serialize_data_format
30
30
  from modal_proto import api_pb2
@@ -101,6 +101,8 @@ Use {replacement} instead, which is functionally and performance-wise equivalent
101
101
  See https://modal.com/docs/guide/modal-1-0-migration for more details.
102
102
  """
103
103
 
104
+ P = typing_extensions.ParamSpec("P")
105
+
104
106
 
105
107
  def _validate_python_version(
106
108
  python_version: Optional[str],
@@ -2480,6 +2482,32 @@ class _Image(_Object, type_prefix="im"):
2480
2482
 
2481
2483
  return self.dockerfile_commands(dockerfile_cmd)
2482
2484
 
2485
+ def pipe(
2486
+ self,
2487
+ func: Callable[Concatenate["_Image", P], "_Image"],
2488
+ *args: P.args,
2489
+ **kwargs: P.kwargs,
2490
+ ) -> "_Image":
2491
+ """Apply a local function to expand the Image recipe.
2492
+
2493
+ This method can be useful for defining reusable Image build
2494
+ recipes that compose well with the fluent Image builder interface.
2495
+
2496
+ **Example**
2497
+
2498
+ ```python
2499
+ def workspace_setup(image: modal.Image, repo: str) -> modal.Image:
2500
+ return image.run_commands(f"git clone {repo}").uv_pip_install(".")
2501
+
2502
+ image = (
2503
+ modal.Image.debian_slim()
2504
+ .apt_install("git")
2505
+ .pipe(workspace_setup, "https://github.com/example/repo.git")
2506
+ )
2507
+ ```
2508
+ """
2509
+ return func(self, *args, **kwargs)
2510
+
2483
2511
  # Live handle methods
2484
2512
 
2485
2513
  @contextlib.contextmanager
modal/image.pyi CHANGED
@@ -29,6 +29,8 @@ class _AutoDockerIgnoreSentinel:
29
29
 
30
30
  AUTO_DOCKERIGNORE: _AutoDockerIgnoreSentinel
31
31
 
32
+ P = typing_extensions.ParamSpec("P")
33
+
32
34
  def _validate_python_version(
33
35
  python_version: typing.Optional[str],
34
36
  builder_version: typing.Literal["2023.12", "2024.04", "2024.10", "2025.06", "PREVIEW"],
@@ -1041,6 +1043,32 @@ class _Image(modal._object._Object):
1041
1043
  """
1042
1044
  ...
1043
1045
 
1046
+ def pipe(
1047
+ self,
1048
+ func: collections.abc.Callable[typing_extensions.Concatenate[_Image, P], _Image],
1049
+ *args: P.args,
1050
+ **kwargs: P.kwargs,
1051
+ ) -> _Image:
1052
+ """Apply a local function to expand the Image recipe.
1053
+
1054
+ This method can be useful for defining reusable Image build
1055
+ recipes that compose well with the fluent Image builder interface.
1056
+
1057
+ **Example**
1058
+
1059
+ ```python
1060
+ def workspace_setup(image: modal.Image, repo: str) -> modal.Image:
1061
+ return image.run_commands(f"git clone {repo}").uv_pip_install(".")
1062
+
1063
+ image = (
1064
+ modal.Image.debian_slim()
1065
+ .apt_install("git")
1066
+ .pipe(workspace_setup, "https://github.com/example/repo.git")
1067
+ )
1068
+ ```
1069
+ """
1070
+ ...
1071
+
1044
1072
  def imports(self):
1045
1073
  """Used to import packages in global scope that are only available when running remotely.
1046
1074
  By using this context manager you can avoid an `ImportError` due to not having certain
@@ -2038,6 +2066,32 @@ class Image(modal.object.Object):
2038
2066
  """
2039
2067
  ...
2040
2068
 
2069
+ def pipe(
2070
+ self,
2071
+ func: collections.abc.Callable[typing_extensions.Concatenate[Image, P], Image],
2072
+ *args: P.args,
2073
+ **kwargs: P.kwargs,
2074
+ ) -> Image:
2075
+ """Apply a local function to expand the Image recipe.
2076
+
2077
+ This method can be useful for defining reusable Image build
2078
+ recipes that compose well with the fluent Image builder interface.
2079
+
2080
+ **Example**
2081
+
2082
+ ```python
2083
+ def workspace_setup(image: modal.Image, repo: str) -> modal.Image:
2084
+ return image.run_commands(f"git clone {repo}").uv_pip_install(".")
2085
+
2086
+ image = (
2087
+ modal.Image.debian_slim()
2088
+ .apt_install("git")
2089
+ .pipe(workspace_setup, "https://github.com/example/repo.git")
2090
+ )
2091
+ ```
2092
+ """
2093
+ ...
2094
+
2041
2095
  def imports(self):
2042
2096
  """Used to import packages in global scope that are only available when running remotely.
2043
2097
  By using this context manager you can avoid an `ImportError` due to not having certain
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 1.4.3.dev20
3
+ Version: 1.4.3.dev22
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License-Expression: Apache-2.0
@@ -27,7 +27,7 @@ modal/app.pyi,sha256=-9667eLtUgoinLTRrJ-Z3SOgMR0S89Qw_vpwEZfp2Pk,53910
27
27
  modal/billing.py,sha256=B2zXa7KeMnpqi2AQINycEk-KSXVYaLTTTAQTtuf2Gfs,257
28
28
  modal/call_graph.py,sha256=1g2DGcMIJvRy-xKicuf63IVE98gJSnQsr8R_NVMptNc,2581
29
29
  modal/client.py,sha256=jjT4eLFHGcvIF6Xw4kPptIx-VmExtphRN8XJ1JA7fWI,15502
30
- modal/client.pyi,sha256=AG2_H3M98oFAac8SKnQdSLYxYmtQuROzyxvA2siq84I,15703
30
+ modal/client.pyi,sha256=YOTWsO3zKjYIKksljRAtkugSIY9WCCDTybpuURepglQ,15703
31
31
  modal/cloud_bucket_mount.py,sha256=KkaJVy5vpO_u2NtDYtv1JM-M3y4J0UtWBapTDKpQRcA,6034
32
32
  modal/cloud_bucket_mount.pyi,sha256=mGDeEd1XvxGpCE6O5jRBSfIvMXvZ5AtIybea5k-0w9w,7560
33
33
  modal/cls.py,sha256=Yrl5b_tQhZMhc5avInM-i5UlGuqeog6Gs4rX2d9lLjI,40390
@@ -44,9 +44,9 @@ modal/file_io.py,sha256=DYQXrPUNkKG-0lyzc81E3rh7g56Fg5y6eIQkTqhfqbU,22015
44
44
  modal/file_io.pyi,sha256=DPaq0BhySaiCX3g56QHhyIMdU1izbfWsjpSp30JoJUU,15745
45
45
  modal/file_pattern_matcher.py,sha256=A_Kdkej6q7YQyhM_2-BvpFmPqJ0oHb54B6yf9VqvPVE,8116
46
46
  modal/functions.py,sha256=EZRcHFfnoYbvawUJnAHF5nIvoo9GX2Djy7mUmOCXmXc,258
47
- modal/functions.pyi,sha256=_sZ27MFClkElRg0iyVXmn9pGXwm9F-r49sHjrYhH4Sg,34255
48
- modal/image.py,sha256=Gsj05uwX84bY2xkTWuv2Wbfz_6iGySezvlAEJzVIZx4,112580
49
- modal/image.pyi,sha256=zYiJsc5tEhGev_rT9R3cGpyQJf-Hm08OJl37sV4E_fk,79377
47
+ modal/functions.pyi,sha256=m2uNU9DMi9LWprk9PJykCM1Zs_oEG2-Vl2FaJMGSNpY,34255
48
+ modal/image.py,sha256=K-105RcY39Kq8uC4toG6WOMTnAVlPn_6P8J_DiNxiyQ,113430
49
+ modal/image.pyi,sha256=FUAY23rnaUmpRBVazrzh3Z3b9tYTMikbyk2SbuIpihI,81004
50
50
  modal/io_streams.py,sha256=JcYbvvjMZFugv53yHc9Id0N4nIvDMwV63ZtnN1bPmZc,30940
51
51
  modal/io_streams.pyi,sha256=aBxCcbHTprL08FLvPlkzu4bypCTT7xUdelNe5kc7OZY,18506
52
52
  modal/mount.py,sha256=1inCkNfb5IyXEIVyenpdPwPGFWLPTwf6zgABln025ew,34749
@@ -111,7 +111,7 @@ modal/_utils/blob_utils.py,sha256=d9ZBhSt-BXNJy-xpOjyZDD050-b_ORnGSUVhJCpXq08,25
111
111
  modal/_utils/browser_utils.py,sha256=Yqq0qU4Id6oaDOdeT1JEmbCN7vj4baNJJraJhRWU8ZI,1085
112
112
  modal/_utils/bytes_io_segment_payload.py,sha256=vaXPq8b52-x6G2hwE7SrjS58pg_aRm7gV3bn3yjmTzQ,4261
113
113
  modal/_utils/deprecation.py,sha256=i97J-n82xI2tKFsNF77Iqv5-gDgNLWJHwmyxui3ZhR4,4547
114
- modal/_utils/docker_utils.py,sha256=h1uETghR40mp_y3fSWuZAfbIASH1HMzuphJHghAL6DU,3722
114
+ modal/_utils/docker_utils.py,sha256=4dTcYtT3fWg5aCax7YKOBktRDoK0YWAfHiw555Q7nSU,4204
115
115
  modal/_utils/function_utils.py,sha256=5NTus-Nd9uT6frNA9C6I_QUjnXgrrc_P2tIi1gjCPsU,24717
116
116
  modal/_utils/git_utils.py,sha256=qtUU6JAttF55ZxYq51y55OR58B0tDPZsZWK5dJe6W5g,3182
117
117
  modal/_utils/grpc_testing.py,sha256=fZLyfMA5VYmIo-dUCcKQrVCH3ZKPT7K4_6ww373jt0Y,8697
@@ -156,7 +156,7 @@ modal/cli/container.py,sha256=iK8wVsM7tWaIKTOiDUlRNK-McnZFRQOlb6Kqrm7_zUM,12212
156
156
  modal/cli/dashboard.py,sha256=u3HzFNb4BgSBTW8ve034XNO0Tdt_z5P1kr8RcGFMxcw,941
157
157
  modal/cli/dict.py,sha256=S1bN8fakoxlnAUMhYlRACM7iTP2PuNLGQ8kQnWgMS9M,5088
158
158
  modal/cli/entry_point.py,sha256=0g7C_BGDg6GPJSCKEOty9GPGXhkjlRI6UoP9oZVQdDI,4647
159
- modal/cli/environment.py,sha256=ZSve0YKywgYp5Pf-MGuIaPUIsMmo1ZHJkcNbV1C0jQ4,6855
159
+ modal/cli/environment.py,sha256=3W__Nqj5beXq4rx-NfeHIIzmHlqRQ2dHO6NOA-E8mpE,6912
160
160
  modal/cli/import_refs.py,sha256=XjJpEovHzXt3xDF0CdRK-9R148M7esnq6gyGz0X4mQM,15559
161
161
  modal/cli/launch.py,sha256=ccqO0fS0xnXpBQDqdiguKhFLJWDM9sukVYiDwmi9mkA,4516
162
162
  modal/cli/logo.py,sha256=plv82syvPb8j3qrR1A_nojZwp823t3VEXaDlrx1jkt0,3221
@@ -177,7 +177,7 @@ modal/experimental/__init__.py,sha256=Wb1YoAKAnNxH_0c2wA0T12I7bSu9PSO2nS_LuLska7
177
177
  modal/experimental/flash.py,sha256=ATGhVO8AleJ-TOe2PGolI5T7zfCEtj0kl_ivMPp7Rqg,33362
178
178
  modal/experimental/flash.pyi,sha256=R4h2nQl7-oiwqq_twCp0YqID_LnPjPGqxywXvxbiLIk,17011
179
179
  modal/experimental/ipython.py,sha256=TrCfmol9LGsRZMeDoeMPx3Hv3BFqQhYnmD_iH0pqdhk,2904
180
- modal-1.4.3.dev20.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
180
+ modal-1.4.3.dev22.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
181
181
  modal_docs/__init__.py,sha256=svYKtV8HDwDCN86zbdWqyq5T8sMdGDj0PVlzc2tIxDM,28
182
182
  modal_docs/gen_cli_docs.py,sha256=bfUSLscHfoQoKkKjIqJvQMe3fURzqcQK7gF1h9WQLtM,3742
183
183
  modal_docs/gen_cli_docs_main.py,sha256=UPGr7O1DYTIRLwfINe2rbdh89J3cPVTU1OWL-SjxnOQ,198
@@ -188,8 +188,8 @@ modal_docs/mdmd/mdmd.py,sha256=z9T3lMktTq3N4r6T6MSSyw8lebbqKc3Igw8l9EdMJNM,9998
188
188
  modal_docs/mdmd/signatures.py,sha256=XJaZrK7Mdepk5fdX51A8uENiLFNil85Ud0d4MH8H5f0,3218
189
189
  modal_proto/__init__.py,sha256=MIEP8jhXUeGq_eCjYFcqN5b1bxBM4fdk0VESpjWR0fc,28
190
190
  modal_proto/api_grpc.py,sha256=H4Z21x81592KlGzgDIcgltk5WixY5vs5EyOH8Q89wvA,153140
191
- modal_proto/api_pb2.py,sha256=P09tScxAvEid1BbXBAxC_N_IZJ7EpjfpFIub-RMgOHU,424105
192
- modal_proto/api_pb2.pyi,sha256=pcSsNAvaMCnzTwzl8uGm75FY4wlx7yvV32r9iVoL_EM,593732
191
+ modal_proto/api_pb2.py,sha256=c0NQd6BfKIoXJFl5lh1lYDSYIl0uZID77nY8M2FiTb4,424149
192
+ modal_proto/api_pb2.pyi,sha256=bp1EfIDDxVzRjXG-iziUHZJfoi2wlKCvChg6NBUYk4k,593892
193
193
  modal_proto/api_pb2_grpc.py,sha256=dWnojBtfuaqHvBos1FL-JMNEB7LsNHM1UGUpKXO5IFY,329867
194
194
  modal_proto/api_pb2_grpc.pyi,sha256=qDqqKIs18olWaoBjLOJ8Z6Gn8_GjpNn3Z1Pw1yG_M4I,77024
195
195
  modal_proto/modal_api_grpc.py,sha256=bBPhTehvCriGANMHxXNxKa58ew_2QbSvO88zhKCr4CE,24177
@@ -199,10 +199,10 @@ modal_proto/task_command_router_pb2.py,sha256=6TY5umHeqYdFNuRaOoZP2YfUbtCxRHqyi2
199
199
  modal_proto/task_command_router_pb2.pyi,sha256=PYljoZVw16_d4Hn-9cD6SDssmYsvVqx_HOgEEUGYBLk,31452
200
200
  modal_proto/task_command_router_pb2_grpc.py,sha256=XVmcdxLnK_IY3trlF6nLmzFhqSG-bbYNABC7xIs6fT8,28732
201
201
  modal_proto/task_command_router_pb2_grpc.pyi,sha256=og_J8CxYeAV0ikpHXZMvr_uC15UD3I3fgyyAO2pGm1E,8981
202
- modal_version/__init__.py,sha256=RI763JGSMNFaL5G9olas6cDpWUs2vqtiLrGltEJCE8c,121
202
+ modal_version/__init__.py,sha256=_wDGul1YyU6J-p-w8JU9D77KNysIoNNafBBYT6aIkoE,121
203
203
  modal_version/__main__.py,sha256=nLUbubxKx7GXNzJIkTB7M7_u8080LyLM0IS0rzFkC_c,119
204
- modal-1.4.3.dev20.dist-info/METADATA,sha256=V-5wUJcLBjqouhHu-RE68yO4M5jnaD4aWjjJpHO3ma8,2339
205
- modal-1.4.3.dev20.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
206
- modal-1.4.3.dev20.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
207
- modal-1.4.3.dev20.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
208
- modal-1.4.3.dev20.dist-info/RECORD,,
204
+ modal-1.4.3.dev22.dist-info/METADATA,sha256=kqGI3ohDG8Evpd3N3ugaV9_NOTIDKpH1NEEKuGJPv0Q,2339
205
+ modal-1.4.3.dev22.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
206
+ modal-1.4.3.dev22.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
207
+ modal-1.4.3.dev22.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
208
+ modal-1.4.3.dev22.dist-info/RECORD,,