modal 1.0.3.dev10__py3-none-any.whl → 1.2.3.dev7__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.

Potentially problematic release.


This version of modal might be problematic. Click here for more details.

Files changed (160) hide show
  1. modal/__init__.py +0 -2
  2. modal/__main__.py +3 -4
  3. modal/_billing.py +80 -0
  4. modal/_clustered_functions.py +7 -3
  5. modal/_clustered_functions.pyi +15 -3
  6. modal/_container_entrypoint.py +51 -69
  7. modal/_functions.py +508 -240
  8. modal/_grpc_client.py +171 -0
  9. modal/_load_context.py +105 -0
  10. modal/_object.py +81 -21
  11. modal/_output.py +58 -45
  12. modal/_partial_function.py +48 -73
  13. modal/_pty.py +7 -3
  14. modal/_resolver.py +26 -46
  15. modal/_runtime/asgi.py +4 -3
  16. modal/_runtime/container_io_manager.py +358 -220
  17. modal/_runtime/container_io_manager.pyi +296 -101
  18. modal/_runtime/execution_context.py +18 -2
  19. modal/_runtime/execution_context.pyi +64 -7
  20. modal/_runtime/gpu_memory_snapshot.py +262 -57
  21. modal/_runtime/user_code_imports.py +28 -58
  22. modal/_serialization.py +90 -6
  23. modal/_traceback.py +42 -1
  24. modal/_tunnel.pyi +380 -12
  25. modal/_utils/async_utils.py +84 -29
  26. modal/_utils/auth_token_manager.py +111 -0
  27. modal/_utils/blob_utils.py +181 -58
  28. modal/_utils/deprecation.py +19 -0
  29. modal/_utils/function_utils.py +91 -47
  30. modal/_utils/grpc_utils.py +89 -66
  31. modal/_utils/mount_utils.py +26 -1
  32. modal/_utils/name_utils.py +17 -3
  33. modal/_utils/task_command_router_client.py +536 -0
  34. modal/_utils/time_utils.py +34 -6
  35. modal/app.py +256 -88
  36. modal/app.pyi +909 -92
  37. modal/billing.py +5 -0
  38. modal/builder/2025.06.txt +18 -0
  39. modal/builder/PREVIEW.txt +18 -0
  40. modal/builder/base-images.json +58 -0
  41. modal/cli/_download.py +19 -3
  42. modal/cli/_traceback.py +3 -2
  43. modal/cli/app.py +4 -4
  44. modal/cli/cluster.py +15 -7
  45. modal/cli/config.py +5 -3
  46. modal/cli/container.py +7 -6
  47. modal/cli/dict.py +22 -16
  48. modal/cli/entry_point.py +12 -5
  49. modal/cli/environment.py +5 -4
  50. modal/cli/import_refs.py +3 -3
  51. modal/cli/launch.py +102 -5
  52. modal/cli/network_file_system.py +11 -12
  53. modal/cli/profile.py +3 -2
  54. modal/cli/programs/launch_instance_ssh.py +94 -0
  55. modal/cli/programs/run_jupyter.py +1 -1
  56. modal/cli/programs/run_marimo.py +95 -0
  57. modal/cli/programs/vscode.py +1 -1
  58. modal/cli/queues.py +57 -26
  59. modal/cli/run.py +91 -23
  60. modal/cli/secret.py +48 -22
  61. modal/cli/token.py +7 -8
  62. modal/cli/utils.py +4 -7
  63. modal/cli/volume.py +31 -25
  64. modal/client.py +15 -85
  65. modal/client.pyi +183 -62
  66. modal/cloud_bucket_mount.py +5 -3
  67. modal/cloud_bucket_mount.pyi +197 -5
  68. modal/cls.py +200 -126
  69. modal/cls.pyi +446 -68
  70. modal/config.py +29 -11
  71. modal/container_process.py +319 -19
  72. modal/container_process.pyi +190 -20
  73. modal/dict.py +290 -71
  74. modal/dict.pyi +835 -83
  75. modal/environments.py +15 -27
  76. modal/environments.pyi +46 -24
  77. modal/exception.py +14 -2
  78. modal/experimental/__init__.py +194 -40
  79. modal/experimental/flash.py +618 -0
  80. modal/experimental/flash.pyi +380 -0
  81. modal/experimental/ipython.py +11 -7
  82. modal/file_io.py +29 -36
  83. modal/file_io.pyi +251 -53
  84. modal/file_pattern_matcher.py +56 -16
  85. modal/functions.pyi +673 -92
  86. modal/gpu.py +1 -1
  87. modal/image.py +528 -176
  88. modal/image.pyi +1572 -145
  89. modal/io_streams.py +458 -128
  90. modal/io_streams.pyi +433 -52
  91. modal/mount.py +216 -151
  92. modal/mount.pyi +225 -78
  93. modal/network_file_system.py +45 -62
  94. modal/network_file_system.pyi +277 -56
  95. modal/object.pyi +93 -17
  96. modal/parallel_map.py +942 -129
  97. modal/parallel_map.pyi +294 -15
  98. modal/partial_function.py +0 -2
  99. modal/partial_function.pyi +234 -19
  100. modal/proxy.py +17 -8
  101. modal/proxy.pyi +36 -3
  102. modal/queue.py +270 -65
  103. modal/queue.pyi +817 -57
  104. modal/runner.py +115 -101
  105. modal/runner.pyi +205 -49
  106. modal/sandbox.py +512 -136
  107. modal/sandbox.pyi +845 -111
  108. modal/schedule.py +1 -1
  109. modal/secret.py +300 -70
  110. modal/secret.pyi +589 -34
  111. modal/serving.py +7 -11
  112. modal/serving.pyi +7 -8
  113. modal/snapshot.py +11 -8
  114. modal/snapshot.pyi +25 -4
  115. modal/token_flow.py +4 -4
  116. modal/token_flow.pyi +28 -8
  117. modal/volume.py +416 -158
  118. modal/volume.pyi +1117 -121
  119. {modal-1.0.3.dev10.dist-info → modal-1.2.3.dev7.dist-info}/METADATA +10 -9
  120. modal-1.2.3.dev7.dist-info/RECORD +195 -0
  121. modal_docs/mdmd/mdmd.py +17 -4
  122. modal_proto/api.proto +534 -79
  123. modal_proto/api_grpc.py +337 -1
  124. modal_proto/api_pb2.py +1522 -968
  125. modal_proto/api_pb2.pyi +1619 -134
  126. modal_proto/api_pb2_grpc.py +699 -4
  127. modal_proto/api_pb2_grpc.pyi +226 -14
  128. modal_proto/modal_api_grpc.py +175 -154
  129. modal_proto/sandbox_router.proto +145 -0
  130. modal_proto/sandbox_router_grpc.py +105 -0
  131. modal_proto/sandbox_router_pb2.py +149 -0
  132. modal_proto/sandbox_router_pb2.pyi +333 -0
  133. modal_proto/sandbox_router_pb2_grpc.py +203 -0
  134. modal_proto/sandbox_router_pb2_grpc.pyi +75 -0
  135. modal_proto/task_command_router.proto +144 -0
  136. modal_proto/task_command_router_grpc.py +105 -0
  137. modal_proto/task_command_router_pb2.py +149 -0
  138. modal_proto/task_command_router_pb2.pyi +333 -0
  139. modal_proto/task_command_router_pb2_grpc.py +203 -0
  140. modal_proto/task_command_router_pb2_grpc.pyi +75 -0
  141. modal_version/__init__.py +1 -1
  142. modal/requirements/PREVIEW.txt +0 -16
  143. modal/requirements/base-images.json +0 -26
  144. modal-1.0.3.dev10.dist-info/RECORD +0 -179
  145. modal_proto/modal_options_grpc.py +0 -3
  146. modal_proto/options.proto +0 -19
  147. modal_proto/options_grpc.py +0 -3
  148. modal_proto/options_pb2.py +0 -35
  149. modal_proto/options_pb2.pyi +0 -20
  150. modal_proto/options_pb2_grpc.py +0 -4
  151. modal_proto/options_pb2_grpc.pyi +0 -7
  152. /modal/{requirements → builder}/2023.12.312.txt +0 -0
  153. /modal/{requirements → builder}/2023.12.txt +0 -0
  154. /modal/{requirements → builder}/2024.04.txt +0 -0
  155. /modal/{requirements → builder}/2024.10.txt +0 -0
  156. /modal/{requirements → builder}/README.md +0 -0
  157. {modal-1.0.3.dev10.dist-info → modal-1.2.3.dev7.dist-info}/WHEEL +0 -0
  158. {modal-1.0.3.dev10.dist-info → modal-1.2.3.dev7.dist-info}/entry_points.txt +0 -0
  159. {modal-1.0.3.dev10.dist-info → modal-1.2.3.dev7.dist-info}/licenses/LICENSE +0 -0
  160. {modal-1.0.3.dev10.dist-info → modal-1.2.3.dev7.dist-info}/top_level.txt +0 -0
