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
modal/runner.pyi CHANGED
@@ -1,6 +1,6 @@
1
- import modal._functions
1
+ import modal._load_context
2
+ import modal.app
2
3
  import modal.client
3
- import modal.cls
4
4
  import modal.running_app
5
5
  import modal_proto.api_pb2
6
6
  import multiprocessing.synchronize
@@ -8,8 +8,6 @@ import synchronicity.combined_types
8
8
  import typing
9
9
  import typing_extensions
10
10
 
11
- _App = typing.TypeVar("_App")
12
-
13
11
  V = typing.TypeVar("V")
14
12
 
15
13
  async def _heartbeat(client: modal.client._Client, app_id: str) -> None: ...
@@ -19,102 +17,190 @@ async def _init_local_app_existing(
19
17
  async def _init_local_app_new(
20
18
  client: modal.client._Client,
21
19
  description: str,
20
+ tags: dict[str, str],
22
21
  app_state: int,
23
22
  environment_name: str = "",
24
23
  interactive: bool = False,
25
24
  ) -> modal.running_app.RunningApp: ...
26
25
  async def _init_local_app_from_name(
27
- client: modal.client._Client, name: str, namespace: typing.Any, environment_name: str = ""
26
+ client: modal.client._Client, name: str, tags: dict[str, str], environment_name: str = ""
28
27
  ) -> modal.running_app.RunningApp: ...
29
28
  async def _create_all_objects(
30
- client: modal.client._Client,
31
29
  running_app: modal.running_app.RunningApp,
32
- functions: dict[str, modal._functions._Function],
33
- classes: dict[str, modal.cls._Cls],
34
- environment_name: str,
35
- ) -> None: ...
30
+ local_app_state: modal.app._LocalAppState,
31
+ load_context: modal._load_context.LoadContext,
32
+ ) -> None:
33
+ """Create objects that have been defined but not created on the server."""
34
+ ...
35
+
36
36
  async def _publish_app(
37
37
  client: modal.client._Client,
38
38
  running_app: modal.running_app.RunningApp,
39
39
  app_state: int,
40
- functions: dict[str, modal._functions._Function],
41
- classes: dict[str, modal.cls._Cls],
40
+ app_local_state: modal.app._LocalAppState,
42
41
  name: str = "",
43
- tag: str = "",
42
+ deployment_tag: str = "",
44
43
  commit_info: typing.Optional[modal_proto.api_pb2.CommitInfo] = None,
45
- ) -> tuple[str, list[modal_proto.api_pb2.Warning]]: ...
46
- async def _disconnect(client: modal.client._Client, app_id: str, reason: int, exc_str: str = "") -> None: ...
44
+ ) -> tuple[str, list[modal_proto.api_pb2.Warning]]:
45
+ """Wrapper for AppPublish RPC."""
46
+ ...
47
+
48
+ async def _disconnect(client: modal.client._Client, app_id: str, reason: int, exc_str: str = "") -> None:
49
+ """Tell the server the client has disconnected for this app. Terminates all running tasks
50
+ for ephemeral apps.
51
+ """
52
+ ...
53
+
47
54
  async def _status_based_disconnect(
48
55
  client: modal.client._Client, app_id: str, exc_info: typing.Optional[BaseException] = None
49
- ): ...
56
+ ):
57
+ """Disconnect local session of a running app, sending relevant metadata
58
+
59
+ exc_info: Exception if an exception caused the disconnect
60
+ """
61
+ ...
62
+
50
63
  def _run_app(
51
- app: _App,
64
+ app: modal.app._App,
52
65
  *,
53
66
  client: typing.Optional[modal.client._Client] = None,
54
67
  detach: bool = False,
55
68
  environment_name: typing.Optional[str] = None,
56
69
  interactive: bool = False,
57
- ) -> typing.AsyncContextManager[_App]: ...
70
+ ) -> typing.AsyncContextManager[modal.app._App]:
71
+ """mdmd:hidden"""
72
+ ...
73
+
58
74
  async def _serve_update(
59
- app: _App, existing_app_id: str, is_ready: multiprocessing.synchronize.Event, environment_name: str
60
- ) -> None: ...
75
+ app: modal.app._App, existing_app_id: str, is_ready: multiprocessing.synchronize.Event, environment_name: str
76
+ ) -> None:
77
+ """mdmd:hidden"""
78
+ ...
61
79
 
62
80
  class DeployResult:
81
+ """Dataclass representing the result of deploying an app."""
82
+
63
83
  app_id: str
64
84
  app_page_url: str
65
85
  app_logs_url: str
66
86
  warnings: list[str]
