modal 1.0.5.dev2__py3-none-any.whl → 1.0.5.dev4__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/_clustered_functions.pyi +13 -3
- modal/_functions.py +5 -4
- modal/_partial_function.py +1 -1
- modal/_runtime/container_io_manager.pyi +222 -40
- modal/_runtime/execution_context.pyi +60 -6
- modal/_tunnel.pyi +380 -12
- modal/app.py +4 -4
- modal/app.pyi +658 -48
- modal/cli/run.py +2 -1
- modal/client.pyi +224 -28
- modal/cloud_bucket_mount.pyi +192 -4
- modal/cls.py +3 -3
- modal/cls.pyi +442 -35
- modal/container_process.pyi +103 -14
- modal/dict.py +1 -1
- modal/dict.pyi +453 -51
- modal/environments.pyi +41 -9
- modal/exception.py +2 -2
- modal/file_io.pyi +236 -45
- modal/functions.pyi +545 -56
- modal/gpu.py +1 -1
- modal/image.py +1 -1
- modal/image.pyi +1256 -74
- modal/io_streams.pyi +342 -39
- modal/mount.pyi +261 -31
- modal/network_file_system.pyi +307 -26
- modal/object.pyi +48 -9
- modal/parallel_map.pyi +144 -14
- modal/partial_function.pyi +255 -14
- modal/proxy.py +1 -1
- modal/proxy.pyi +28 -3
- modal/queue.py +1 -1
- modal/queue.pyi +447 -30
- modal/runner.pyi +160 -22
- modal/sandbox.py +7 -7
- modal/sandbox.pyi +310 -50
- modal/schedule.py +1 -1
- modal/secret.py +2 -2
- modal/secret.pyi +164 -15
- modal/snapshot.pyi +25 -4
- modal/token_flow.pyi +28 -8
- modal/volume.py +1 -1
- modal/volume.pyi +649 -59
- {modal-1.0.5.dev2.dist-info → modal-1.0.5.dev4.dist-info}/METADATA +1 -1
- {modal-1.0.5.dev2.dist-info → modal-1.0.5.dev4.dist-info}/RECORD +50 -50
- modal_version/__init__.py +1 -1
- {modal-1.0.5.dev2.dist-info → modal-1.0.5.dev4.dist-info}/WHEEL +0 -0
- {modal-1.0.5.dev2.dist-info → modal-1.0.5.dev4.dist-info}/entry_points.txt +0 -0
- {modal-1.0.5.dev2.dist-info → modal-1.0.5.dev4.dist-info}/licenses/LICENSE +0 -0
- {modal-1.0.5.dev2.dist-info → modal-1.0.5.dev4.dist-info}/top_level.txt +0 -0
modal/runner.pyi
CHANGED
@@ -32,7 +32,10 @@ async def _create_all_objects(
|
|
32
32
|
functions: dict[str, modal._functions._Function],
|
33
33
|
classes: dict[str, modal.cls._Cls],
|
34
34
|
environment_name: str,
|
35
|
-
) -> None:
|
35
|
+
) -> None:
|
36
|
+
"""Create objects that have been defined but not created on the server."""
|
37
|
+
...
|
38
|
+
|
36
39
|
async def _publish_app(
|
37
40
|
client: modal.client._Client,
|
38
41
|
running_app: modal.running_app.RunningApp,
|
@@ -42,11 +45,25 @@ async def _publish_app(
|
|
42
45
|
name: str = "",
|
43
46
|
tag: str = "",
|
44
47
|
commit_info: typing.Optional[modal_proto.api_pb2.CommitInfo] = None,
|
45
|
-
) -> tuple[str, list[modal_proto.api_pb2.Warning]]:
|
46
|
-
|
48
|
+
) -> tuple[str, list[modal_proto.api_pb2.Warning]]:
|
49
|
+
"""Wrapper for AppPublish RPC."""
|
50
|
+
...
|
51
|
+
|
52
|
+
async def _disconnect(client: modal.client._Client, app_id: str, reason: int, exc_str: str = "") -> None:
|
53
|
+
"""Tell the server the client has disconnected for this app. Terminates all running tasks
|
54
|
+
for ephemeral apps.
|
55
|
+
"""
|
56
|
+
...
|
57
|
+
|
47
58
|
async def _status_based_disconnect(
|
48
59
|
client: modal.client._Client, app_id: str, exc_info: typing.Optional[BaseException] = None
|
49
|
-
):
|
60
|
+
):
|
61
|
+
"""Disconnect local session of a running app, sending relevant metadata
|
62
|
+
|
63
|
+
exc_info: Exception if an exception caused the disconnect
|
64
|
+
"""
|
65
|
+
...
|
66
|
+
|
50
67
|
def _run_app(
|
51
68
|
app: _App,
|
52
69
|
*,
|
@@ -54,23 +71,47 @@ def _run_app(
|
|
54
71
|
detach: bool = False,
|
55
72
|
environment_name: typing.Optional[str] = None,
|
56
73
|
interactive: bool = False,
|
57
|
-
) -> typing.AsyncContextManager[_App]:
|
74
|
+
) -> typing.AsyncContextManager[_App]:
|
75
|
+
"""mdmd:hidden"""
|
76
|
+
...
|
77
|
+
|
58
78
|
async def _serve_update(
|
59
79
|
app: _App, existing_app_id: str, is_ready: multiprocessing.synchronize.Event, environment_name: str
|
60
|
-
) -> None:
|
80
|
+
) -> None:
|
81
|
+
"""mdmd:hidden"""
|
82
|
+
...
|
61
83
|
|
62
84
|
class DeployResult:
|
85
|
+
"""Dataclass representing the result of deploying an app."""
|
86
|
+
|
63
87
|
app_id: str
|
64
88
|
app_page_url: str
|
65
89
|
app_logs_url: str
|
66
90
|
warnings: list[str]
|
67
91
|
|
68
|
-
def __init__(self, app_id: str, app_page_url: str, app_logs_url: str, warnings: list[str]) -> None:
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
def
|
73
|
-
|
92
|
+
def __init__(self, app_id: str, app_page_url: str, app_logs_url: str, warnings: list[str]) -> None:
|
93
|
+
"""Initialize self. See help(type(self)) for accurate signature."""
|
94
|
+
...
|
95
|
+
|
96
|
+
def __repr__(self):
|
97
|
+
"""Return repr(self)."""
|
98
|
+
...
|
99
|
+
|
100
|
+
def __eq__(self, other):
|
101
|
+
"""Return self==value."""
|
102
|
+
...
|
103
|
+
|
104
|
+
def __setattr__(self, name, value):
|
105
|
+
"""Implement setattr(self, name, value)."""
|
106
|
+
...
|
107
|
+
|
108
|
+
def __delattr__(self, name):
|
109
|
+
"""Implement delattr(self, name)."""
|
110
|
+
...
|
111
|
+
|
112
|
+
def __hash__(self):
|
113
|
+
"""Return hash(self)."""
|
114
|
+
...
|
74
115
|
|
75
116
|
async def _deploy_app(
|
76
117
|
app: _App,
|
@@ -79,10 +120,39 @@ async def _deploy_app(
|
|
79
120
|
client: typing.Optional[modal.client._Client] = None,
|
80
121
|
environment_name: typing.Optional[str] = None,
|
81
122
|
tag: str = "",
|
82
|
-
) -> DeployResult:
|
123
|
+
) -> DeployResult:
|
124
|
+
"""Internal function for deploying an App.
|
125
|
+
|
126
|
+
Users should prefer the `modal deploy` CLI or the `App.deploy` method.
|
127
|
+
"""
|
128
|
+
...
|
129
|
+
|
83
130
|
async def _interactive_shell(
|
84
131
|
_app: _App, cmds: list[str], environment_name: str = "", pty: bool = True, **kwargs: typing.Any
|
85
|
-
) -> None:
|
132
|
+
) -> None:
|
133
|
+
"""Run an interactive shell (like `bash`) within the image for this app.
|
134
|
+
|
135
|
+
This is useful for online debugging and interactive exploration of the
|
136
|
+
contents of this image. If `cmd` is optionally provided, it will be run
|
137
|
+
instead of the default shell inside this image.
|
138
|
+
|
139
|
+
**Example**
|
140
|
+
|
141
|
+
```python
|
142
|
+
import modal
|
143
|
+
|
144
|
+
app = modal.App(image=modal.Image.debian_slim().apt_install("vim"))
|
145
|
+
```
|
146
|
+
|
147
|
+
You can now run this using
|
148
|
+
|
149
|
+
```
|
150
|
+
modal shell script.py --cmd /bin/bash
|
151
|
+
```
|
152
|
+
|
153
|
+
When calling programmatically, `kwargs` are passed to `Sandbox.create()`.
|
154
|
+
"""
|
155
|
+
...
|
86
156
|
|
87
157
|
class __run_app_spec(typing_extensions.Protocol):
|
88
158
|
def __call__(
|
@@ -94,7 +164,10 @@ class __run_app_spec(typing_extensions.Protocol):
|
|
94
164
|
detach: bool = False,
|
95
165
|
environment_name: typing.Optional[str] = None,
|
96
166
|
interactive: bool = False,
|
97
|
-
) -> synchronicity.combined_types.AsyncAndBlockingContextManager[_App]:
|
167
|
+
) -> synchronicity.combined_types.AsyncAndBlockingContextManager[_App]:
|
168
|
+
"""mdmd:hidden"""
|
169
|
+
...
|
170
|
+
|
98
171
|
def aio(
|
99
172
|
self,
|
100
173
|
/,
|
@@ -104,17 +177,24 @@ class __run_app_spec(typing_extensions.Protocol):
|
|
104
177
|
detach: bool = False,
|
105
178
|
environment_name: typing.Optional[str] = None,
|
106
179
|
interactive: bool = False,
|
107
|
-
) -> typing.AsyncContextManager[_App]:
|
180
|
+
) -> typing.AsyncContextManager[_App]:
|
181
|
+
"""mdmd:hidden"""
|
182
|
+
...
|
108
183
|
|
109
184
|
run_app: __run_app_spec
|
110
185
|
|
111
186
|
class __serve_update_spec(typing_extensions.Protocol):
|
112
187
|
def __call__(
|
113
188
|
self, /, app: _App, existing_app_id: str, is_ready: multiprocessing.synchronize.Event, environment_name: str
|
114
|
-
) -> None:
|
189
|
+
) -> None:
|
190
|
+
"""mdmd:hidden"""
|
191
|
+
...
|
192
|
+
|
115
193
|
async def aio(
|
116
194
|
self, /, app: _App, existing_app_id: str, is_ready: multiprocessing.synchronize.Event, environment_name: str
|
117
|
-
) -> None:
|
195
|
+
) -> None:
|
196
|
+
"""mdmd:hidden"""
|
197
|
+
...
|
118
198
|
|
119
199
|
serve_update: __serve_update_spec
|
120
200
|
|
@@ -128,7 +208,13 @@ class __deploy_app_spec(typing_extensions.Protocol):
|
|
128
208
|
client: typing.Optional[modal.client.Client] = None,
|
129
209
|
environment_name: typing.Optional[str] = None,
|
130
210
|
tag: str = "",
|
131
|
-
) -> DeployResult:
|
211
|
+
) -> DeployResult:
|
212
|
+
"""Internal function for deploying an App.
|
213
|
+
|
214
|
+
Users should prefer the `modal deploy` CLI or the `App.deploy` method.
|
215
|
+
"""
|
216
|
+
...
|
217
|
+
|
132
218
|
async def aio(
|
133
219
|
self,
|
134
220
|
/,
|
@@ -138,16 +224,68 @@ class __deploy_app_spec(typing_extensions.Protocol):
|
|
138
224
|
client: typing.Optional[modal.client.Client] = None,
|
139
225
|
environment_name: typing.Optional[str] = None,
|
140
226
|
tag: str = "",
|
141
|
-
) -> DeployResult:
|
227
|
+
) -> DeployResult:
|
228
|
+
"""Internal function for deploying an App.
|
229
|
+
|
230
|
+
Users should prefer the `modal deploy` CLI or the `App.deploy` method.
|
231
|
+
"""
|
232
|
+
...
|
142
233
|
|
143
234
|
deploy_app: __deploy_app_spec
|
144
235
|
|
145
236
|
class __interactive_shell_spec(typing_extensions.Protocol):
|
146
237
|
def __call__(
|
147
238
|
self, /, _app: _App, cmds: list[str], environment_name: str = "", pty: bool = True, **kwargs: typing.Any
|
148
|
-
) -> None:
|
239
|
+
) -> None:
|
240
|
+
"""Run an interactive shell (like `bash`) within the image for this app.
|
241
|
+
|
242
|
+
This is useful for online debugging and interactive exploration of the
|
243
|
+
contents of this image. If `cmd` is optionally provided, it will be run
|
244
|
+
instead of the default shell inside this image.
|
245
|
+
|
246
|
+
**Example**
|
247
|
+
|
248
|
+
```python
|
249
|
+
import modal
|
250
|
+
|
251
|
+
app = modal.App(image=modal.Image.debian_slim().apt_install("vim"))
|
252
|
+
```
|
253
|
+
|
254
|
+
You can now run this using
|
255
|
+
|
256
|
+
```
|
257
|
+
modal shell script.py --cmd /bin/bash
|
258
|
+
```
|
259
|
+
|
260
|
+
When calling programmatically, `kwargs` are passed to `Sandbox.create()`.
|
261
|
+
"""
|
262
|
+
...
|
263
|
+
|
149
264
|
async def aio(
|
150
265
|
self, /, _app: _App, cmds: list[str], environment_name: str = "", pty: bool = True, **kwargs: typing.Any
|
151
|
-
) -> None:
|
266
|
+
) -> None:
|
267
|
+
"""Run an interactive shell (like `bash`) within the image for this app.
|
268
|
+
|
269
|
+
This is useful for online debugging and interactive exploration of the
|
270
|
+
contents of this image. If `cmd` is optionally provided, it will be run
|
271
|
+
instead of the default shell inside this image.
|
272
|
+
|
273
|
+
**Example**
|
274
|
+
|
275
|
+
```python
|
276
|
+
import modal
|
277
|
+
|
278
|
+
app = modal.App(image=modal.Image.debian_slim().apt_install("vim"))
|
279
|
+
```
|
280
|
+
|
281
|
+
You can now run this using
|
282
|
+
|
283
|
+
```
|
284
|
+
modal shell script.py --cmd /bin/bash
|
285
|
+
```
|
286
|
+
|
287
|
+
When calling programmatically, `kwargs` are passed to `Sandbox.create()`.
|
288
|
+
"""
|
289
|
+
...
|
152
290
|
|
153
291
|
interactive_shell: __interactive_shell_spec
|
modal/sandbox.py
CHANGED
@@ -70,7 +70,7 @@ class _Sandbox(_Object, type_prefix="sb"):
|
|
70
70
|
"""A `Sandbox` object lets you interact with a running sandbox. This API is similar to Python's
|
71
71
|
[asyncio.subprocess.Process](https://docs.python.org/3/library/asyncio-subprocess.html#asyncio.subprocess.Process).
|
72
72
|
|
73
|
-
Refer to the [guide](/docs/guide/sandbox) on how to spawn and use sandboxes.
|
73
|
+
Refer to the [guide](https://modal.com/docs/guide/sandbox) on how to spawn and use sandboxes.
|
74
74
|
"""
|
75
75
|
|
76
76
|
_result: Optional[api_pb2.GenericResult]
|
@@ -516,7 +516,7 @@ class _Sandbox(_Object, type_prefix="sb"):
|
|
516
516
|
|
517
517
|
Returns a dictionary of `Tunnel` objects which are keyed by the container port.
|
518
518
|
|
519
|
-
NOTE: Previous to client [v0.64.153](/docs/reference/changelog#064153-2024-09-30), this
|
519
|
+
NOTE: Previous to client [v0.64.153](https://modal.com/docs/reference/changelog#064153-2024-09-30), this
|
520
520
|
returned a list of `TunnelData` objects.
|
521
521
|
"""
|
522
522
|
|
@@ -617,7 +617,7 @@ class _Sandbox(_Object, type_prefix="sb"):
|
|
617
617
|
):
|
618
618
|
"""Execute a command in the Sandbox and return a ContainerProcess handle.
|
619
619
|
|
620
|
-
See the [`ContainerProcess`](/docs/reference/modal.container_process#modalcontainer_processcontainerprocess)
|
620
|
+
See the [`ContainerProcess`](https://modal.com/docs/reference/modal.container_process#modalcontainer_processcontainerprocess)
|
621
621
|
docs for more information.
|
622
622
|
|
623
623
|
**Usage**
|
@@ -722,7 +722,7 @@ class _Sandbox(_Object, type_prefix="sb"):
|
|
722
722
|
):
|
723
723
|
"""Open a file in the Sandbox and return a FileIO handle.
|
724
724
|
|
725
|
-
See the [`FileIO`](/docs/reference/modal.file_io#modalfile_iofileio) docs for more information.
|
725
|
+
See the [`FileIO`](https://modal.com/docs/reference/modal.file_io#modalfile_iofileio) docs for more information.
|
726
726
|
|
727
727
|
**Usage**
|
728
728
|
|
@@ -766,7 +766,7 @@ class _Sandbox(_Object, type_prefix="sb"):
|
|
766
766
|
@property
|
767
767
|
def stdout(self) -> _StreamReader[str]:
|
768
768
|
"""
|
769
|
-
[`StreamReader`](/docs/reference/modal.io_streams#modalio_streamsstreamreader) for
|
769
|
+
[`StreamReader`](https://modal.com/docs/reference/modal.io_streams#modalio_streamsstreamreader) for
|
770
770
|
the sandbox's stdout stream.
|
771
771
|
"""
|
772
772
|
|
@@ -774,7 +774,7 @@ class _Sandbox(_Object, type_prefix="sb"):
|
|
774
774
|
|
775
775
|
@property
|
776
776
|
def stderr(self) -> _StreamReader[str]:
|
777
|
-
"""[`StreamReader`](/docs/reference/modal.io_streams#modalio_streamsstreamreader) for
|
777
|
+
"""[`StreamReader`](https://modal.com/docs/reference/modal.io_streams#modalio_streamsstreamreader) for
|
778
778
|
the Sandbox's stderr stream.
|
779
779
|
"""
|
780
780
|
|
@@ -783,7 +783,7 @@ class _Sandbox(_Object, type_prefix="sb"):
|
|
783
783
|
@property
|
784
784
|
def stdin(self) -> _StreamWriter:
|
785
785
|
"""
|
786
|
-
[`StreamWriter`](/docs/reference/modal.io_streams#modalio_streamsstreamwriter) for
|
786
|
+
[`StreamWriter`](https://modal.com/docs/reference/modal.io_streams#modalio_streamsstreamwriter) for
|
787
787
|
the Sandbox's stdin stream.
|
788
788
|
"""
|
789
789
|
|