modal 0.68.31__py3-none-any.whl → 0.68.42__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/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, tag: str, namespace=1, environment_name: typing.Optional[str] = None
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
- tag: str,
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, tag: str, namespace=1, environment_name: typing.Optional[str] = None
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
- tag: str,
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
- tag: str,
401
+ name: str,
400
402
  namespace=1,
401
403
  client: typing.Optional[modal.client.Client] = None,
402
404
  environment_name: typing.Optional[str] = None,
modal/image.py CHANGED
@@ -571,21 +571,6 @@ class _Image(_Object, type_prefix="im"):
571
571
  obj.force_build = force_build
572
572
  return obj
573
573
 
574
- def extend(self, **kwargs) -> "_Image":
575
- """mdmd:hidden"""
576
- deprecation_error(
577
- (2024, 3, 7),
578
- "`Image.extend` is deprecated; please use a higher-level method, such as `Image.dockerfile_commands`.",
579
- )
580
-
581
- def build_dockerfile(version: ImageBuilderVersion) -> DockerfileSpec:
582
- return DockerfileSpec(
583
- commands=kwargs.pop("dockerfile_commands", []),
584
- context_files=kwargs.pop("context_files", {}),
585
- )
586
-
587
- return _Image._from_args(base_images={"base": self}, dockerfile_function=build_dockerfile, **kwargs)
588
-
589
574
  def copy_mount(self, mount: _Mount, remote_path: Union[str, Path] = ".") -> "_Image":
590
575
  """Copy the entire contents of a `modal.Mount` into an image.
591
576
  Useful when files only available locally are required during the image
modal/image.pyi CHANGED
@@ -92,19 +92,6 @@ class _Image(modal.object._Object):
92
92
  _namespace: int = 1,
93
93
  _do_assert_no_mount_layers: bool = True,
94
94
  ): ...
95
- def extend(
96
- self,
97
- *,
98
- secrets: typing.Optional[collections.abc.Sequence[modal.secret._Secret]] = None,
99
- gpu_config: typing.Optional[modal_proto.api_pb2.GPUConfig] = None,
100
- build_function: typing.Optional[modal.functions._Function] = None,
101
- build_function_input: typing.Optional[modal_proto.api_pb2.FunctionInput] = None,
102
- image_registry_config: typing.Optional[_ImageRegistryConfig] = None,
103
- context_mount: typing.Optional[modal.mount._Mount] = None,
104
- force_build: bool = False,
105
- _namespace: int = 1,
106
- _do_assert_no_mount_layers: bool = True,
107
- ) -> _Image: ...
108
95
  def copy_mount(self, mount: modal.mount._Mount, remote_path: typing.Union[str, pathlib.Path] = ".") -> _Image: ...
109
96
  def add_local_file(
110
97
  self, local_path: typing.Union[str, pathlib.Path], remote_path: str, *, copy: bool = False
@@ -364,19 +351,6 @@ class Image(modal.object.Object):
364
351
  _namespace: int = 1,
365
352
  _do_assert_no_mount_layers: bool = True,
366
353
  ): ...
367
- def extend(
368
- self,
369
- *,
370
- secrets: typing.Optional[collections.abc.Sequence[modal.secret.Secret]] = None,
371
- gpu_config: typing.Optional[modal_proto.api_pb2.GPUConfig] = None,
372
- build_function: typing.Optional[modal.functions.Function] = None,
373
- build_function_input: typing.Optional[modal_proto.api_pb2.FunctionInput] = None,
374
- image_registry_config: typing.Optional[_ImageRegistryConfig] = None,
375
- context_mount: typing.Optional[modal.mount.Mount] = None,
376
- force_build: bool = False,
377
- _namespace: int = 1,
378
- _do_assert_no_mount_layers: bool = True,
379
- ) -> Image: ...
380
354
  def copy_mount(self, mount: modal.mount.Mount, remote_path: typing.Union[str, pathlib.Path] = ".") -> Image: ...
381
355
  def add_local_file(
382
356
  self, local_path: typing.Union[str, pathlib.Path], remote_path: str, *, copy: bool = False
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
- label: str,
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=label,
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
- label: str,
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(label, namespace=namespace, environment_name=environment_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(label: str, namespace=1, environment_name: typing.Optional[str] = None) -> _Mount: ...
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
- label: str,
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(label: str, namespace=1, environment_name: typing.Optional[str] = None) -> Mount: ...
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
- label: str,
238
+ name: str,
239
239
  namespace=1,
240
240
  client: typing.Optional[modal.client.Client] = None,
241
241
  environment_name: typing.Optional[str] = None,
@@ -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 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
@@ -91,18 +91,9 @@ class _NetworkFileSystem(_Object, type_prefix="sv"):
91
91
  """