67
87
 
68
- def __init__(self, app_id: str, app_page_url: str, app_logs_url: str, warnings: list[str]) -> None: ...
69
- def __repr__(self): ...
70
- def __eq__(self, other): ...
71
- def __setattr__(self, name, value): ...
72
- def __delattr__(self, name): ...
73
- def __hash__(self): ...
88
+ def __init__(self, app_id: str, app_page_url: str, app_logs_url: str, warnings: list[str]) -> None:
89
+ """Initialize self. See help(type(self)) for accurate signature."""
90
+ ...
91
+
92
+ def __repr__(self):
93
+ """Return repr(self)."""
94
+ ...
95
+
96
+ def __eq__(self, other):
97
+ """Return self==value."""
98
+ ...
99
+
100
+ def __setattr__(self, name, value):
101
+ """Implement setattr(self, name, value)."""
102
+ ...
103
+
104
+ def __delattr__(self, name):
105
+ """Implement delattr(self, name)."""
106
+ ...
107
+
108
+ def __hash__(self):
109
+ """Return hash(self)."""
110
+ ...
74
111
 
75
112
  async def _deploy_app(
76
- app: _App,
113
+ app: modal.app._App,
77
114
  name: typing.Optional[str] = None,
78
- namespace: typing.Any = 1,
115
+ namespace: typing.Any = None,
79
116
  client: typing.Optional[modal.client._Client] = None,
80
117
  environment_name: typing.Optional[str] = None,
81
118
  tag: str = "",
82
- ) -> DeployResult: ...
119
+ ) -> DeployResult:
120
+ """Internal function for deploying an App.
121
+
122
+ Users should prefer the `modal deploy` CLI or the `App.deploy` method.
123
+ """
124
+ ...
125
+
83
126
  async def _interactive_shell(
84
- _app: _App, cmds: list[str], environment_name: str = "", pty: bool = True, **kwargs: typing.Any
85
- ) -> None: ...
127
+ _app: modal.app._App, cmds: list[str], environment_name: str = "", pty: bool = True, **kwargs: typing.Any
128
+ ) -> None:
129
+ """Run an interactive shell (like `bash`) within the image for this app.
130
+
131
+ This is useful for online debugging and interactive exploration of the
132
+ contents of this image. If `cmd` is optionally provided, it will be run
133
+ instead of the default shell inside this image.
134
+
135
+ **Example**
136
+
137
+ ```python
138
+ import modal
139
+
140
+ app = modal.App(image=modal.Image.debian_slim().apt_install("vim"))
141
+ ```
142
+
143
+ You can now run this using
144
+
145
+ ```
146
+ modal shell script.py --cmd /bin/bash
147
+ ```
148
+
149
+ When calling programmatically, `kwargs` are passed to `Sandbox.create()`.
150
+ """
151
+ ...
86
152
 
87
153
  class __run_app_spec(typing_extensions.Protocol):
88
154
  def __call__(
89
155
  self,
90
156
  /,
91
- app: _App,
157
+ app: modal.app.App,
92
158
  *,
93
159
  client: typing.Optional[modal.client.Client] = None,
94
160
  detach: bool = False,
95
161
  environment_name: typing.Optional[str] = None,
96
162
  interactive: bool = False,
97
- ) -> synchronicity.combined_types.AsyncAndBlockingContextManager[_App]: ...
163
+ ) -> synchronicity.combined_types.AsyncAndBlockingContextManager[modal.app.App]:
164
+ """mdmd:hidden"""
165
+ ...
166
+
98
167
  def aio(
99
168
  self,
100
169
  /,
101
- app: _App,
170
+ app: modal.app.App,
102
171
  *,
103
172
  client: typing.Optional[modal.client.Client] = None,
104
173
  detach: bool = False,
105
174
  environment_name: typing.Optional[str] = None,
106
175
  interactive: bool = False,
107
- ) -> typing.AsyncContextManager[_App]: ...
176
+ ) -> typing.AsyncContextManager[modal.app.App]:
177
+ """mdmd:hidden"""
178
+ ...
108
179
 
109
180
  run_app: __run_app_spec
110
181
 
111
182
  class __serve_update_spec(typing_extensions.Protocol):