@@ -1,3 +1,4 @@
1
+ import modal._utils.task_command_router_client
1
2
  import modal.client
2
3
  import modal.io_streams
3
4
  import modal.stream_type
@@ -6,11 +7,32 @@ import typing_extensions
6
7
 
7
8
  T = typing.TypeVar("T")
8
9
 
9
- class _ContainerProcess(typing.Generic[T]):
10
+ class _ContainerProcessThroughServer(typing.Generic[T]):
11
+ """Abstract base class for generic types.
12
+
13
+ A generic type is typically declared by inheriting from
14
+ this class parameterized with one or more type variables.
15
+ For example, a generic mapping type might be defined as::
16
+
17
+ class Mapping(Generic[KT, VT]):
18
+ def __getitem__(self, key: KT) -> VT:
19
+ ...
20
+ # Etc.
21
+
22
+ This class can then be used as follows::
23
+
24
+ def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
25
+ try:
26
+ return mapping[key]
27
+ except KeyError:
28
+ return default
29
+ """
30
+
10
31
  _process_id: typing.Optional[str]
11
32
  _stdout: modal.io_streams._StreamReader[T]
12
33
  _stderr: modal.io_streams._StreamReader[T]
13
34
  _stdin: modal.io_streams._StreamWriter
35
+ _exec_deadline: typing.Optional[float]
14
36
  _text: bool
