modal 1.1.1.dev41__py3-none-any.whl → 1.1.2__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.
- modal/__main__.py +1 -2
- modal/_container_entrypoint.py +18 -7
- modal/_functions.py +135 -13
- modal/_object.py +13 -2
- modal/_partial_function.py +8 -8
- modal/_runtime/asgi.py +3 -2
- modal/_runtime/container_io_manager.py +20 -14
- modal/_runtime/container_io_manager.pyi +38 -13
- modal/_runtime/execution_context.py +18 -2
- modal/_runtime/execution_context.pyi +4 -1
- modal/_runtime/gpu_memory_snapshot.py +158 -54
- modal/_utils/blob_utils.py +83 -24
- modal/_utils/function_utils.py +4 -3
- modal/_utils/time_utils.py +28 -4
- modal/app.py +8 -4
- modal/app.pyi +8 -8
- modal/cli/dict.py +14 -11
- modal/cli/entry_point.py +9 -3
- modal/cli/launch.py +102 -4
- modal/cli/profile.py +1 -0
- modal/cli/programs/launch_instance_ssh.py +94 -0
- modal/cli/programs/run_marimo.py +95 -0
- modal/cli/queues.py +49 -19
- modal/cli/secret.py +45 -18
- modal/cli/volume.py +14 -16
- modal/client.pyi +2 -10
- modal/cls.py +12 -2
- modal/cls.pyi +9 -1
- modal/config.py +7 -7
- modal/dict.py +206 -12
- modal/dict.pyi +358 -4
- modal/experimental/__init__.py +130 -0
- modal/file_io.py +1 -1
- modal/file_io.pyi +2 -2
- modal/file_pattern_matcher.py +25 -16
- modal/functions.pyi +111 -11
- modal/image.py +9 -3
- modal/image.pyi +7 -7
- modal/mount.py +20 -13
- modal/mount.pyi +16 -3
- modal/network_file_system.py +8 -2
- modal/object.pyi +3 -0
- modal/parallel_map.py +346 -101
- modal/parallel_map.pyi +108 -0
- modal/proxy.py +2 -1
- modal/queue.py +199 -9
- modal/queue.pyi +357 -3
- modal/sandbox.py +6 -5
- modal/sandbox.pyi +17 -14
- modal/secret.py +196 -3
- modal/secret.pyi +372 -0
- modal/volume.py +239 -23
- modal/volume.pyi +405 -10
- {modal-1.1.1.dev41.dist-info → modal-1.1.2.dist-info}/METADATA +2 -2
- {modal-1.1.1.dev41.dist-info → modal-1.1.2.dist-info}/RECORD +68 -66
- modal_docs/mdmd/mdmd.py +11 -1
- modal_proto/api.proto +37 -10
- modal_proto/api_grpc.py +32 -0
- modal_proto/api_pb2.py +627 -597
- modal_proto/api_pb2.pyi +107 -19
- modal_proto/api_pb2_grpc.py +67 -2
- modal_proto/api_pb2_grpc.pyi +24 -8
- modal_proto/modal_api_grpc.py +2 -0
- modal_version/__init__.py +1 -1
- {modal-1.1.1.dev41.dist-info → modal-1.1.2.dist-info}/WHEEL +0 -0
- {modal-1.1.1.dev41.dist-info → modal-1.1.2.dist-info}/entry_points.txt +0 -0
- {modal-1.1.1.dev41.dist-info → modal-1.1.2.dist-info}/licenses/LICENSE +0 -0
- {modal-1.1.1.dev41.dist-info → modal-1.1.2.dist-info}/top_level.txt +0 -0
modal/secret.pyi
CHANGED
|
@@ -4,6 +4,7 @@ import modal._object
|
|
|
4
4
|
import modal.client
|
|
5
5
|
import modal.object
|
|
6
6
|
import modal_proto.api_pb2
|
|
7
|
+
import synchronicity
|
|
7
8
|
import typing
|
|
8
9
|
import typing_extensions
|
|
9
10
|
|
|
@@ -28,6 +29,332 @@ class SecretInfo:
|
|
|
28
29
|
"""Return self==value."""
|
|
29
30
|
...
|
|
30
31
|
|
|
32
|
+
class _SecretManager:
|
|
33
|
+
"""Namespace with methods for managing named Secret objects."""
|
|
34
|
+
@staticmethod
|
|
35
|
+
async def create(
|
|
36
|
+
name: str,
|
|
37
|
+
env_dict: dict[str, str],
|
|
38
|
+
*,
|
|
39
|
+
allow_existing: bool = False,
|
|
40
|
+
environment_name: typing.Optional[str] = None,
|
|
41
|
+
client: typing.Optional[modal.client._Client] = None,
|
|
42
|
+
) -> None:
|
|
43
|
+
"""Create a new Secret object.
|
|
44
|
+
|
|
45
|
+
**Examples:**
|
|
46
|
+
|
|
47
|
+
```python notest
|
|
48
|
+
contents = {"MY_KEY": "my-value", "MY_OTHER_KEY": "my-other-value"}
|
|
49
|
+
modal.Secret.objects.create("my-secret", contents)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Secrets will be created in the active environment, or another one can be specified:
|
|
53
|
+
|
|
54
|
+
```python notest
|
|
55
|
+
modal.Secret.objects.create("my-secret", contents, environment_name="dev")
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
By default, an error will be raised if the Secret already exists, but passing
|
|
59
|
+
`allow_existing=True` will make the creation attempt a no-op in this case.
|
|
60
|
+
If the `env_dict` data differs from the existing Secret, it will be ignored.
|
|
61
|
+
|
|
62
|
+
```python notest
|
|
63
|
+
modal.Secret.objects.create("my-secret", contents, allow_existing=True)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Note that this method does not return a local instance of the Secret. You can use
|
|
67
|
+
`modal.Secret.from_name` to perform a lookup after creation.
|
|
68
|
+
|
|
69
|
+
Added in v1.1.2.
|
|
70
|
+
"""
|
|
71
|
+
...
|
|
72
|
+
|
|
73
|
+
@staticmethod
|
|
74
|
+
async def list(
|
|
75
|
+
*,
|
|
76
|
+
max_objects: typing.Optional[int] = None,
|
|
77
|
+
created_before: typing.Union[datetime.datetime, str, None] = None,
|
|
78
|
+
environment_name: str = "",
|
|
79
|
+
client: typing.Optional[modal.client._Client] = None,
|
|
80
|
+
) -> list[_Secret]:
|
|
81
|
+
"""Return a list of hydrated Secret objects.
|
|
82
|
+
|
|
83
|
+
**Examples:**
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
secrets = modal.Secret.objects.list()
|
|
87
|
+
print([s.name for s in secrets])
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Secrets will be retreived from the active environment, or another one can be specified:
|
|
91
|
+
|
|
92
|
+
```python notest
|
|
93
|
+
dev_secrets = modal.Secret.objects.list(environment_name="dev")
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
By default, all named Secrets are returned, newest to oldest. It's also possible to limit the
|
|
97
|
+
number of results and to filter by creation date:
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
secrets = modal.Secret.objects.list(max_objects=10, created_before="2025-01-01")
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Added in v1.1.2.
|
|
104
|
+
"""
|
|
105
|
+
...
|
|
106
|
+
|
|
107
|
+
@staticmethod
|
|
108
|
+
async def delete(
|
|
109
|
+
name: str,
|
|
110
|
+
*,
|
|
111
|
+
allow_missing: bool = False,
|
|
112
|
+
environment_name: typing.Optional[str] = None,
|
|
113
|
+
client: typing.Optional[modal.client._Client] = None,
|
|
114
|
+
):
|
|
115
|
+
"""Delete a named Secret.
|
|
116
|
+
|
|
117
|
+
Warning: Deletion is irreversible and will affect any Apps currently using the Secret.
|
|
118
|
+
|
|
119
|
+
**Examples:**
|
|
120
|
+
|
|
121
|
+
```python notest
|
|
122
|
+
await modal.Secret.objects.delete("my-secret")
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Secrets will be deleted from the active environment, or another one can be specified:
|
|
126
|
+
|
|
127
|
+
```python notest
|
|
128
|
+
await modal.Secret.objects.delete("my-secret", environment_name="dev")
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Added in v1.1.2.
|
|
132
|
+
"""
|
|
133
|
+
...
|
|
134
|
+
|
|
135
|
+
class SecretManager:
|
|
136
|
+
"""Namespace with methods for managing named Secret objects."""
|
|
137
|
+
def __init__(self, /, *args, **kwargs):
|
|
138
|
+
"""Initialize self. See help(type(self)) for accurate signature."""
|
|
139
|
+
...
|
|
140
|
+
|
|
141
|
+
class __create_spec(typing_extensions.Protocol):
|
|
142
|
+
def __call__(
|
|
143
|
+
self,
|
|
144
|
+
/,
|
|
145
|
+
name: str,
|
|
146
|
+
env_dict: dict[str, str],
|
|
147
|
+
*,
|
|
148
|
+
allow_existing: bool = False,
|
|
149
|
+
environment_name: typing.Optional[str] = None,
|
|
150
|
+
client: typing.Optional[modal.client.Client] = None,
|
|
151
|
+
) -> None:
|
|
152
|
+
"""Create a new Secret object.
|
|
153
|
+
|
|
154
|
+
**Examples:**
|
|
155
|
+
|
|
156
|
+
```python notest
|
|
157
|
+
contents = {"MY_KEY": "my-value", "MY_OTHER_KEY": "my-other-value"}
|
|
158
|
+
modal.Secret.objects.create("my-secret", contents)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Secrets will be created in the active environment, or another one can be specified:
|
|
162
|
+
|
|
163
|
+
```python notest
|
|
164
|
+
modal.Secret.objects.create("my-secret", contents, environment_name="dev")
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
By default, an error will be raised if the Secret already exists, but passing
|
|
168
|
+
`allow_existing=True` will make the creation attempt a no-op in this case.
|
|
169
|
+
If the `env_dict` data differs from the existing Secret, it will be ignored.
|
|
170
|
+
|
|
171
|
+
```python notest
|
|
172
|
+
modal.Secret.objects.create("my-secret", contents, allow_existing=True)
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Note that this method does not return a local instance of the Secret. You can use
|
|
176
|
+
`modal.Secret.from_name` to perform a lookup after creation.
|
|
177
|
+
|
|
178
|
+
Added in v1.1.2.
|
|
179
|
+
"""
|
|
180
|
+
...
|
|
181
|
+
|
|
182
|
+
async def aio(
|
|
183
|
+
self,
|
|
184
|
+
/,
|
|
185
|
+
name: str,
|
|
186
|
+
env_dict: dict[str, str],
|
|
187
|
+
*,
|
|
188
|
+
allow_existing: bool = False,
|
|
189
|
+
environment_name: typing.Optional[str] = None,
|
|
190
|
+
client: typing.Optional[modal.client.Client] = None,
|
|
191
|
+
) -> None:
|
|
192
|
+
"""Create a new Secret object.
|
|
193
|
+
|
|
194
|
+
**Examples:**
|
|
195
|
+
|
|
196
|
+
```python notest
|
|
197
|
+
contents = {"MY_KEY": "my-value", "MY_OTHER_KEY": "my-other-value"}
|
|
198
|
+
modal.Secret.objects.create("my-secret", contents)
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Secrets will be created in the active environment, or another one can be specified:
|
|
202
|
+
|
|
203
|
+
```python notest
|
|
204
|
+
modal.Secret.objects.create("my-secret", contents, environment_name="dev")
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
By default, an error will be raised if the Secret already exists, but passing
|
|
208
|
+
`allow_existing=True` will make the creation attempt a no-op in this case.
|
|
209
|
+
If the `env_dict` data differs from the existing Secret, it will be ignored.
|
|
210
|
+
|
|
211
|
+
```python notest
|
|
212
|
+
modal.Secret.objects.create("my-secret", contents, allow_existing=True)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Note that this method does not return a local instance of the Secret. You can use
|
|
216
|
+
`modal.Secret.from_name` to perform a lookup after creation.
|
|
217
|
+
|
|
218
|
+
Added in v1.1.2.
|
|
219
|
+
"""
|
|
220
|
+
...
|
|
221
|
+
|
|
222
|
+
create: __create_spec
|
|
223
|
+
|
|
224
|
+
class __list_spec(typing_extensions.Protocol):
|
|
225
|
+
def __call__(
|
|
226
|
+
self,
|
|
227
|
+
/,
|
|
228
|
+
*,
|
|
229
|
+
max_objects: typing.Optional[int] = None,
|
|
230
|
+
created_before: typing.Union[datetime.datetime, str, None] = None,
|
|
231
|
+
environment_name: str = "",
|
|
232
|
+
client: typing.Optional[modal.client.Client] = None,
|
|
233
|
+
) -> list[Secret]:
|
|
234
|
+
"""Return a list of hydrated Secret objects.
|
|
235
|
+
|
|
236
|
+
**Examples:**
|
|
237
|
+
|
|
238
|
+
```python
|
|
239
|
+
secrets = modal.Secret.objects.list()
|
|
240
|
+
print([s.name for s in secrets])
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Secrets will be retreived from the active environment, or another one can be specified:
|
|
244
|
+
|
|
245
|
+
```python notest
|
|
246
|
+
dev_secrets = modal.Secret.objects.list(environment_name="dev")
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
By default, all named Secrets are returned, newest to oldest. It's also possible to limit the
|
|
250
|
+
number of results and to filter by creation date:
|
|
251
|
+
|
|
252
|
+
```python
|
|
253
|
+
secrets = modal.Secret.objects.list(max_objects=10, created_before="2025-01-01")
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Added in v1.1.2.
|
|
257
|
+
"""
|
|
258
|
+
...
|
|
259
|
+
|
|
260
|
+
async def aio(
|
|
261
|
+
self,
|
|
262
|
+
/,
|
|
263
|
+
*,
|
|
264
|
+
max_objects: typing.Optional[int] = None,
|
|
265
|
+
created_before: typing.Union[datetime.datetime, str, None] = None,
|
|
266
|
+
environment_name: str = "",
|
|
267
|
+
client: typing.Optional[modal.client.Client] = None,
|
|
268
|
+
) -> list[Secret]:
|
|
269
|
+
"""Return a list of hydrated Secret objects.
|
|
270
|
+
|
|
271
|
+
**Examples:**
|
|
272
|
+
|
|
273
|
+
```python
|
|
274
|
+
secrets = modal.Secret.objects.list()
|
|
275
|
+
print([s.name for s in secrets])
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Secrets will be retreived from the active environment, or another one can be specified:
|
|
279
|
+
|
|
280
|
+
```python notest
|
|
281
|
+
dev_secrets = modal.Secret.objects.list(environment_name="dev")
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
By default, all named Secrets are returned, newest to oldest. It's also possible to limit the
|
|
285
|
+
number of results and to filter by creation date:
|
|
286
|
+
|
|
287
|
+
```python
|
|
288
|
+
secrets = modal.Secret.objects.list(max_objects=10, created_before="2025-01-01")
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Added in v1.1.2.
|
|
292
|
+
"""
|
|
293
|
+
...
|
|
294
|
+
|
|
295
|
+
list: __list_spec
|
|
296
|
+
|
|
297
|
+
class __delete_spec(typing_extensions.Protocol):
|
|
298
|
+
def __call__(
|
|
299
|
+
self,
|
|
300
|
+
/,
|
|
301
|
+
name: str,
|
|
302
|
+
*,
|
|
303
|
+
allow_missing: bool = False,
|
|
304
|
+
environment_name: typing.Optional[str] = None,
|
|
305
|
+
client: typing.Optional[modal.client.Client] = None,
|
|
306
|
+
):
|
|
307
|
+
"""Delete a named Secret.
|
|
308
|
+
|
|
309
|
+
Warning: Deletion is irreversible and will affect any Apps currently using the Secret.
|
|
310
|
+
|
|
311
|
+
**Examples:**
|
|
312
|
+
|
|
313
|
+
```python notest
|
|
314
|
+
await modal.Secret.objects.delete("my-secret")
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Secrets will be deleted from the active environment, or another one can be specified:
|
|
318
|
+
|
|
319
|
+
```python notest
|
|
320
|
+
await modal.Secret.objects.delete("my-secret", environment_name="dev")
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Added in v1.1.2.
|
|
324
|
+
"""
|
|
325
|
+
...
|
|
326
|
+
|
|
327
|
+
async def aio(
|
|
328
|
+
self,
|
|
329
|
+
/,
|
|
330
|
+
name: str,
|
|
331
|
+
*,
|
|
332
|
+
allow_missing: bool = False,
|
|
333
|
+
environment_name: typing.Optional[str] = None,
|
|
334
|
+
client: typing.Optional[modal.client.Client] = None,
|
|
335
|
+
):
|
|
336
|
+
"""Delete a named Secret.
|
|
337
|
+
|
|
338
|
+
Warning: Deletion is irreversible and will affect any Apps currently using the Secret.
|
|
339
|
+
|
|
340
|
+
**Examples:**
|
|
341
|
+
|
|
342
|
+
```python notest
|
|
343
|
+
await modal.Secret.objects.delete("my-secret")
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Secrets will be deleted from the active environment, or another one can be specified:
|
|
347
|
+
|
|
348
|
+
```python notest
|
|
349
|
+
await modal.Secret.objects.delete("my-secret", environment_name="dev")
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
Added in v1.1.2.
|
|
353
|
+
"""
|
|
354
|
+
...
|
|
355
|
+
|
|
356
|
+
delete: __delete_spec
|
|
357
|
+
|
|
31
358
|
class _Secret(modal._object._Object):
|
|
32
359
|
"""Secrets provide a dictionary of environment variables for images.
|
|
33
360
|
|
|
@@ -40,6 +367,8 @@ class _Secret(modal._object._Object):
|
|
|
40
367
|
|
|
41
368
|
_metadata: typing.Optional[modal_proto.api_pb2.SecretMetadata]
|
|
42
369
|
|
|
370
|
+
@synchronicity.classproperty
|
|
371
|
+
def objects(cls) -> _SecretManager: ...
|
|
43
372
|
@property
|
|
44
373
|
def name(self) -> typing.Optional[str]: ...
|
|
45
374
|
def _hydrate_metadata(self, metadata: typing.Optional[google.protobuf.message.Message]): ...
|
|
@@ -135,6 +464,18 @@ class _Secret(modal._object._Object):
|
|
|
135
464
|
"""mdmd:hidden"""
|
|
136
465
|
...
|
|
137
466
|
|
|
467
|
+
@staticmethod
|
|
468
|
+
async def _create_deployed(
|
|
469
|
+
deployment_name: str,
|
|
470
|
+
env_dict: dict[str, str],
|
|
471
|
+
namespace=None,
|
|
472
|
+
client: typing.Optional[modal.client._Client] = None,
|
|
473
|
+
environment_name: typing.Optional[str] = None,
|
|
474
|
+
overwrite: bool = False,
|
|
475
|
+
) -> str:
|
|
476
|
+
"""mdmd:hidden"""
|
|
477
|
+
...
|
|
478
|
+
|
|
138
479
|
async def info(self) -> SecretInfo:
|
|
139
480
|
"""Return information about the Secret object."""
|
|
140
481
|
...
|
|
@@ -157,6 +498,8 @@ class Secret(modal.object.Object):
|
|
|
157
498
|
"""mdmd:hidden"""
|
|
158
499
|
...
|
|
159
500
|
|
|
501
|
+
@synchronicity.classproperty
|
|
502
|
+
def objects(cls) -> SecretManager: ...
|
|
160
503
|
@property
|
|
161
504
|
def name(self) -> typing.Optional[str]: ...
|
|
162
505
|
def _hydrate_metadata(self, metadata: typing.Optional[google.protobuf.message.Message]): ...
|
|
@@ -285,6 +628,35 @@ class Secret(modal.object.Object):
|
|
|
285
628
|
|
|
286
629
|
create_deployed: __create_deployed_spec
|
|
287
630
|
|
|
631
|
+
class ___create_deployed_spec(typing_extensions.Protocol):
|
|
632
|
+
def __call__(
|
|
633
|
+
self,
|
|
634
|
+
/,
|
|
635
|
+
deployment_name: str,
|
|
636
|
+
env_dict: dict[str, str],
|
|
637
|
+
namespace=None,
|
|
638
|
+
client: typing.Optional[modal.client.Client] = None,
|
|
639
|
+
environment_name: typing.Optional[str] = None,
|
|
640
|
+
overwrite: bool = False,
|
|
641
|
+
) -> str:
|
|
642
|
+
"""mdmd:hidden"""
|
|
643
|
+
...
|
|
644
|
+
|
|
645
|
+
async def aio(
|
|
646
|
+
self,
|
|
647
|
+
/,
|
|
648
|
+
deployment_name: str,
|
|
649
|
+
env_dict: dict[str, str],
|
|
650
|
+
namespace=None,
|
|
651
|
+
client: typing.Optional[modal.client.Client] = None,
|
|
652
|
+
environment_name: typing.Optional[str] = None,
|
|
653
|
+
overwrite: bool = False,
|
|
654
|
+
) -> str:
|
|
655
|
+
"""mdmd:hidden"""
|
|
656
|
+
...
|
|
657
|
+
|
|
658
|
+
_create_deployed: ___create_deployed_spec
|
|
659
|
+
|
|
288
660
|
class __info_spec(typing_extensions.Protocol[SUPERSELF]):
|
|
289
661
|
def __call__(self, /) -> SecretInfo:
|
|
290
662
|
"""Return information about the Secret object."""
|