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/sandbox.pyi
CHANGED
@@ -28,6 +28,12 @@ import typing_extensions
|
|
28
28
|
def _validate_exec_args(entrypoint_args: collections.abc.Sequence[str]) -> None: ...
|
29
29
|
|
30
30
|
class _Sandbox(modal._object._Object):
|
31
|
+
"""A `Sandbox` object lets you interact with a running sandbox. This API is similar to Python's
|
32
|
+
[asyncio.subprocess.Process](https://docs.python.org/3/library/asyncio-subprocess.html#asyncio.subprocess.Process).
|
33
|
+
|
34
|
+
Refer to the [guide](https://modal.com/docs/guide/sandbox) on how to spawn and use sandboxes.
|
35
|
+
"""
|
36
|
+
|
31
37
|
_result: typing.Optional[modal_proto.api_pb2.GenericResult]
|
32
38
|
_stdout: modal.io_streams._StreamReader[str]
|
33
39
|
_stderr: modal.io_streams._StreamReader[str]
|
@@ -64,7 +70,10 @@ class _Sandbox(modal._object._Object):
|
|
64
70
|
_experimental_scheduler_placement: typing.Optional[modal.scheduler_placement.SchedulerPlacement] = None,
|
65
71
|
enable_snapshot: bool = False,
|
66
72
|
verbose: bool = False,
|
67
|
-
) -> _Sandbox:
|
73
|
+
) -> _Sandbox:
|
74
|
+
"""mdmd:hidden"""
|
75
|
+
...
|
76
|
+
|
68
77
|
@staticmethod
|
69
78
|
async def create(
|
70
79
|
*entrypoint_args: str,
|
@@ -95,7 +104,21 @@ class _Sandbox(modal._object._Object):
|
|
95
104
|
_experimental_enable_snapshot: bool = False,
|
96
105
|
_experimental_scheduler_placement: typing.Optional[modal.scheduler_placement.SchedulerPlacement] = None,
|
97
106
|
client: typing.Optional[modal.client._Client] = None,
|
98
|
-
) -> _Sandbox:
|
107
|
+
) -> _Sandbox:
|
108
|
+
"""Create a new Sandbox to run untrusted, arbitrary code. The Sandbox's corresponding container
|
109
|
+
will be created asynchronously.
|
110
|
+
|
111
|
+
**Usage**
|
112
|
+
|
113
|
+
```python
|
114
|
+
app = modal.App.lookup('sandbox-hello-world', create_if_missing=True)
|
115
|
+
sandbox = modal.Sandbox.create("echo", "hello world", app=app)
|
116
|
+
print(sandbox.stdout.read())
|
117
|
+
sandbox.wait()
|
118
|
+
```
|
119
|
+
"""
|
120
|
+
...
|
121
|
+
|
99
122
|
@staticmethod
|
100
123
|
async def _create(
|
101
124
|
*entrypoint_args: str,
|
@@ -130,13 +153,55 @@ class _Sandbox(modal._object._Object):
|
|
130
153
|
): ...
|
131
154
|
def _hydrate_metadata(self, handle_metadata: typing.Optional[google.protobuf.message.Message]): ...
|
132
155
|
@staticmethod
|
133
|
-
async def from_id(sandbox_id: str, client: typing.Optional[modal.client._Client] = None) -> _Sandbox:
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
156
|
+
async def from_id(sandbox_id: str, client: typing.Optional[modal.client._Client] = None) -> _Sandbox:
|
157
|
+
"""Construct a Sandbox from an id and look up the Sandbox result.
|
158
|
+
|
159
|
+
The ID of a Sandbox object can be accessed using `.object_id`.
|
160
|
+
"""
|
161
|
+
...
|
162
|
+
|
163
|
+
async def set_tags(self, tags: dict[str, str], *, client: typing.Optional[modal.client._Client] = None):
|
164
|
+
"""Set tags (key-value pairs) on the Sandbox. Tags can be used to filter results in `Sandbox.list`."""
|
165
|
+
...
|
166
|
+
|
167
|
+
async def snapshot_filesystem(self, timeout: int = 55) -> modal.image._Image:
|
168
|
+
"""Snapshot the filesystem of the Sandbox.
|
169
|
+
|
170
|
+
Returns an [`Image`](https://modal.com/docs/reference/modal.Image) object which
|
171
|
+
can be used to spawn a new Sandbox with the same filesystem.
|
172
|
+
"""
|
173
|
+
...
|
174
|
+
|
175
|
+
async def wait(self, raise_on_termination: bool = True):
|
176
|
+
"""Wait for the Sandbox to finish running."""
|
177
|
+
...
|
178
|
+
|
179
|
+
async def tunnels(self, timeout: int = 50) -> dict[int, modal._tunnel.Tunnel]:
|
180
|
+
"""Get Tunnel metadata for the sandbox.
|
181
|
+
|
182
|
+
Raises `SandboxTimeoutError` if the tunnels are not available after the timeout.
|
183
|
+
|
184
|
+
Returns a dictionary of `Tunnel` objects which are keyed by the container port.
|
185
|
+
|
186
|
+
NOTE: Previous to client [v0.64.153](https://modal.com/docs/reference/changelog#064153-2024-09-30), this
|
187
|
+
returned a list of `TunnelData` objects.
|
188
|
+
"""
|
189
|
+
...
|
190
|
+
|
191
|
+
async def terminate(self) -> None:
|
192
|
+
"""Terminate Sandbox execution.
|
193
|
+
|
194
|
+
This is a no-op if the Sandbox has already finished running.
|
195
|
+
"""
|
196
|
+
...
|
197
|
+
|
198
|
+
async def poll(self) -> typing.Optional[int]:
|
199
|
+
"""Check if the Sandbox has finished running.
|
200
|
+
|
201
|
+
Returns `None` if the Sandbox is still running, else returns the exit code.
|
202
|
+
"""
|
203
|
+
...
|
204
|
+
|
140
205
|
async def _get_task_id(self) -> str: ...
|
141
206
|
@typing.overload
|
142
207
|
async def exec(
|
@@ -175,35 +240,75 @@ class _Sandbox(modal._object._Object):
|
|
175
240
|
async def open(self, path: str, mode: _typeshed.OpenTextMode) -> modal.file_io._FileIO[str]: ...
|
176
241
|
@typing.overload
|
177
242
|
async def open(self, path: str, mode: _typeshed.OpenBinaryMode) -> modal.file_io._FileIO[bytes]: ...
|
178
|
-
async def ls(self, path: str) -> list[str]:
|
179
|
-
|
180
|
-
|
243
|
+
async def ls(self, path: str) -> list[str]:
|
244
|
+
"""List the contents of a directory in the Sandbox."""
|
245
|
+
...
|
246
|
+
|
247
|
+
async def mkdir(self, path: str, parents: bool = False) -> None:
|
248
|
+
"""Create a new directory in the Sandbox."""
|
249
|
+
...
|
250
|
+
|
251
|
+
async def rm(self, path: str, recursive: bool = False) -> None:
|
252
|
+
"""Remove a file or directory in the Sandbox."""
|
253
|
+
...
|
254
|
+
|
181
255
|
def watch(
|
182
256
|
self,
|
183
257
|
path: str,
|
184
258
|
filter: typing.Optional[list[modal.file_io.FileWatchEventType]] = None,
|
185
259
|
recursive: typing.Optional[bool] = None,
|
186
260
|
timeout: typing.Optional[int] = None,
|
187
|
-
) -> typing.AsyncIterator[modal.file_io.FileWatchEvent]:
|
261
|
+
) -> typing.AsyncIterator[modal.file_io.FileWatchEvent]:
|
262
|
+
"""Watch a file or directory in the Sandbox for changes."""
|
263
|
+
...
|
264
|
+
|
188
265
|
@property
|
189
|
-
def stdout(self) -> modal.io_streams._StreamReader[str]:
|
266
|
+
def stdout(self) -> modal.io_streams._StreamReader[str]:
|
267
|
+
"""[`StreamReader`](https://modal.com/docs/reference/modal.io_streams#modalio_streamsstreamreader) for
|
268
|
+
the sandbox's stdout stream.
|
269
|
+
"""
|
270
|
+
...
|
271
|
+
|
190
272
|
@property
|
191
|
-
def stderr(self) -> modal.io_streams._StreamReader[str]:
|
273
|
+
def stderr(self) -> modal.io_streams._StreamReader[str]:
|
274
|
+
"""[`StreamReader`](https://modal.com/docs/reference/modal.io_streams#modalio_streamsstreamreader) for
|
275
|
+
the Sandbox's stderr stream.
|
276
|
+
"""
|
277
|
+
...
|
278
|
+
|
192
279
|
@property
|
193
|
-
def stdin(self) -> modal.io_streams._StreamWriter:
|
280
|
+
def stdin(self) -> modal.io_streams._StreamWriter:
|
281
|
+
"""[`StreamWriter`](https://modal.com/docs/reference/modal.io_streams#modalio_streamsstreamwriter) for
|
282
|
+
the Sandbox's stdin stream.
|
283
|
+
"""
|
284
|
+
...
|
285
|
+
|
194
286
|
@property
|
195
|
-
def returncode(self) -> typing.Optional[int]:
|
287
|
+
def returncode(self) -> typing.Optional[int]:
|
288
|
+
"""Return code of the Sandbox process if it has finished running, else `None`."""
|
289
|
+
...
|
290
|
+
|
196
291
|
@staticmethod
|
197
292
|
def list(
|
198
293
|
*,
|
199
294
|
app_id: typing.Optional[str] = None,
|
200
295
|
tags: typing.Optional[dict[str, str]] = None,
|
201
296
|
client: typing.Optional[modal.client._Client] = None,
|
202
|
-
) -> collections.abc.AsyncGenerator[_Sandbox, None]:
|
297
|
+
) -> collections.abc.AsyncGenerator[_Sandbox, None]:
|
298
|
+
"""List all Sandboxes for the current Environment or App ID (if specified). If tags are specified, only
|
299
|
+
Sandboxes that have at least those tags are returned. Returns an iterator over `Sandbox` objects.
|
300
|
+
"""
|
301
|
+
...
|
203
302
|
|
204
303
|
SUPERSELF = typing.TypeVar("SUPERSELF", covariant=True)
|
205
304
|
|
206
305
|
class Sandbox(modal.object.Object):
|
306
|
+
"""A `Sandbox` object lets you interact with a running sandbox. This API is similar to Python's
|
307
|
+
[asyncio.subprocess.Process](https://docs.python.org/3/library/asyncio-subprocess.html#asyncio.subprocess.Process).
|
308
|
+
|
309
|
+
Refer to the [guide](https://modal.com/docs/guide/sandbox) on how to spawn and use sandboxes.
|
310
|
+
"""
|
311
|
+
|
207
312
|
_result: typing.Optional[modal_proto.api_pb2.GenericResult]
|
208
313
|
_stdout: modal.io_streams.StreamReader[str]
|
209
314
|
_stderr: modal.io_streams.StreamReader[str]
|
@@ -212,7 +317,10 @@ class Sandbox(modal.object.Object):
|
|
212
317
|
_tunnels: typing.Optional[dict[int, modal._tunnel.Tunnel]]
|
213
318
|
_enable_snapshot: bool
|
214
319
|
|
215
|
-
def __init__(self, *args, **kwargs):
|
320
|
+
def __init__(self, *args, **kwargs):
|
321
|
+
"""mdmd:hidden"""
|
322
|
+
...
|
323
|
+
|
216
324
|
@staticmethod
|
217
325
|
def _new(
|
218
326
|
entrypoint_args: collections.abc.Sequence[str],
|
@@ -240,7 +348,9 @@ class Sandbox(modal.object.Object):
|
|
240
348
|
_experimental_scheduler_placement: typing.Optional[modal.scheduler_placement.SchedulerPlacement] = None,
|
241
349
|
enable_snapshot: bool = False,
|
242
350
|
verbose: bool = False,
|
243
|
-
) -> Sandbox:
|
351
|
+
) -> Sandbox:
|
352
|
+
"""mdmd:hidden"""
|
353
|
+
...
|
244
354
|
|
245
355
|
class __create_spec(typing_extensions.Protocol):
|
246
356
|
def __call__(
|
@@ -276,7 +386,21 @@ class Sandbox(modal.object.Object):
|
|
276
386
|
_experimental_enable_snapshot: bool = False,
|
277
387
|
_experimental_scheduler_placement: typing.Optional[modal.scheduler_placement.SchedulerPlacement] = None,
|
278
388
|
client: typing.Optional[modal.client.Client] = None,
|
279
|
-
) -> Sandbox:
|
389
|
+
) -> Sandbox:
|
390
|
+
"""Create a new Sandbox to run untrusted, arbitrary code. The Sandbox's corresponding container
|
391
|
+
will be created asynchronously.
|
392
|
+
|
393
|
+
**Usage**
|
394
|
+
|
395
|
+
```python
|
396
|
+
app = modal.App.lookup('sandbox-hello-world', create_if_missing=True)
|
397
|
+
sandbox = modal.Sandbox.create("echo", "hello world", app=app)
|
398
|
+
print(sandbox.stdout.read())
|
399
|
+
sandbox.wait()
|
400
|
+
```
|
401
|
+
"""
|
402
|
+
...
|
403
|
+
|
280
404
|
async def aio(
|
281
405
|
self,
|
282
406
|
/,
|
@@ -310,7 +434,20 @@ class Sandbox(modal.object.Object):
|
|
310
434
|
_experimental_enable_snapshot: bool = False,
|
311
435
|
_experimental_scheduler_placement: typing.Optional[modal.scheduler_placement.SchedulerPlacement] = None,
|
312
436
|
client: typing.Optional[modal.client.Client] = None,
|
313
|
-
) -> Sandbox:
|
437
|
+
) -> Sandbox:
|
438
|
+
"""Create a new Sandbox to run untrusted, arbitrary code. The Sandbox's corresponding container
|
439
|
+
will be created asynchronously.
|
440
|
+
|
441
|
+
**Usage**
|
442
|
+
|
443
|
+
```python
|
444
|
+
app = modal.App.lookup('sandbox-hello-world', create_if_missing=True)
|
445
|
+
sandbox = modal.Sandbox.create("echo", "hello world", app=app)
|
446
|
+
print(sandbox.stdout.read())
|
447
|
+
sandbox.wait()
|
448
|
+
```
|
449
|
+
"""
|
450
|
+
...
|
314
451
|
|
315
452
|
create: __create_spec
|
316
453
|
|
@@ -391,44 +528,121 @@ class Sandbox(modal.object.Object):
|
|
391
528
|
def _hydrate_metadata(self, handle_metadata: typing.Optional[google.protobuf.message.Message]): ...
|
392
529
|
|
393
530
|
class __from_id_spec(typing_extensions.Protocol):
|
394
|
-
def __call__(self, /, sandbox_id: str, client: typing.Optional[modal.client.Client] = None) -> Sandbox:
|
395
|
-
|
531
|
+
def __call__(self, /, sandbox_id: str, client: typing.Optional[modal.client.Client] = None) -> Sandbox:
|
532
|
+
"""Construct a Sandbox from an id and look up the Sandbox result.
|
533
|
+
|
534
|
+
The ID of a Sandbox object can be accessed using `.object_id`.
|
535
|
+
"""
|
536
|
+
...
|
537
|
+
|
538
|
+
async def aio(self, /, sandbox_id: str, client: typing.Optional[modal.client.Client] = None) -> Sandbox:
|
539
|
+
"""Construct a Sandbox from an id and look up the Sandbox result.
|
540
|
+
|
541
|
+
The ID of a Sandbox object can be accessed using `.object_id`.
|
542
|
+
"""
|
543
|
+
...
|
396
544
|
|
397
545
|
from_id: __from_id_spec
|
398
546
|
|
399
547
|
class __set_tags_spec(typing_extensions.Protocol[SUPERSELF]):
|
400
|
-
def __call__(self, /, tags: dict[str, str], *, client: typing.Optional[modal.client.Client] = None):
|
401
|
-
|
548
|
+
def __call__(self, /, tags: dict[str, str], *, client: typing.Optional[modal.client.Client] = None):
|
549
|
+
"""Set tags (key-value pairs) on the Sandbox. Tags can be used to filter results in `Sandbox.list`."""
|
550
|
+
...
|
551
|
+
|
552
|
+
async def aio(self, /, tags: dict[str, str], *, client: typing.Optional[modal.client.Client] = None):
|
553
|
+
"""Set tags (key-value pairs) on the Sandbox. Tags can be used to filter results in `Sandbox.list`."""
|
554
|
+
...
|
402
555
|
|
403
556
|
set_tags: __set_tags_spec[typing_extensions.Self]
|
404
557
|
|
405
558
|
class __snapshot_filesystem_spec(typing_extensions.Protocol[SUPERSELF]):
|
406
|
-
def __call__(self, /, timeout: int = 55) -> modal.image.Image:
|
407
|
-
|
559
|
+
def __call__(self, /, timeout: int = 55) -> modal.image.Image:
|
560
|
+
"""Snapshot the filesystem of the Sandbox.
|
561
|
+
|
562
|
+
Returns an [`Image`](https://modal.com/docs/reference/modal.Image) object which
|
563
|
+
can be used to spawn a new Sandbox with the same filesystem.
|
564
|
+
"""
|
565
|
+
...
|
566
|
+
|
567
|
+
async def aio(self, /, timeout: int = 55) -> modal.image.Image:
|
568
|
+
"""Snapshot the filesystem of the Sandbox.
|
569
|
+
|
570
|
+
Returns an [`Image`](https://modal.com/docs/reference/modal.Image) object which
|
571
|
+
can be used to spawn a new Sandbox with the same filesystem.
|
572
|
+
"""
|
573
|
+
...
|
408
574
|
|
409
575
|
snapshot_filesystem: __snapshot_filesystem_spec[typing_extensions.Self]
|
410
576
|
|
411
577
|
class __wait_spec(typing_extensions.Protocol[SUPERSELF]):
|
412
|
-
def __call__(self, /, raise_on_termination: bool = True):
|
413
|
-
|
578
|
+
def __call__(self, /, raise_on_termination: bool = True):
|
579
|
+
"""Wait for the Sandbox to finish running."""
|
580
|
+
...
|
581
|
+
|
582
|
+
async def aio(self, /, raise_on_termination: bool = True):
|
583
|
+
"""Wait for the Sandbox to finish running."""
|
584
|
+
...
|
414
585
|
|
415
586
|
wait: __wait_spec[typing_extensions.Self]
|
416
587
|
|
417
588
|
class __tunnels_spec(typing_extensions.Protocol[SUPERSELF]):
|
418
|
-
def __call__(self, /, timeout: int = 50) -> dict[int, modal._tunnel.Tunnel]:
|
419
|
-
|
589
|
+
def __call__(self, /, timeout: int = 50) -> dict[int, modal._tunnel.Tunnel]:
|
590
|
+
"""Get Tunnel metadata for the sandbox.
|
591
|
+
|
592
|
+
Raises `SandboxTimeoutError` if the tunnels are not available after the timeout.
|
593
|
+
|
594
|
+
Returns a dictionary of `Tunnel` objects which are keyed by the container port.
|
595
|
+
|
596
|
+
NOTE: Previous to client [v0.64.153](https://modal.com/docs/reference/changelog#064153-2024-09-30), this
|
597
|
+
returned a list of `TunnelData` objects.
|
598
|
+
"""
|
599
|
+
...
|
600
|
+
|
601
|
+
async def aio(self, /, timeout: int = 50) -> dict[int, modal._tunnel.Tunnel]:
|
602
|
+
"""Get Tunnel metadata for the sandbox.
|
603
|
+
|
604
|
+
Raises `SandboxTimeoutError` if the tunnels are not available after the timeout.
|
605
|
+
|
606
|
+
Returns a dictionary of `Tunnel` objects which are keyed by the container port.
|
607
|
+
|
608
|
+
NOTE: Previous to client [v0.64.153](https://modal.com/docs/reference/changelog#064153-2024-09-30), this
|
609
|
+
returned a list of `TunnelData` objects.
|
610
|
+
"""
|
611
|
+
...
|
420
612
|
|
421
613
|
tunnels: __tunnels_spec[typing_extensions.Self]
|
422
614
|
|
423
615
|
class __terminate_spec(typing_extensions.Protocol[SUPERSELF]):
|
424
|
-
def __call__(self, /) -> None:
|
425
|
-
|
616
|
+
def __call__(self, /) -> None:
|
617
|
+
"""Terminate Sandbox execution.
|
618
|
+
|
619
|
+
This is a no-op if the Sandbox has already finished running.
|
620
|
+
"""
|
621
|
+
...
|
622
|
+
|
623
|
+
async def aio(self, /) -> None:
|
624
|
+
"""Terminate Sandbox execution.
|
625
|
+
|
626
|
+
This is a no-op if the Sandbox has already finished running.
|
627
|
+
"""
|
628
|
+
...
|
426
629
|
|
427
630
|
terminate: __terminate_spec[typing_extensions.Self]
|
428
631
|
|
429
632
|
class __poll_spec(typing_extensions.Protocol[SUPERSELF]):
|
430
|
-
def __call__(self, /) -> typing.Optional[int]:
|
431
|
-
|
633
|
+
def __call__(self, /) -> typing.Optional[int]:
|
634
|
+
"""Check if the Sandbox has finished running.
|
635
|
+
|
636
|
+
Returns `None` if the Sandbox is still running, else returns the exit code.
|
637
|
+
"""
|
638
|
+
...
|
639
|
+
|
640
|
+
async def aio(self, /) -> typing.Optional[int]:
|
641
|
+
"""Check if the Sandbox has finished running.
|
642
|
+
|
643
|
+
Returns `None` if the Sandbox is still running, else returns the exit code.
|
644
|
+
"""
|
645
|
+
...
|
432
646
|
|
433
647
|
poll: __poll_spec[typing_extensions.Self]
|
434
648
|
|
@@ -531,20 +745,35 @@ class Sandbox(modal.object.Object):
|
|
531
745
|
open: __open_spec[typing_extensions.Self]
|
532
746
|
|
533
747
|
class __ls_spec(typing_extensions.Protocol[SUPERSELF]):
|
534
|
-
def __call__(self, /, path: str) -> list[str]:
|
535
|
-
|
748
|
+
def __call__(self, /, path: str) -> list[str]:
|
749
|
+
"""List the contents of a directory in the Sandbox."""
|
750
|
+
...
|
751
|
+
|
752
|
+
async def aio(self, /, path: str) -> list[str]:
|
753
|
+
"""List the contents of a directory in the Sandbox."""
|
754
|
+
...
|
536
755
|
|
537
756
|
ls: __ls_spec[typing_extensions.Self]
|
538
757
|
|
539
758
|
class __mkdir_spec(typing_extensions.Protocol[SUPERSELF]):
|
540
|
-
def __call__(self, /, path: str, parents: bool = False) -> None:
|
541
|
-
|
759
|
+
def __call__(self, /, path: str, parents: bool = False) -> None:
|
760
|
+
"""Create a new directory in the Sandbox."""
|
761
|
+
...
|
762
|
+
|
763
|
+
async def aio(self, /, path: str, parents: bool = False) -> None:
|
764
|
+
"""Create a new directory in the Sandbox."""
|
765
|
+
...
|
542
766
|
|
543
767
|
mkdir: __mkdir_spec[typing_extensions.Self]
|
544
768
|
|
545
769
|
class __rm_spec(typing_extensions.Protocol[SUPERSELF]):
|
546
|
-
def __call__(self, /, path: str, recursive: bool = False) -> None:
|
547
|
-
|
770
|
+
def __call__(self, /, path: str, recursive: bool = False) -> None:
|
771
|
+
"""Remove a file or directory in the Sandbox."""
|
772
|
+
...
|
773
|
+
|
774
|
+
async def aio(self, /, path: str, recursive: bool = False) -> None:
|
775
|
+
"""Remove a file or directory in the Sandbox."""
|
776
|
+
...
|
548
777
|
|
549
778
|
rm: __rm_spec[typing_extensions.Self]
|
550
779
|
|
@@ -556,7 +785,10 @@ class Sandbox(modal.object.Object):
|
|
556
785
|
filter: typing.Optional[list[modal.file_io.FileWatchEventType]] = None,
|
557
786
|
recursive: typing.Optional[bool] = None,
|
558
787
|
timeout: typing.Optional[int] = None,
|
559
|
-
) -> typing.Iterator[modal.file_io.FileWatchEvent]:
|
788
|
+
) -> typing.Iterator[modal.file_io.FileWatchEvent]:
|
789
|
+
"""Watch a file or directory in the Sandbox for changes."""
|
790
|
+
...
|
791
|
+
|
560
792
|
def aio(
|
561
793
|
self,
|
562
794
|
/,
|
@@ -564,18 +796,37 @@ class Sandbox(modal.object.Object):
|
|
564
796
|
filter: typing.Optional[list[modal.file_io.FileWatchEventType]] = None,
|
565
797
|
recursive: typing.Optional[bool] = None,
|
566
798
|
timeout: typing.Optional[int] = None,
|
567
|
-
) -> typing.AsyncIterator[modal.file_io.FileWatchEvent]:
|
799
|
+
) -> typing.AsyncIterator[modal.file_io.FileWatchEvent]:
|
800
|
+
"""Watch a file or directory in the Sandbox for changes."""
|
801
|
+
...
|
568
802
|
|
569
803
|
watch: __watch_spec[typing_extensions.Self]
|
570
804
|
|
571
805
|
@property
|
572
|
-
def stdout(self) -> modal.io_streams.StreamReader[str]:
|
806
|
+
def stdout(self) -> modal.io_streams.StreamReader[str]:
|
807
|
+
"""[`StreamReader`](https://modal.com/docs/reference/modal.io_streams#modalio_streamsstreamreader) for
|
808
|
+
the sandbox's stdout stream.
|
809
|
+
"""
|
810
|
+
...
|
811
|
+
|
573
812
|
@property
|
574
|
-
def stderr(self) -> modal.io_streams.StreamReader[str]:
|
813
|
+
def stderr(self) -> modal.io_streams.StreamReader[str]:
|
814
|
+
"""[`StreamReader`](https://modal.com/docs/reference/modal.io_streams#modalio_streamsstreamreader) for
|
815
|
+
the Sandbox's stderr stream.
|
816
|
+
"""
|
817
|
+
...
|
818
|
+
|
575
819
|
@property
|
576
|
-
def stdin(self) -> modal.io_streams.StreamWriter:
|
820
|
+
def stdin(self) -> modal.io_streams.StreamWriter:
|
821
|
+
"""[`StreamWriter`](https://modal.com/docs/reference/modal.io_streams#modalio_streamsstreamwriter) for
|
822
|
+
the Sandbox's stdin stream.
|
823
|
+
"""
|
824
|
+
...
|
825
|
+
|
577
826
|
@property
|
578
|
-
def returncode(self) -> typing.Optional[int]:
|
827
|
+
def returncode(self) -> typing.Optional[int]:
|
828
|
+
"""Return code of the Sandbox process if it has finished running, else `None`."""
|
829
|
+
...
|
579
830
|
|
580
831
|
class __list_spec(typing_extensions.Protocol):
|
581
832
|
def __call__(
|
@@ -585,7 +836,12 @@ class Sandbox(modal.object.Object):
|
|
585
836
|
app_id: typing.Optional[str] = None,
|
586
837
|
tags: typing.Optional[dict[str, str]] = None,
|
587
838
|
client: typing.Optional[modal.client.Client] = None,
|
588
|
-
) -> typing.Generator[Sandbox, None, None]:
|
839
|
+
) -> typing.Generator[Sandbox, None, None]:
|
840
|
+
"""List all Sandboxes for the current Environment or App ID (if specified). If tags are specified, only
|
841
|
+
Sandboxes that have at least those tags are returned. Returns an iterator over `Sandbox` objects.
|
842
|
+
"""
|
843
|
+
...
|
844
|
+
|
589
845
|
def aio(
|
590
846
|
self,
|
591
847
|
/,
|
@@ -593,7 +849,11 @@ class Sandbox(modal.object.Object):
|
|
593
849
|
app_id: typing.Optional[str] = None,
|
594
850
|
tags: typing.Optional[dict[str, str]] = None,
|
595
851
|
client: typing.Optional[modal.client.Client] = None,
|
596
|
-
) -> collections.abc.AsyncGenerator[Sandbox, None]:
|
852
|
+
) -> collections.abc.AsyncGenerator[Sandbox, None]:
|
853
|
+
"""List all Sandboxes for the current Environment or App ID (if specified). If tags are specified, only
|
854
|
+
Sandboxes that have at least those tags are returned. Returns an iterator over `Sandbox` objects.
|
855
|
+
"""
|
856
|
+
...
|
597
857
|
|
598
858
|
list: __list_spec
|
599
859
|
|
modal/schedule.py
CHANGED
@@ -13,7 +13,7 @@ class Cron(Schedule):
|
|
13
13
|
"""Cron jobs are a type of schedule, specified using the
|
14
14
|
[Unix cron tab](https://crontab.guru/) syntax.
|
15
15
|
|
16
|
-
The alternative schedule type is the [`modal.Period`](/docs/reference/modal.Period).
|
16
|
+
The alternative schedule type is the [`modal.Period`](https://modal.com/docs/reference/modal.Period).
|
17
17
|
|
18
18
|
**Usage**
|
19
19
|
|
modal/secret.py
CHANGED
@@ -24,9 +24,9 @@ class _Secret(_Object, type_prefix="st"):
|
|
24
24
|
|
25
25
|
Secrets are a secure way to add credentials and other sensitive information
|
26
26
|
to the containers your functions run in. You can create and edit secrets on
|
27
|
-
[the dashboard](/secrets), or programmatically from Python code.
|
27
|
+
[the dashboard](https://modal.com/secrets), or programmatically from Python code.
|
28
28
|
|
29
|
-
See [the secrets guide page](/docs/guide/secrets) for more information.
|
29
|
+
See [the secrets guide page](https://modal.com/docs/guide/secrets) for more information.
|
30
30
|
"""
|
31
31
|
|
32
32
|
@staticmethod
|