15
37
  _by_line: bool
16
38
  _returncode: typing.Optional[int]
@@ -18,13 +40,82 @@ class _ContainerProcess(typing.Generic[T]):
18
40
  def __init__(
19
41
  self,
20
42
  process_id: str,
43
+ task_id: str,
21
44
  client: modal.client._Client,
22
45
  stdout: modal.stream_type.StreamType = modal.stream_type.StreamType.PIPE,
23
46
  stderr: modal.stream_type.StreamType = modal.stream_type.StreamType.PIPE,
47
+ exec_deadline: typing.Optional[float] = None,
24
48
  text: bool = True,
25
49
  by_line: bool = False,
26
- ) -> None: ...
27
- def __repr__(self) -> str: ...
50
+ ) -> None:
51
+ """Initialize self. See help(type(self)) for accurate signature."""
52
+ ...
53
+
54
+ def __repr__(self) -> str:
55
+ """Return repr(self)."""
56
+ ...
57
+
58
+ @property
59
+ def stdout(self) -> modal.io_streams._StreamReader[T]:
60
+ """StreamReader for the container process's stdout stream."""
61
+ ...
62
+
63
+ @property
64
+ def stderr(self) -> modal.io_streams._StreamReader[T]:
65
+ """StreamReader for the container process's stderr stream."""
66
+ ...
67
+
68
+ @property
69
+ def stdin(self) -> modal.io_streams._StreamWriter:
70
+ """StreamWriter for the container process's stdin stream."""
71
+ ...
72
+
73
+ @property
74
+ def returncode(self) -> int: ...
75
+ async def poll(self) -> typing.Optional[int]:
76
+ """Check if the container process has finished running.
77
+
78
+ Returns `None` if the process is still running, else returns the exit code.
79
+ """
80
+ ...
81
+
82
+ async def _wait_for_completion(self) -> int: ...
83
+ async def wait(self) -> int:
84
+ """Wait for the container process to finish running. Returns the exit code."""
85
+ ...
86
+
87
+ async def attach(self):
88
+ """mdmd:hidden"""
89
+ ...
90
+
91
+ def _iter_stream_as_bytes(stream: modal.io_streams._StreamReader[T]):
92
+ """Yield raw bytes from a StreamReader regardless of text mode/backend."""
93
+ ...
94
+
95
+ class _ContainerProcessThroughCommandRouter(typing.Generic[T]):
96
+ """Container process implementation that works via direct communication with
97
+ the Modal worker where the container is running.
98
+ """
99
+ def __init__(
100
+ self,
101
+ process_id: str,
102
+ client: modal.client._Client,
103
+ command_router_client: modal._utils.task_command_router_client.TaskCommandRouterClient,
104
+ task_id: str,
105
+ *,
106
+ stdout: modal.stream_type.StreamType = modal.stream_type.StreamType.PIPE,
107
+ stderr: modal.stream_type.StreamType = modal.stream_type.StreamType.PIPE,
108
+ exec_deadline: typing.Optional[float] = None,
109
+ text: bool = True,
110
+ by_line: bool = False,
111
+ ) -> None:
112
+ """Initialize self. See help(type(self)) for accurate signature."""
113
+ ...
114
+
115
+ def __repr__(self) -> str:
116
+ """Return repr(self)."""
117
+ ...
118
+
28
119
  @property