112
183
  def __call__(
113
- self, /, app: _App, existing_app_id: str, is_ready: multiprocessing.synchronize.Event, environment_name: str
114
- ) -> None: ...
184
+ self,
185
+ /,
186
+ app: modal.app.App,
187
+ existing_app_id: str,
188
+ is_ready: multiprocessing.synchronize.Event,
189
+ environment_name: str,
190
+ ) -> None:
191
+ """mdmd:hidden"""
192
+ ...
193
+
115
194
  async def aio(
116
- self, /, app: _App, existing_app_id: str, is_ready: multiprocessing.synchronize.Event, environment_name: str
117
- ) -> None: ...
195
+ self,
196
+ /,
197
+ app: modal.app.App,
198
+ existing_app_id: str,
199
+ is_ready: multiprocessing.synchronize.Event,
200
+ environment_name: str,
201
+ ) -> None:
202
+ """mdmd:hidden"""
203
+ ...
118
204
 
119
205
  serve_update: __serve_update_spec
120
206
 
@@ -122,32 +208,102 @@ class __deploy_app_spec(typing_extensions.Protocol):
122
208
  def __call__(
123
209
  self,
124
210
  /,
125
- app: _App,
211
+ app: modal.app.App,
126
212
  name: typing.Optional[str] = None,
127
- namespace: typing.Any = 1,
213
+ namespace: typing.Any = None,
128
214
  client: typing.Optional[modal.client.Client] = None,
129
215
  environment_name: typing.Optional[str] = None,
130
216
  tag: str = "",
131
- ) -> DeployResult: ...
217
+ ) -> DeployResult:
218
+ """Internal function for deploying an App.
219
+
220
+ Users should prefer the `modal deploy` CLI or the `App.deploy` method.
221
+ """
222
+ ...
223
+
132
224
  async def aio(
133
225
  self,
134
226
  /,
135
- app: _App,
227
+ app: modal.app.App,
136
228
  name: typing.Optional[str] = None,
137
- namespace: typing.Any = 1,
229
+ namespace: typing.Any = None,
138
230
  client: typing.Optional[modal.client.Client] = None,
139
231
  environment_name: typing.Optional[str] = None,
140
232
  tag: str = "",
141
- ) -> DeployResult: ...
233
+ ) -> DeployResult:
234
+ """Internal function for deploying an App.
235
+
236
+ Users should prefer the `modal deploy` CLI or the `App.deploy` method.
237
+ """
238
+ ...
142
239
 
143
240
  deploy_app: __deploy_app_spec
144
241
 
145
242
  class __interactive_shell_spec(typing_extensions.Protocol):
146
243
  def __call__(
147
- self, /, _app: _App, cmds: list[str], environment_name: str = "", pty: bool = True, **kwargs: typing.Any
148
- ) -> None: ...
244
+ self,
245
+ /,
246
+ _app: modal.app.App,
247
+ cmds: list[str],
248
+ environment_name: str = "",
249
+ pty: bool = True,
250
+ **kwargs: typing.Any,
251
+ ) -> None:
252
+ """Run an interactive shell (like `bash`) within the image for this app.
253
+
254
+ This is useful for online debugging and interactive exploration of the
255
+ contents of this image. If `cmd` is optionally provided, it will be run
256
+ instead of the default shell inside this image.
257
+
258
+ **Example**
259
+
260
+ ```python
261
+ import modal
262
+
263
+ app = modal.App(image=modal.Image.debian_slim().apt_install("vim"))
264
+ ```
265
+
266
+ You can now run this using
267
+
268
+ ```
269
+ modal shell script.py --cmd /bin/bash
270
+ ```
271
+
272
+ When calling programmatically, `kwargs` are passed to `Sandbox.create()`.
273
+ """
274
+ ...
275
+
149
276
  async def aio(
150
- self, /, _app: _App, cmds: list[str], environment_name: str = "", pty: bool = True, **kwargs: typing.Any
151
- ) -> None: ...
277
+ self,
278
+ /,
279
+ _app: modal.app.App,
280
+ cmds: list[str],
281
+ environment_name: str = "",
282
+ pty: bool = True,
283
+ **kwargs: typing.Any,
284
+ ) -> None:
285
+ """Run an interactive shell (like `bash`) within the image for this app.
286
+
287
+ This is useful for online debugging and interactive exploration of the
288
+ contents of this image. If `cmd` is optionally provided, it will be run
289
+ instead of the default shell inside this image.
290
+
291
+ **Example**
292
+
293
+ ```python
294
+ import modal
295
+
296
+ app = modal.App(image=modal.Image.debian_slim().apt_install("vim"))
297
+ ```
298
+
299
+ You can now run this using
300
+
301
+ ```
302
+ modal shell script.py --cmd /bin/bash
303
+ ```
304
+
305
+ When calling programmatically, `kwargs` are passed to `Sandbox.create()`.
306
+ """
307
+ ...
152
308
 
153
309
  interactive_shell: __interactive_shell_spec