modal 0.68.31__py3-none-any.whl → 0.68.40__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/_traceback.py +6 -2
- modal/_utils/deprecation.py +45 -0
- modal/app.py +5 -4
- modal/app.pyi +3 -3
- modal/cli/dict.py +6 -2
- modal/cli/network_file_system.py +1 -1
- modal/cli/run.py +1 -0
- modal/cli/volume.py +1 -1
- modal/client.pyi +2 -2
- modal/cls.py +15 -9
- modal/cls.pyi +5 -5
- modal/dict.py +11 -8
- modal/dict.pyi +8 -8
- modal/environments.py +10 -7
- modal/environments.pyi +6 -6
- modal/functions.py +10 -6
- modal/functions.pyi +13 -11
- modal/mount.py +7 -4
- modal/mount.pyi +4 -4
- modal/network_file_system.py +12 -9
- modal/network_file_system.pyi +8 -8
- modal/partial_function.py +0 -23
- modal/queue.py +11 -8
- modal/queue.pyi +8 -8
- modal/sandbox.py +2 -0
- modal/secret.py +7 -4
- modal/secret.pyi +5 -5
- modal/volume.py +11 -8
- modal/volume.pyi +8 -8
- {modal-0.68.31.dist-info → modal-0.68.40.dist-info}/METADATA +2 -2
- {modal-0.68.31.dist-info → modal-0.68.40.dist-info}/RECORD +36 -36
- modal_version/_version_generated.py +1 -1
- {modal-0.68.31.dist-info → modal-0.68.40.dist-info}/LICENSE +0 -0
- {modal-0.68.31.dist-info → modal-0.68.40.dist-info}/WHEEL +0 -0
- {modal-0.68.31.dist-info → modal-0.68.40.dist-info}/entry_points.txt +0 -0
- {modal-0.68.31.dist-info → modal-0.68.40.dist-info}/top_level.txt +0 -0
modal/functions.pyi
CHANGED
@@ -100,6 +100,7 @@ class _FunctionSpec:
|
|
100
100
|
memory: typing.Union[int, tuple[int, int], None]
|
101
101
|
ephemeral_disk: typing.Optional[int]
|
102
102
|
scheduler_placement: typing.Optional[modal.scheduler_placement.SchedulerPlacement]
|
103
|
+
proxy: typing.Optional[modal.proxy._Proxy]
|
103
104
|
|
104
105
|
def __init__(
|
105
106
|
self,
|
@@ -121,6 +122,7 @@ class _FunctionSpec:
|
|
121
122
|
memory: typing.Union[int, tuple[int, int], None],
|
122
123
|
ephemeral_disk: typing.Optional[int],
|
123
124
|
scheduler_placement: typing.Optional[modal.scheduler_placement.SchedulerPlacement],
|
125
|
+
proxy: typing.Optional[modal.proxy._Proxy],
|
124
126
|
) -> None: ...
|
125
127
|
def __repr__(self): ...
|
126
128
|
def __eq__(self, other): ...
|
@@ -206,12 +208,12 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.
|
|
206
208
|
async def keep_warm(self, warm_pool_size: int) -> None: ...
|
207
209
|
@classmethod
|
208
210
|
def from_name(
|
209
|
-
cls: type[_Function], app_name: str,
|
211
|
+
cls: type[_Function], app_name: str, name: str, namespace=1, environment_name: typing.Optional[str] = None
|
210
212
|
) -> _Function: ...
|
211
213
|
@staticmethod
|
212
214
|
async def lookup(
|
213
215
|
app_name: str,
|
214
|
-
|
216
|
+
name: str,
|
215
217
|
namespace=1,
|
216
218
|
client: typing.Optional[modal.client._Client] = None,
|
217
219
|
environment_name: typing.Optional[str] = None,
|
@@ -381,14 +383,14 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
|
|
381
383
|
|
382
384
|
@classmethod
|
383
385
|
def from_name(
|
384
|
-
cls: type[Function], app_name: str,
|
386
|
+
cls: type[Function], app_name: str, name: str, namespace=1, environment_name: typing.Optional[str] = None
|
385
387
|
) -> Function: ...
|
386
388
|
|
387
389
|
class __lookup_spec(typing_extensions.Protocol):
|
388
390
|
def __call__(
|
389
391
|
self,
|
390
392
|
app_name: str,
|
391
|
-
|
393
|
+
name: str,
|
392
394
|
namespace=1,
|
393
395
|
client: typing.Optional[modal.client.Client] = None,
|
394
396
|
environment_name: typing.Optional[str] = None,
|
@@ -396,7 +398,7 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
|
|
396
398
|
async def aio(
|
397
399
|
self,
|
398
400
|
app_name: str,
|
399
|
-
|
401
|
+
name: str,
|
400
402
|
namespace=1,
|
401
403
|
client: typing.Optional[modal.client.Client] = None,
|
402
404
|
environment_name: typing.Optional[str] = None,
|
@@ -460,11 +462,11 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
|
|
460
462
|
|
461
463
|
_call_generator_nowait: ___call_generator_nowait_spec
|
462
464
|
|
463
|
-
class __remote_spec(typing_extensions.Protocol[
|
465
|
+
class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
|
464
466
|
def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
|
465
467
|
async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
|
466
468
|
|
467
|
-
remote: __remote_spec[
|
469
|
+
remote: __remote_spec[ReturnType, P]
|
468
470
|
|
469
471
|
class __remote_gen_spec(typing_extensions.Protocol):
|
470
472
|
def __call__(self, *args, **kwargs) -> typing.Generator[typing.Any, None, None]: ...
|
@@ -477,17 +479,17 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
|
|
477
479
|
def _get_obj(self) -> typing.Optional[modal.cls.Obj]: ...
|
478
480
|
def local(self, *args: P.args, **kwargs: P.kwargs) -> OriginalReturnType: ...
|
479
481
|
|
480
|
-
class ___experimental_spawn_spec(typing_extensions.Protocol[
|
482
|
+
class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
|
481
483
|
def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
|
482
484
|
async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
|
483
485
|
|
484
|
-
_experimental_spawn: ___experimental_spawn_spec[
|
486
|
+
_experimental_spawn: ___experimental_spawn_spec[ReturnType, P]
|
485
487
|
|
486
|
-
class __spawn_spec(typing_extensions.Protocol[
|
488
|
+
class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
|
487
489
|
def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
|
488
490
|
async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
|
489
491
|
|
490
|
-
spawn: __spawn_spec[
|
492
|
+
spawn: __spawn_spec[ReturnType, P]
|
491
493
|
|
492
494
|
def get_raw_f(self) -> typing.Callable[..., typing.Any]: ...
|
493
495
|
|
modal/mount.py
CHANGED
@@ -22,6 +22,7 @@ from modal_version import __version__
|
|
22
22
|
from ._resolver import Resolver
|
23
23
|
from ._utils.async_utils import aclosing, async_map, synchronize_api
|
24
24
|
from ._utils.blob_utils import FileUploadSpec, blob_upload_file, get_file_upload_spec_from_path
|
25
|
+
from ._utils.deprecation import renamed_parameter
|
25
26
|
from ._utils.grpc_utils import retry_transient_errors
|
26
27
|
from ._utils.name_utils import check_object_name
|
27
28
|
from ._utils.package_utils import get_module_mount_info
|
@@ -623,8 +624,9 @@ class _Mount(_Object, type_prefix="mo"):
|
|
623
624
|
return mount
|
624
625
|
|
625
626
|
@staticmethod
|
627
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
626
628
|
def from_name(
|
627
|
-
|
629
|
+
name: str,
|
628
630
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
629
631
|
environment_name: Optional[str] = None,
|
630
632
|
) -> "_Mount":
|
@@ -632,7 +634,7 @@ class _Mount(_Object, type_prefix="mo"):
|
|
632
634
|
|
633
635
|
async def _load(provider: _Mount, resolver: Resolver, existing_object_id: Optional[str]):
|
634
636
|
req = api_pb2.MountGetOrCreateRequest(
|
635
|
-
deployment_name=
|
637
|
+
deployment_name=name,
|
636
638
|
namespace=namespace,
|
637
639
|
environment_name=_get_environment_name(environment_name, resolver),
|
638
640
|
)
|
@@ -642,15 +644,16 @@ class _Mount(_Object, type_prefix="mo"):
|
|
642
644
|
return _Mount._from_loader(_load, "Mount()")
|
643
645
|
|
644
646
|
@classmethod
|
647
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
645
648
|
async def lookup(
|
646
649
|
cls: type["_Mount"],
|
647
|
-
|
650
|
+
name: str,
|
648
651
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
649
652
|
client: Optional[_Client] = None,
|
650
653
|
environment_name: Optional[str] = None,
|
651
654
|
) -> "_Mount":
|
652
655
|
"""mdmd:hidden"""
|
653
|
-
obj = _Mount.from_name(
|
656
|
+
obj = _Mount.from_name(name, namespace=namespace, environment_name=environment_name)
|
654
657
|
if client is None:
|
655
658
|
client = await _Client.from_env()
|
656
659
|
resolver = Resolver(client=client)
|
modal/mount.pyi
CHANGED
@@ -139,11 +139,11 @@ class _Mount(modal.object._Object):
|
|
139
139
|
ignore: typing.Union[typing.Sequence[str], typing.Callable[[pathlib.Path], bool], None] = None,
|
140
140
|
) -> _Mount: ...
|
141
141
|
@staticmethod
|
142
|
-
def from_name(
|
142
|
+
def from_name(name: str, namespace=1, environment_name: typing.Optional[str] = None) -> _Mount: ...
|
143
143
|
@classmethod
|
144
144
|
async def lookup(
|
145
145
|
cls: type[_Mount],
|
146
|
-
|
146
|
+
name: str,
|
147
147
|
namespace=1,
|
148
148
|
client: typing.Optional[modal.client._Client] = None,
|
149
149
|
environment_name: typing.Optional[str] = None,
|
@@ -231,11 +231,11 @@ class Mount(modal.object.Object):
|
|
231
231
|
ignore: typing.Union[typing.Sequence[str], typing.Callable[[pathlib.Path], bool], None] = None,
|
232
232
|
) -> Mount: ...
|
233
233
|
@staticmethod
|
234
|
-
def from_name(
|
234
|
+
def from_name(name: str, namespace=1, environment_name: typing.Optional[str] = None) -> Mount: ...
|
235
235
|
@classmethod
|
236
236
|
def lookup(
|
237
237
|
cls: type[Mount],
|
238
|
-
|
238
|
+
name: str,
|
239
239
|
namespace=1,
|
240
240
|
client: typing.Optional[modal.client.Client] = None,
|
241
241
|
environment_name: typing.Optional[str] = None,
|
modal/network_file_system.py
CHANGED
@@ -15,7 +15,7 @@ from modal_proto import api_pb2
|
|
15
15
|
from ._resolver import Resolver
|
16
16
|
from ._utils.async_utils import TaskContext, aclosing, async_map, sync_or_async_iter, synchronize_api
|
17
17
|
from ._utils.blob_utils import LARGE_FILE_LIMIT, blob_iter, blob_upload_file
|
18
|
-
from ._utils.deprecation import deprecation_error
|
18
|
+
from ._utils.deprecation import deprecation_error, renamed_parameter
|
19
19
|
from ._utils.grpc_utils import retry_transient_errors
|
20
20
|
from ._utils.hash_utils import get_sha256_hex
|
21
21
|
from ._utils.name_utils import check_object_name
|
@@ -101,8 +101,9 @@ class _NetworkFileSystem(_Object, type_prefix="sv"):
|
|
101
101
|
deprecation_error((2024, 3, 20), message)
|
102
102
|
|
103
103
|
@staticmethod
|
104
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
104
105
|
def from_name(
|
105
|
-
|
106
|
+
name: str,
|
106
107
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
107
108
|
environment_name: Optional[str] = None,
|
108
109
|
create_if_missing: bool = False,
|
@@ -121,11 +122,11 @@ class _NetworkFileSystem(_Object, type_prefix="sv"):
|
|
121
122
|
pass
|
122
123
|
```
|
123
124
|
"""
|
124
|
-
check_object_name(
|
125
|
+
check_object_name(name, "NetworkFileSystem")
|
125
126
|
|
126
127
|
async def _load(self: _NetworkFileSystem, resolver: Resolver, existing_object_id: Optional[str]):
|
127
128
|
req = api_pb2.SharedVolumeGetOrCreateRequest(
|
128
|
-
deployment_name=
|
129
|
+
deployment_name=name,
|
129
130
|
namespace=namespace,
|
130
131
|
environment_name=_get_environment_name(environment_name, resolver),
|
131
132
|
object_creation_type=(api_pb2.OBJECT_CREATION_TYPE_CREATE_IF_MISSING if create_if_missing else None),
|
@@ -136,7 +137,7 @@ class _NetworkFileSystem(_Object, type_prefix="sv"):
|
|
136
137
|
except GRPCError as exc:
|
137
138
|
if exc.status == Status.NOT_FOUND and exc.message == "App has wrong entity vo":
|
138
139
|
raise InvalidError(
|
139
|
-
f"Attempted to mount: `{
|
140
|
+
f"Attempted to mount: `{name}` as a NetworkFileSystem " + "which already exists as a Volume"
|
140
141
|
)
|
141
142
|
raise
|
142
143
|
|
@@ -176,8 +177,9 @@ class _NetworkFileSystem(_Object, type_prefix="sv"):
|
|
176
177
|
yield cls._new_hydrated(response.shared_volume_id, client, None, is_another_app=True)
|
177
178
|
|
178
179
|
@staticmethod
|
180
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
179
181
|
async def lookup(
|
180
|
-
|
182
|
+
name: str,
|
181
183
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
182
184
|
client: Optional[_Client] = None,
|
183
185
|
environment_name: Optional[str] = None,
|
@@ -194,7 +196,7 @@ class _NetworkFileSystem(_Object, type_prefix="sv"):
|
|
194
196
|
```
|
195
197
|
"""
|
196
198
|
obj = _NetworkFileSystem.from_name(
|
197
|
-
|
199
|
+
name, namespace=namespace, environment_name=environment_name, create_if_missing=create_if_missing
|
198
200
|
)
|
199
201
|
if client is None:
|
200
202
|
client = await _Client.from_env()
|
@@ -223,8 +225,9 @@ class _NetworkFileSystem(_Object, type_prefix="sv"):
|
|
223
225
|
return resp.shared_volume_id
|
224
226
|
|
225
227
|
@staticmethod
|
226
|
-
|
227
|
-
|
228
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
229
|
+
async def delete(name: str, client: Optional[_Client] = None, environment_name: Optional[str] = None):
|
230
|
+
obj = await _NetworkFileSystem.lookup(name, client=client, environment_name=environment_name)
|
228
231
|
req = api_pb2.SharedVolumeDeleteRequest(shared_volume_id=obj.object_id)
|
229
232
|
await retry_transient_errors(obj._client.stub.SharedVolumeDelete, req)
|
230
233
|
|
modal/network_file_system.pyi
CHANGED
@@ -17,7 +17,7 @@ class _NetworkFileSystem(modal.object._Object):
|
|
17
17
|
def new(cloud: typing.Optional[str] = None): ...
|
18
18
|
@staticmethod
|
19
19
|
def from_name(
|
20
|
-
|
20
|
+
name: str, namespace=1, environment_name: typing.Optional[str] = None, create_if_missing: bool = False
|
21
21
|
) -> _NetworkFileSystem: ...
|
22
22
|
@classmethod
|
23
23
|
def ephemeral(
|
@@ -28,7 +28,7 @@ class _NetworkFileSystem(modal.object._Object):
|
|
28
28
|
) -> typing.AsyncContextManager[_NetworkFileSystem]: ...
|
29
29
|
@staticmethod
|
30
30
|
async def lookup(
|
31
|
-
|
31
|
+
name: str,
|
32
32
|
namespace=1,
|
33
33
|
client: typing.Optional[modal.client._Client] = None,
|
34
34
|
environment_name: typing.Optional[str] = None,
|
@@ -43,7 +43,7 @@ class _NetworkFileSystem(modal.object._Object):
|
|
43
43
|
) -> str: ...
|
44
44
|
@staticmethod
|
45
45
|
async def delete(
|
46
|
-
|
46
|
+
name: str, client: typing.Optional[modal.client._Client] = None, environment_name: typing.Optional[str] = None
|
47
47
|
): ...
|
48
48
|
async def write_file(
|
49
49
|
self,
|
@@ -74,7 +74,7 @@ class NetworkFileSystem(modal.object.Object):
|
|
74
74
|
def new(cloud: typing.Optional[str] = None): ...
|
75
75
|
@staticmethod
|
76
76
|
def from_name(
|
77
|
-
|
77
|
+
name: str, namespace=1, environment_name: typing.Optional[str] = None, create_if_missing: bool = False
|
78
78
|
) -> NetworkFileSystem: ...
|
79
79
|
@classmethod
|
80
80
|
def ephemeral(
|
@@ -87,7 +87,7 @@ class NetworkFileSystem(modal.object.Object):
|
|
87
87
|
class __lookup_spec(typing_extensions.Protocol):
|
88
88
|
def __call__(
|
89
89
|
self,
|
90
|
-
|
90
|
+
name: str,
|
91
91
|
namespace=1,
|
92
92
|
client: typing.Optional[modal.client.Client] = None,
|
93
93
|
environment_name: typing.Optional[str] = None,
|
@@ -95,7 +95,7 @@ class NetworkFileSystem(modal.object.Object):
|
|
95
95
|
) -> NetworkFileSystem: ...
|
96
96
|
async def aio(
|
97
97
|
self,
|
98
|
-
|
98
|
+
name: str,
|
99
99
|
namespace=1,
|
100
100
|
client: typing.Optional[modal.client.Client] = None,
|
101
101
|
environment_name: typing.Optional[str] = None,
|
@@ -125,13 +125,13 @@ class NetworkFileSystem(modal.object.Object):
|
|
125
125
|
class __delete_spec(typing_extensions.Protocol):
|
126
126
|
def __call__(
|
127
127
|
self,
|
128
|
-
|
128
|
+
name: str,
|
129
129
|
client: typing.Optional[modal.client.Client] = None,
|
130
130
|
environment_name: typing.Optional[str] = None,
|
131
131
|
): ...
|
132
132
|
async def aio(
|
133
133
|
self,
|
134
|
-
|
134
|
+
name: str,
|
135
135
|
client: typing.Optional[modal.client.Client] = None,
|
136
136
|
environment_name: typing.Optional[str] = None,
|
137
137
|
): ...
|
modal/partial_function.py
CHANGED
@@ -138,29 +138,6 @@ PartialFunction = synchronize_api(_PartialFunction)
|
|
138
138
|
def _find_partial_methods_for_user_cls(user_cls: type[Any], flags: int) -> dict[str, _PartialFunction]:
|
139
139
|
"""Grabs all method on a user class, and returns partials. Includes legacy methods."""
|
140
140
|
|
141
|
-
# Build up a list of legacy attributes to check
|
142
|
-
check_attrs: list[str] = []
|
143
|
-
if flags & _PartialFunctionFlags.BUILD:
|
144
|
-
check_attrs += ["__build__", "__abuild__"]
|
145
|
-
if flags & _PartialFunctionFlags.ENTER_POST_SNAPSHOT:
|
146
|
-
check_attrs += ["__enter__", "__aenter__"]
|
147
|
-
if flags & _PartialFunctionFlags.EXIT:
|
148
|
-
check_attrs += ["__exit__", "__aexit__"]
|
149
|
-
|
150
|
-
# Grab legacy lifecycle methods
|
151
|
-
for attr in check_attrs:
|
152
|
-
if hasattr(user_cls, attr):
|
153
|
-
suggested = attr.strip("_")
|
154
|
-
if is_async := suggested.startswith("a"):
|
155
|
-
suggested = suggested[1:]
|
156
|
-
async_suggestion = " (on an async method)" if is_async else ""
|
157
|
-
message = (
|
158
|
-
f"Using `{attr}` methods for class lifecycle management is deprecated."
|
159
|
-
f" Please try using the `modal.{suggested}` decorator{async_suggestion} instead."
|
160
|
-
" See https://modal.com/docs/guide/lifecycle-functions for more information."
|
161
|
-
)
|
162
|
-
deprecation_error((2024, 2, 21), message)
|
163
|
-
|
164
141
|
partial_functions: dict[str, _PartialFunction] = {}
|
165
142
|
for parent_cls in reversed(user_cls.mro()):
|
166
143
|
if parent_cls is not object:
|
modal/queue.py
CHANGED
@@ -13,7 +13,7 @@ from modal_proto import api_pb2
|
|
13
13
|
from ._resolver import Resolver
|
14
14
|
from ._serialization import deserialize, serialize
|
15
15
|
from ._utils.async_utils import TaskContext, synchronize_api, warn_if_generator_is_not_consumed
|
16
|
-
from ._utils.deprecation import deprecation_error
|
16
|
+
from ._utils.deprecation import deprecation_error, renamed_parameter
|
17
17
|
from ._utils.grpc_utils import retry_transient_errors
|
18
18
|
from ._utils.name_utils import check_object_name
|
19
19
|
from .client import _Client
|
@@ -154,8 +154,9 @@ class _Queue(_Object, type_prefix="qu"):
|
|
154
154
|
yield cls._new_hydrated(response.queue_id, client, None, is_another_app=True)
|
155
155
|
|
156
156
|
@staticmethod
|
157
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
157
158
|
def from_name(
|
158
|
-
|
159
|
+
name: str,
|
159
160
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
160
161
|
environment_name: Optional[str] = None,
|
161
162
|
create_if_missing: bool = False,
|
@@ -171,11 +172,11 @@ class _Queue(_Object, type_prefix="qu"):
|
|
171
172
|
q.put(123)
|
172
173
|
```
|
173
174
|
"""
|
174
|
-
check_object_name(
|
175
|
+
check_object_name(name, "Queue")
|
175
176
|
|
176
177
|
async def _load(self: _Queue, resolver: Resolver, existing_object_id: Optional[str]):
|
177
178
|
req = api_pb2.QueueGetOrCreateRequest(
|
178
|
-
deployment_name=
|
179
|
+
deployment_name=name,
|
179
180
|
namespace=namespace,
|
180
181
|
environment_name=_get_environment_name(environment_name, resolver),
|
181
182
|
object_creation_type=(api_pb2.OBJECT_CREATION_TYPE_CREATE_IF_MISSING if create_if_missing else None),
|
@@ -186,8 +187,9 @@ class _Queue(_Object, type_prefix="qu"):
|
|
186
187
|
return _Queue._from_loader(_load, "Queue()", is_another_app=True, hydrate_lazily=True)
|
187
188
|
|
188
189
|
@staticmethod
|
190
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
189
191
|
async def lookup(
|
190
|
-
|
192
|
+
name: str,
|
191
193
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
192
194
|
client: Optional[_Client] = None,
|
193
195
|
environment_name: Optional[str] = None,
|
@@ -204,7 +206,7 @@ class _Queue(_Object, type_prefix="qu"):
|
|
204
206
|
```
|
205
207
|
"""
|
206
208
|
obj = _Queue.from_name(
|
207
|
-
|
209
|
+
name, namespace=namespace, environment_name=environment_name, create_if_missing=create_if_missing
|
208
210
|
)
|
209
211
|
if client is None:
|
210
212
|
client = await _Client.from_env()
|
@@ -213,8 +215,9 @@ class _Queue(_Object, type_prefix="qu"):
|
|
213
215
|
return obj
|
214
216
|
|
215
217
|
@staticmethod
|
216
|
-
|
217
|
-
|
218
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
219
|
+
async def delete(name: str, *, client: Optional[_Client] = None, environment_name: Optional[str] = None):
|
220
|
+
obj = await _Queue.lookup(name, client=client, environment_name=environment_name)
|
218
221
|
req = api_pb2.QueueDeleteRequest(queue_id=obj.object_id)
|
219
222
|
await retry_transient_errors(obj._client.stub.QueueDelete, req)
|
220
223
|
|
modal/queue.pyi
CHANGED
@@ -20,11 +20,11 @@ class _Queue(modal.object._Object):
|
|
20
20
|
) -> typing.AsyncContextManager[_Queue]: ...
|
21
21
|
@staticmethod
|
22
22
|
def from_name(
|
23
|
-
|
23
|
+
name: str, namespace=1, environment_name: typing.Optional[str] = None, create_if_missing: bool = False
|
24
24
|
) -> _Queue: ...
|
25
25
|
@staticmethod
|
26
26
|
async def lookup(
|
27
|
-
|
27
|
+
name: str,
|
28
28
|
namespace=1,
|
29
29
|
client: typing.Optional[modal.client._Client] = None,
|
30
30
|
environment_name: typing.Optional[str] = None,
|
@@ -32,7 +32,7 @@ class _Queue(modal.object._Object):
|
|
32
32
|
) -> _Queue: ...
|
33
33
|
@staticmethod
|
34
34
|
async def delete(
|
35
|
-
|
35
|
+
name: str,
|
36
36
|
*,
|
37
37
|
client: typing.Optional[modal.client._Client] = None,
|
38
38
|
environment_name: typing.Optional[str] = None,
|
@@ -101,13 +101,13 @@ class Queue(modal.object.Object):
|
|
101
101
|
) -> synchronicity.combined_types.AsyncAndBlockingContextManager[Queue]: ...
|
102
102
|
@staticmethod
|
103
103
|
def from_name(
|
104
|
-
|
104
|
+
name: str, namespace=1, environment_name: typing.Optional[str] = None, create_if_missing: bool = False
|
105
105
|
) -> Queue: ...
|
106
106
|
|
107
107
|
class __lookup_spec(typing_extensions.Protocol):
|
108
108
|
def __call__(
|
109
109
|
self,
|
110
|
-
|
110
|
+
name: str,
|
111
111
|
namespace=1,
|
112
112
|
client: typing.Optional[modal.client.Client] = None,
|
113
113
|
environment_name: typing.Optional[str] = None,
|
@@ -115,7 +115,7 @@ class Queue(modal.object.Object):
|
|
115
115
|
) -> Queue: ...
|
116
116
|
async def aio(
|
117
117
|
self,
|
118
|
-
|
118
|
+
name: str,
|
119
119
|
namespace=1,
|
120
120
|
client: typing.Optional[modal.client.Client] = None,
|
121
121
|
environment_name: typing.Optional[str] = None,
|
@@ -127,14 +127,14 @@ class Queue(modal.object.Object):
|
|
127
127
|
class __delete_spec(typing_extensions.Protocol):
|
128
128
|
def __call__(
|
129
129
|
self,
|
130
|
-
|
130
|
+
name: str,
|
131
131
|
*,
|
132
132
|
client: typing.Optional[modal.client.Client] = None,
|
133
133
|
environment_name: typing.Optional[str] = None,
|
134
134
|
): ...
|
135
135
|
async def aio(
|
136
136
|
self,
|
137
|
-
|
137
|
+
name: str,
|
138
138
|
*,
|
139
139
|
client: typing.Optional[modal.client.Client] = None,
|
140
140
|
environment_name: typing.Optional[str] = None,
|
modal/sandbox.py
CHANGED
@@ -118,6 +118,8 @@ class _Sandbox(_Object, type_prefix="sb"):
|
|
118
118
|
for _, cloud_bucket_mount in cloud_bucket_mounts:
|
119
119
|
if cloud_bucket_mount.secret:
|
120
120
|
deps.append(cloud_bucket_mount.secret)
|
121
|
+
if proxy:
|
122
|
+
deps.append(proxy)
|
121
123
|
return deps
|
122
124
|
|
123
125
|
async def _load(self: _Sandbox, resolver: Resolver, _existing_object_id: Optional[str]):
|
modal/secret.py
CHANGED
@@ -9,6 +9,7 @@ from modal_proto import api_pb2
|
|
9
9
|
from ._resolver import Resolver
|
10
10
|
from ._runtime.execution_context import is_local
|
11
11
|
from ._utils.async_utils import synchronize_api
|
12
|
+
from ._utils.deprecation import renamed_parameter
|
12
13
|
from ._utils.grpc_utils import retry_transient_errors
|
13
14
|
from ._utils.name_utils import check_object_name
|
14
15
|
from .client import _Client
|
@@ -161,8 +162,9 @@ class _Secret(_Object, type_prefix="st"):
|
|
161
162
|
return _Secret._from_loader(_load, "Secret.from_dotenv()", hydrate_lazily=True)
|
162
163
|
|
163
164
|
@staticmethod
|
165
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
164
166
|
def from_name(
|
165
|
-
|
167
|
+
name: str,
|
166
168
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
167
169
|
environment_name: Optional[str] = None,
|
168
170
|
required_keys: list[
|
@@ -186,7 +188,7 @@ class _Secret(_Object, type_prefix="st"):
|
|
186
188
|
|
187
189
|
async def _load(self: _Secret, resolver: Resolver, existing_object_id: Optional[str]):
|
188
190
|
req = api_pb2.SecretGetOrCreateRequest(
|
189
|
-
deployment_name=
|
191
|
+
deployment_name=name,
|
190
192
|
namespace=namespace,
|
191
193
|
environment_name=_get_environment_name(environment_name, resolver),
|
192
194
|
required_keys=required_keys,
|
@@ -203,8 +205,9 @@ class _Secret(_Object, type_prefix="st"):
|
|
203
205
|
return _Secret._from_loader(_load, "Secret()", hydrate_lazily=True)
|
204
206
|
|
205
207
|
@staticmethod
|
208
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
206
209
|
async def lookup(
|
207
|
-
|
210
|
+
name: str,
|
208
211
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
209
212
|
client: Optional[_Client] = None,
|
210
213
|
environment_name: Optional[str] = None,
|
@@ -212,7 +215,7 @@ class _Secret(_Object, type_prefix="st"):
|
|
212
215
|
) -> "_Secret":
|
213
216
|
"""mdmd:hidden"""
|
214
217
|
obj = _Secret.from_name(
|
215
|
-
|
218
|
+
name, namespace=namespace, environment_name=environment_name, required_keys=required_keys
|
216
219
|
)
|
217
220
|
if client is None:
|
218
221
|
client = await _Client.from_env()
|
modal/secret.pyi
CHANGED
@@ -12,11 +12,11 @@ class _Secret(modal.object._Object):
|
|
12
12
|
def from_dotenv(path=None, *, filename=".env"): ...
|
13
13
|
@staticmethod
|
14
14
|
def from_name(
|
15
|
-
|
15
|
+
name: str, namespace=1, environment_name: typing.Optional[str] = None, required_keys: list[str] = []
|
16
16
|
) -> _Secret: ...
|
17
17
|
@staticmethod
|
18
18
|
async def lookup(
|
19
|
-
|
19
|
+
name: str,
|
20
20
|
namespace=1,
|
21
21
|
client: typing.Optional[modal.client._Client] = None,
|
22
22
|
environment_name: typing.Optional[str] = None,
|
@@ -42,13 +42,13 @@ class Secret(modal.object.Object):
|
|
42
42
|
def from_dotenv(path=None, *, filename=".env"): ...
|
43
43
|
@staticmethod
|
44
44
|
def from_name(
|
45
|
-
|
45
|
+
name: str, namespace=1, environment_name: typing.Optional[str] = None, required_keys: list[str] = []
|
46
46
|
) -> Secret: ...
|
47
47
|
|
48
48
|
class __lookup_spec(typing_extensions.Protocol):
|
49
49
|
def __call__(
|
50
50
|
self,
|
51
|
-
|
51
|
+
name: str,
|
52
52
|
namespace=1,
|
53
53
|
client: typing.Optional[modal.client.Client] = None,
|
54
54
|
environment_name: typing.Optional[str] = None,
|
@@ -56,7 +56,7 @@ class Secret(modal.object.Object):
|
|
56
56
|
) -> Secret: ...
|
57
57
|
async def aio(
|
58
58
|
self,
|
59
|
-
|
59
|
+
name: str,
|
60
60
|
namespace=1,
|
61
61
|
client: typing.Optional[modal.client.Client] = None,
|
62
62
|
environment_name: typing.Optional[str] = None,
|
modal/volume.py
CHANGED
@@ -36,7 +36,7 @@ from ._utils.blob_utils import (
|
|
36
36
|
get_file_upload_spec_from_fileobj,
|
37
37
|
get_file_upload_spec_from_path,
|
38
38
|
)
|
39
|
-
from ._utils.deprecation import deprecation_error, deprecation_warning
|
39
|
+
from ._utils.deprecation import deprecation_error, deprecation_warning, renamed_parameter
|
40
40
|
from ._utils.grpc_utils import retry_transient_errors
|
41
41
|
from ._utils.name_utils import check_object_name
|
42
42
|
from .client import _Client
|
@@ -144,8 +144,9 @@ class _Volume(_Object, type_prefix="vo"):
|
|
144
144
|
deprecation_error((2024, 3, 20), message)
|
145
145
|
|
146
146
|
@staticmethod
|
147
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
147
148
|
def from_name(
|
148
|
-
|
149
|
+
name: str,
|
149
150
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
150
151
|
environment_name: Optional[str] = None,
|
151
152
|
create_if_missing: bool = False,
|
@@ -168,11 +169,11 @@ class _Volume(_Object, type_prefix="vo"):
|
|
168
169
|
pass
|
169
170
|
```
|
170
171
|
"""
|
171
|
-
check_object_name(
|
172
|
+
check_object_name(name, "Volume")
|
172
173
|
|
173
174
|
async def _load(self: _Volume, resolver: Resolver, existing_object_id: Optional[str]):
|
174
175
|
req = api_pb2.VolumeGetOrCreateRequest(
|
175
|
-
deployment_name=
|
176
|
+
deployment_name=name,
|
176
177
|
namespace=namespace,
|
177
178
|
environment_name=_get_environment_name(environment_name, resolver),
|
178
179
|
object_creation_type=(api_pb2.OBJECT_CREATION_TYPE_CREATE_IF_MISSING if create_if_missing else None),
|
@@ -220,8 +221,9 @@ class _Volume(_Object, type_prefix="vo"):
|
|
220
221
|
yield cls._new_hydrated(response.volume_id, client, None, is_another_app=True)
|
221
222
|
|
222
223
|
@staticmethod
|
224
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
223
225
|
async def lookup(
|
224
|
-
|
226
|
+
name: str,
|
225
227
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
226
228
|
client: Optional[_Client] = None,
|
227
229
|
environment_name: Optional[str] = None,
|
@@ -239,7 +241,7 @@ class _Volume(_Object, type_prefix="vo"):
|
|
239
241
|
```
|
240
242
|
"""
|
241
243
|
obj = _Volume.from_name(
|
242
|
-
|
244
|
+
name,
|
243
245
|
namespace=namespace,
|
244
246
|
environment_name=environment_name,
|
245
247
|
create_if_missing=create_if_missing,
|
@@ -507,8 +509,9 @@ class _Volume(_Object, type_prefix="vo"):
|
|
507
509
|
)
|
508
510
|
|
509
511
|
@staticmethod
|
510
|
-
|
511
|
-
|
512
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
513
|
+
async def delete(name: str, client: Optional[_Client] = None, environment_name: Optional[str] = None):
|
514
|
+
obj = await _Volume.lookup(name, client=client, environment_name=environment_name)
|
512
515
|
req = api_pb2.VolumeDeleteRequest(volume_id=obj.object_id)
|
513
516
|
await retry_transient_errors(obj._client.stub.VolumeDelete, req)
|
514
517
|
|