29
120
  def stdout(self) -> modal.io_streams._StreamReader[T]: ...
30
121
  @property
@@ -37,50 +128,129 @@ class _ContainerProcess(typing.Generic[T]):
37
128
  async def wait(self) -> int: ...
38
129
  async def attach(self): ...
39
130
 
131
+ class _ContainerProcess(typing.Generic[T]):
132
+ """Represents a running process in a container."""
133
+ def __init__(
134
+ self,
135
+ process_id: str,
136
+ task_id: str,
137
+ client: modal.client._Client,
138
+ stdout: modal.stream_type.StreamType = modal.stream_type.StreamType.PIPE,
139
+ stderr: modal.stream_type.StreamType = modal.stream_type.StreamType.PIPE,
140
+ exec_deadline: typing.Optional[float] = None,
141
+ text: bool = True,
142
+ by_line: bool = False,
143
+ command_router_client: typing.Optional[modal._utils.task_command_router_client.TaskCommandRouterClient] = None,
144
+ ) -> None:
145
+ """Initialize self. See help(type(self)) for accurate signature."""
146
+ ...
147
+
148
+ def __repr__(self) -> str:
149
+ """Return repr(self)."""
150
+ ...
151
+
152
+ @property
153
+ def stdout(self) -> modal.io_streams._StreamReader[T]:
154
+ """StreamReader for the container process's stdout stream."""
155
+ ...
156
+
157
+ @property
158
+ def stderr(self) -> modal.io_streams._StreamReader[T]:
159
+ """StreamReader for the container process's stderr stream."""
160
+ ...
161
+
162
+ @property
163
+ def stdin(self) -> modal.io_streams._StreamWriter:
164
+ """StreamWriter for the container process's stdin stream."""
165
+ ...
166
+
167
+ @property
168
+ def returncode(self) -> int: ...
169
+ async def poll(self) -> typing.Optional[int]:
170
+ """Check if the container process has finished running.
171
+
172
+ Returns `None` if the process is still running, else returns the exit code.
173
+ """
174
+ ...
175
+
176
+ async def wait(self) -> int:
177
+ """Wait for the container process to finish running. Returns the exit code."""
178
+ ...
179
+
180
+ async def attach(self):
181
+ """mdmd:hidden"""
182
+ ...
183
+
40
184
  SUPERSELF = typing.TypeVar("SUPERSELF", covariant=True)