92
92
 
93
93
  @staticmethod
94
- def new(cloud: Optional[str] = None):
95
- """mdmd:hidden"""
96
- message = (
97
- "`NetworkFileSystem.new` is deprecated."
98
- " Please use `NetworkFileSystem.from_name` (for persisted)"
99
- " or `NetworkFileSystem.ephemeral` (for ephemeral) network filesystems instead."
100
- )
101
- deprecation_error((2024, 3, 20), message)
102
-
103
- @staticmethod
94
+ @renamed_parameter((2024, 12, 18), "label", "name")
104
95
  def from_name(
105
- label: str,
96
+ name: str,
106
97
  namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
107
98
  environment_name: Optional[str] = None,
108
99
  create_if_missing: bool = False,
@@ -121,11 +112,11 @@ class _NetworkFileSystem(_Object, type_prefix="sv"):
121
112
  pass
122
113
  ```
123
114
  """
124
- check_object_name(label, "NetworkFileSystem")
115
+ check_object_name(name, "NetworkFileSystem")
125
116
 
126
117
  async def _load(self: _NetworkFileSystem, resolver: Resolver, existing_object_id: Optional[str]):
127
118
  req = api_pb2.SharedVolumeGetOrCreateRequest(
128
- deployment_name=label,
119
+ deployment_name=name,
129
120
  namespace=namespace,
130
121
  environment_name=_get_environment_name(environment_name, resolver),
131
122
  object_creation_type=(api_pb2.OBJECT_CREATION_TYPE_CREATE_IF_MISSING if create_if_missing else None),
@@ -136,7 +127,7 @@ class _NetworkFileSystem(_Object, type_prefix="sv"):
136
127
  except GRPCError as exc:
137
128
  if exc.status == Status.NOT_FOUND and exc.message == "App has wrong entity vo":
138
129
  raise InvalidError(
139
- f"Attempted to mount: `{label}` as a NetworkFileSystem " + "which already exists as a Volume"
130
+ f"Attempted to mount: `{name}` as a NetworkFileSystem " + "which already exists as a Volume"
140
131
  )
141
132
  raise
142
133
 
@@ -176,8 +167,9 @@ class _NetworkFileSystem(_Object, type_prefix="sv"):
176
167
  yield cls._new_hydrated(response.shared_volume_id, client, None, is_another_app=True)
177
168
 
178
169
  @staticmethod
170
+ @renamed_parameter((2024, 12, 18), "label", "name")
179
171
  async def lookup(
180
- label: str,
172
+ name: str,
181
173
  namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
182
174
  client: Optional[_Client] = None,
183
175
  environment_name: Optional[str] = None,
@@ -194,7 +186,7 @@ class _NetworkFileSystem(_Object, type_prefix="sv"):
194
186
  ```
195
187
  """
196
188
  obj = _NetworkFileSystem.from_name(
197
- label, namespace=namespace, environment_name=environment_name, create_if_missing=create_if_missing
189
+ name, namespace=namespace, environment_name=environment_name, create_if_missing=create_if_missing
198
190
  )
199
191
  if client is None:
200
192
  client = await _Client.from_env()
@@ -223,8 +215,9 @@ class _NetworkFileSystem(_Object, type_prefix="sv"):
223
215
  return resp.shared_volume_id
224
216
 
225
217
  @staticmethod
226
- async def delete(label: str, client: Optional[_Client] = None, environment_name: Optional[str] = None):
227
- obj = await _NetworkFileSystem.lookup(label, client=client, environment_name=environment_name)
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 _NetworkFileSystem.lookup(name, client=client, environment_name=environment_name)
228
221
  req = api_pb2.SharedVolumeDeleteRequest(shared_volume_id=obj.object_id)
229
222
  await retry_transient_errors(obj._client.stub.SharedVolumeDelete, req)
230
223
 
@@ -13,11 +13,9 @@ def network_file_system_mount_protos(
13
13
  ) -> list[modal_proto.api_pb2.SharedVolumeMount]: ...
14
14
 
15
15
  class _NetworkFileSystem(modal.object._Object):
16
- @staticmethod
17
- def new(cloud: typing.Optional[str] = None): ...
18
16
  @staticmethod
19
17
  def from_name(
20
- label: str, namespace=1, environment_name: typing.Optional[str] = None, create_if_missing: bool = False
18
+ name: str, namespace=1, environment_name: typing.Optional[str] = None, create_if_missing: bool = False
21
19
  ) -> _NetworkFileSystem: ...
22
20
  @classmethod
23
21
  def ephemeral(
@@ -28,7 +26,7 @@ class _NetworkFileSystem(modal.object._Object):
28
26
  ) -> typing.AsyncContextManager[_NetworkFileSystem]: ...
29
27
  @staticmethod
30
28
  async def lookup(
31
- label: str,
29
+ name: str,
32
30
  namespace=1,
33
31
  client: typing.Optional[modal.client._Client] = None,
34
32
  environment_name: typing.Optional[str] = None,
@@ -43,7 +41,7 @@ class _NetworkFileSystem(modal.object._Object):
43
41
  ) -> str: ...
44
42
  @staticmethod
45
43
  async def delete(
46
- label: str, client: typing.Optional[modal.client._Client] = None, environment_name: typing.Optional[str] = None
44
+ name: str, client: typing.Optional[modal.client._Client] = None, environment_name: typing.Optional[str] = None
47
45
  ): ...
48
46
  async def write_file(
49
47
  self,
@@ -71,10 +69,8 @@ class _NetworkFileSystem(modal.object._Object):
71
69
  class NetworkFileSystem(modal.object.Object):
72
70
  def __init__(self, *args, **kwargs): ...
73
71
  @staticmethod
74
- def new(cloud: typing.Optional[str] = None): ...
75
- @staticmethod
76
72
  def from_name(
77
- label: str, namespace=1, environment_name: typing.Optional[str] = None, create_if_missing: bool = False
73
+ name: str, namespace=1, environment_name: typing.Optional[str] = None, create_if_missing: bool = False
78
74
  ) -> NetworkFileSystem: ...
79
75
  @classmethod
80
76
  def ephemeral(
@@ -87,7 +83,7 @@ class NetworkFileSystem(modal.object.Object):
87
83
  class __lookup_spec(typing_extensions.Protocol):
88
84
  def __call__(
89
85
  self,
90
- label: str,
86
+ name: str,
91
87
  namespace=1,
92
88
  client: typing.Optional[modal.client.Client] = None,
93
89
  environment_name: typing.Optional[str] = None,
@@ -95,7 +91,7 @@ class NetworkFileSystem(modal.object.Object):
95
91
  ) -> NetworkFileSystem: ...
96
92
  async def aio(
97
93
  self,
98
- label: str,
94
+ name: str,
99
95
  namespace=1,
100
96
  client: typing.Optional[modal.client.Client] = None,
101
97
  environment_name: typing.Optional[str] = None,
@@ -125,13 +121,13 @@ class NetworkFileSystem(modal.object.Object):
125
121
  class __delete_spec(typing_extensions.Protocol):
126
122
  def __call__(
127
123
  self,
128
- label: str,
124
+ name: str,
129
125
  client: typing.Optional[modal.client.Client] = None,
130
126
  environment_name: typing.Optional[str] = None,
131
127
  ): ...
132
128
  async def aio(
133
129
  self,
134
- label: str,
130
+ name: str,
135
131
  client: typing.Optional[modal.client.Client] = None,
136
132
  environment_name: typing.Optional[str] = None,
137
133
  ): ...
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:
@@ -634,12 +611,6 @@ def _exit(_warn_parentheses_missing=None) -> Callable[[ExitHandlerType], _Partia
634
611
  if isinstance(f, _PartialFunction):
635
612
  _disallow_wrapping_method(f, "exit")
636
613
 
637
- if callable_has_non_self_params(f):
638
- message = (
639
- "Support for decorating parameterized methods with `@exit` has been deprecated."
640
- " Please update your code by removing the parameters."
641
- )
642
- deprecation_error((2024, 2, 23), message)
643
614
  return _PartialFunction(f, _PartialFunctionFlags.EXIT)
644
615
 
645
616
  return wrapper
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 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
@@ -94,15 +94,6 @@ class _Queue(_Object, type_prefix="qu"):
94
94
  Partition keys must be non-empty and must not exceed 64 bytes.
95
95
  """
96
96
 
97
- @staticmethod
98
- def new():
99
- """mdmd:hidden"""
100
- message = (
101
- "`Queue.new` is deprecated."
102
- " Please use `Queue.from_name` (for persisted) or `Queue.ephemeral` (for ephemeral) queues instead."
103
- )
104
- deprecation_error((2024, 3, 19), message)
105
-
106
97
  def __init__(self):
107
98
  """mdmd:hidden"""
108
99
  raise RuntimeError("Queue() is not allowed. Please use `Queue.from_name(...)` or `Queue.ephemeral()` instead.")
@@ -154,8 +145,9 @@ class _Queue(_Object, type_prefix="qu"):
154
145
  yield cls._new_hydrated(response.queue_id, client, None, is_another_app=True)
155
146
 
156
147
  @staticmethod
148
+ @renamed_parameter((2024, 12, 18), "label", "name")
157
149
  def from_name(
158
- label: str,
150
+ name: str,
159
151
  namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
160
152
  environment_name: Optional[str] = None,
161
153
  create_if_missing: bool = False,
@@ -171,11 +163,11 @@ class _Queue(_Object, type_prefix="qu"):
171
163
  q.put(123)
172
164
  ```
173
165
  """
174
- check_object_name(label, "Queue")
166
+ check_object_name(name, "Queue")
175
167
 
176
168
  async def _load(self: _Queue, resolver: Resolver, existing_object_id: Optional[str]):
177
169
  req = api_pb2.QueueGetOrCreateRequest(
178
- deployment_name=label,
170
+ deployment_name=name,
179
171
  namespace=namespace,
180
172
  environment_name=_get_environment_name(environment_name, resolver),
181
173
  object_creation_type=(api_pb2.OBJECT_CREATION_TYPE_CREATE_IF_MISSING if create_if_missing else None),
@@ -186,8 +178,9 @@ class _Queue(_Object, type_prefix="qu"):
186
178
  return _Queue._from_loader(_load, "Queue()", is_another_app=True, hydrate_lazily=True)
187
179
 
188
180
  @staticmethod
181
+ @renamed_parameter((2024, 12, 18), "label", "name")
189
182
  async def lookup(
190
- label: str,
183
+ name: str,
191
184
  namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
192
185
  client: Optional[_Client] = None,
193
186
  environment_name: Optional[str] = None,
@@ -204,7 +197,7 @@ class _Queue(_Object, type_prefix="qu"):
204
197
  ```
205
198
  """
206
199
  obj = _Queue.from_name(
207
- label, namespace=namespace, environment_name=environment_name, create_if_missing=create_if_missing
200
+ name, namespace=namespace, environment_name=environment_name, create_if_missing=create_if_missing
208
201
  )
209
202
  if client is None:
210
203
  client = await _Client.from_env()
@@ -213,8 +206,9 @@ class _Queue(_Object, type_prefix="qu"):
213
206
  return obj
214
207
 
215
208
  @staticmethod
216
- async def delete(label: str, *, client: Optional[_Client] = None, environment_name: Optional[str] = None):
217
- obj = await _Queue.lookup(label, client=client, environment_name=environment_name)
209
+ @renamed_parameter((2024, 12, 18), "label", "name")
210
+ async def delete(name: str, *, client: Optional[_Client] = None, environment_name: Optional[str] = None):
211
+ obj = await _Queue.lookup(name, client=client, environment_name=environment_name)
218
212
  req = api_pb2.QueueDeleteRequest(queue_id=obj.object_id)
219
213
  await retry_transient_errors(obj._client.stub.QueueDelete, req)
220
214
 
modal/queue.pyi CHANGED
@@ -6,8 +6,6 @@ import typing
6
6
  import typing_extensions
7
7
 
8
8
  class _Queue(modal.object._Object):
9
- @staticmethod
10
- def new(): ...
11
9
  def __init__(self): ...
12
10
  @staticmethod
13
11
  def validate_partition_key(partition: typing.Optional[str]) -> bytes: ...
@@ -20,11 +18,11 @@ class _Queue(modal.object._Object):
20
18
  ) -> typing.AsyncContextManager[_Queue]: ...
21
19
  @staticmethod
22
20
  def from_name(
23
- label: str, namespace=1, environment_name: typing.Optional[str] = None, create_if_missing: bool = False
21
+ name: str, namespace=1, environment_name: typing.Optional[str] = None, create_if_missing: bool = False
24
22
  ) -> _Queue: ...
25
23
  @staticmethod
26
24
  async def lookup(
27
- label: str,
25
+ name: str,
28
26
  namespace=1,
29
27
  client: typing.Optional[modal.client._Client] = None,
30
28
  environment_name: typing.Optional[str] = None,
@@ -32,7 +30,7 @@ class _Queue(modal.object._Object):
32
30
  ) -> _Queue: ...
33
31
  @staticmethod
34
32
  async def delete(
35
- label: str,
33
+ name: str,
36
34
  *,
37
35
  client: typing.Optional[modal.client._Client] = None,
38
36
  environment_name: typing.Optional[str] = None,
@@ -89,8 +87,6 @@ class _Queue(modal.object._Object):
89
87
  class Queue(modal.object.Object):
90
88
  def __init__(self): ...
91
89
  @staticmethod
92
- def new(): ...
93
- @staticmethod
94
90
  def validate_partition_key(partition: typing.Optional[str]) -> bytes: ...
95
91
  @classmethod
96
92
  def ephemeral(
@@ -101,13 +97,13 @@ class Queue(modal.object.Object):
101
97
  ) -> synchronicity.combined_types.AsyncAndBlockingContextManager[Queue]: ...
102
98
  @staticmethod
103
99
  def from_name(
104
- label: str, namespace=1, environment_name: typing.Optional[str] = None, create_if_missing: bool = False
100
+ name: str, namespace=1, environment_name: typing.Optional[str] = None, create_if_missing: bool = False
105
101
  ) -> Queue: ...
106
102
 
107
103
  class __lookup_spec(typing_extensions.Protocol):
108
104
  def __call__(
109
105
  self,
110
- label: str,
106
+ name: str,
111
107
  namespace=1,
112
108
  client: typing.Optional[modal.client.Client] = None,
113
109
  environment_name: typing.Optional[str] = None,
@@ -115,7 +111,7 @@ class Queue(modal.object.Object):
115
111
  ) -> Queue: ...
116
112
  async def aio(
117
113
  self,
118
- label: str,
114
+ name: str,
119
115
  namespace=1,
120
116
  client: typing.Optional[modal.client.Client] = None,
121
117
  environment_name: typing.Optional[str] = None,
@@ -127,14 +123,14 @@ class Queue(modal.object.Object):
127
123
  class __delete_spec(typing_extensions.Protocol):
128
124
  def __call__(
129
125
  self,
130
- label: str,
126
+ name: str,
131
127
  *,
132
128
  client: typing.Optional[modal.client.Client] = None,
133
129
  environment_name: typing.Optional[str] = None,
134
130
  ): ...
135
131
  async def aio(
136
132
  self,
137
- label: str,
133
+ name: str,
138
134
  *,
139
135
  client: typing.Optional[modal.client.Client] = None,
140
136
  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
- label: str, # Some global identifier, such as "aws-secret"
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=label,
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
- label: str,
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
- label, namespace=namespace, environment_name=environment_name, required_keys=required_keys
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
- label: str, namespace=1, environment_name: typing.Optional[str] = None, required_keys: list[str] = []
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
- label: str,
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
- label: str, namespace=1, environment_name: typing.Optional[str] = None, required_keys: list[str] = []
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
- label: str,
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
- label: str,
59
+ name: str,
60
60
  namespace=1,
61
61
  client: typing.Optional[modal.client.Client] = None,
62
62
  environment_name: typing.Optional[str] = None,