41
185
 
42
186
  class ContainerProcess(typing.Generic[T]):
43
- _process_id: typing.Optional[str]
44
- _stdout: modal.io_streams.StreamReader[T]
45
- _stderr: modal.io_streams.StreamReader[T]
46
- _stdin: modal.io_streams.StreamWriter
47
- _text: bool
48
- _by_line: bool
49
- _returncode: typing.Optional[int]
50
-
187
+ """Represents a running process in a container."""
51
188
  def __init__(
52
189
  self,
53
190
  process_id: str,
191
+ task_id: str,
54
192
  client: modal.client.Client,
55
193
  stdout: modal.stream_type.StreamType = modal.stream_type.StreamType.PIPE,
56
194
  stderr: modal.stream_type.StreamType = modal.stream_type.StreamType.PIPE,
195
+ exec_deadline: typing.Optional[float] = None,
57
196
  text: bool = True,
58
197
  by_line: bool = False,
198
+ command_router_client: typing.Optional[modal._utils.task_command_router_client.TaskCommandRouterClient] = None,
59
199
  ) -> None: ...
60
200
  def __repr__(self) -> str: ...
61
201
  @property
62
- def stdout(self) -> modal.io_streams.StreamReader[T]: ...
202
+ def stdout(self) -> modal.io_streams.StreamReader[T]:
203
+ """StreamReader for the container process's stdout stream."""
204
+ ...
205
+
63
206
  @property
64
- def stderr(self) -> modal.io_streams.StreamReader[T]: ...
207
+ def stderr(self) -> modal.io_streams.StreamReader[T]:
208
+ """StreamReader for the container process's stderr stream."""
209
+ ...
210
+
65
211
  @property
66
- def stdin(self) -> modal.io_streams.StreamWriter: ...
212
+ def stdin(self) -> modal.io_streams.StreamWriter:
213
+ """StreamWriter for the container process's stdin stream."""
214
+ ...
215
+
67
216
  @property
68
217
  def returncode(self) -> int: ...
69
218
 
70
219
  class __poll_spec(typing_extensions.Protocol[SUPERSELF]):
71
- def __call__(self, /) -> typing.Optional[int]: ...
72
- async def aio(self, /) -> typing.Optional[int]: ...
220
+ def __call__(self, /) -> typing.Optional[int]:
221
+ """Check if the container process has finished running.
222
+
223
+ Returns `None` if the process is still running, else returns the exit code.
224
+ """
225
+ ...
226
+
227
+ async def aio(self, /) -> typing.Optional[int]:
228
+ """Check if the container process has finished running.
229
+
230
+ Returns `None` if the process is still running, else returns the exit code.
231
+ """
232
+ ...
73
233
 
74
234
  poll: __poll_spec[typing_extensions.Self]
75
235
 
76
236
  class __wait_spec(typing_extensions.Protocol[SUPERSELF]):
77
- def __call__(self, /) -> int: ...
78
- async def aio(self, /) -> int: ...
237
+ def __call__(self, /) -> int:
238
+ """Wait for the container process to finish running. Returns the exit code."""
239
+ ...
240
+
241
+ async def aio(self, /) -> int:
242
+ """Wait for the container process to finish running. Returns the exit code."""
243
+ ...
79
244
 
80
245
  wait: __wait_spec[typing_extensions.Self]
81
246
 
82
247
  class __attach_spec(typing_extensions.Protocol[SUPERSELF]):
83
- def __call__(self, /): ...
84
- async def aio(self, /): ...
248
+ def __call__(self, /):
249
+ """mdmd:hidden"""
250
+ ...
251
+
252
+ async def aio(self, /):
253
+ """mdmd:hidden"""
254
+ ...
85
255
 
86
256
  attach: __attach_spec[typing_extensions.Self]