modal 1.0.6.dev58__py3-none-any.whl → 1.2.3.dev7__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.

Files changed (147) hide show
  1. modal/__main__.py +3 -4
  2. modal/_billing.py +80 -0
  3. modal/_clustered_functions.py +7 -3
  4. modal/_clustered_functions.pyi +4 -2
  5. modal/_container_entrypoint.py +41 -49
  6. modal/_functions.py +424 -195
  7. modal/_grpc_client.py +171 -0
  8. modal/_load_context.py +105 -0
  9. modal/_object.py +68 -20
  10. modal/_output.py +58 -45
  11. modal/_partial_function.py +36 -11
  12. modal/_pty.py +7 -3
  13. modal/_resolver.py +21 -35
  14. modal/_runtime/asgi.py +4 -3
  15. modal/_runtime/container_io_manager.py +301 -186
  16. modal/_runtime/container_io_manager.pyi +70 -61
  17. modal/_runtime/execution_context.py +18 -2
  18. modal/_runtime/execution_context.pyi +4 -1
  19. modal/_runtime/gpu_memory_snapshot.py +170 -63
  20. modal/_runtime/user_code_imports.py +28 -58
  21. modal/_serialization.py +57 -1
  22. modal/_utils/async_utils.py +33 -12
  23. modal/_utils/auth_token_manager.py +2 -5
  24. modal/_utils/blob_utils.py +110 -53
  25. modal/_utils/function_utils.py +49 -42
  26. modal/_utils/grpc_utils.py +80 -50
  27. modal/_utils/mount_utils.py +26 -1
  28. modal/_utils/name_utils.py +17 -3
  29. modal/_utils/task_command_router_client.py +536 -0
  30. modal/_utils/time_utils.py +34 -6
  31. modal/app.py +219 -83
  32. modal/app.pyi +229 -56
  33. modal/billing.py +5 -0
  34. modal/{requirements → builder}/2025.06.txt +1 -0
  35. modal/{requirements → builder}/PREVIEW.txt +1 -0
  36. modal/cli/_download.py +19 -3
  37. modal/cli/_traceback.py +3 -2
  38. modal/cli/app.py +4 -4
  39. modal/cli/cluster.py +15 -7
  40. modal/cli/config.py +5 -3
  41. modal/cli/container.py +7 -6
  42. modal/cli/dict.py +22 -16
  43. modal/cli/entry_point.py +12 -5
  44. modal/cli/environment.py +5 -4
  45. modal/cli/import_refs.py +3 -3
  46. modal/cli/launch.py +102 -5
  47. modal/cli/network_file_system.py +9 -13
  48. modal/cli/profile.py +3 -2
  49. modal/cli/programs/launch_instance_ssh.py +94 -0
  50. modal/cli/programs/run_jupyter.py +1 -1
  51. modal/cli/programs/run_marimo.py +95 -0
  52. modal/cli/programs/vscode.py +1 -1
  53. modal/cli/queues.py +57 -26
  54. modal/cli/run.py +58 -16
  55. modal/cli/secret.py +48 -22
  56. modal/cli/utils.py +3 -4
  57. modal/cli/volume.py +28 -25
  58. modal/client.py +13 -116
  59. modal/client.pyi +9 -91
  60. modal/cloud_bucket_mount.py +5 -3
  61. modal/cloud_bucket_mount.pyi +5 -1
  62. modal/cls.py +130 -102
  63. modal/cls.pyi +45 -85
  64. modal/config.py +29 -10
  65. modal/container_process.py +291 -13
  66. modal/container_process.pyi +95 -32
  67. modal/dict.py +282 -63
  68. modal/dict.pyi +423 -73
  69. modal/environments.py +15 -27
  70. modal/environments.pyi +5 -15
  71. modal/exception.py +8 -0
  72. modal/experimental/__init__.py +143 -38
  73. modal/experimental/flash.py +247 -78
  74. modal/experimental/flash.pyi +137 -9
  75. modal/file_io.py +14 -28
  76. modal/file_io.pyi +2 -2
  77. modal/file_pattern_matcher.py +25 -16
  78. modal/functions.pyi +134 -61
  79. modal/image.py +255 -86
  80. modal/image.pyi +300 -62
  81. modal/io_streams.py +436 -126
  82. modal/io_streams.pyi +236 -171
  83. modal/mount.py +62 -157
  84. modal/mount.pyi +45 -172
  85. modal/network_file_system.py +30 -53
  86. modal/network_file_system.pyi +16 -76
  87. modal/object.pyi +42 -8
  88. modal/parallel_map.py +821 -113
  89. modal/parallel_map.pyi +134 -0
  90. modal/partial_function.pyi +4 -1
  91. modal/proxy.py +16 -7
  92. modal/proxy.pyi +10 -2
  93. modal/queue.py +263 -61
  94. modal/queue.pyi +409 -66
  95. modal/runner.py +112 -92
  96. modal/runner.pyi +45 -27
  97. modal/sandbox.py +451 -124
  98. modal/sandbox.pyi +513 -67
  99. modal/secret.py +291 -67
  100. modal/secret.pyi +425 -19
  101. modal/serving.py +7 -11
  102. modal/serving.pyi +7 -8
  103. modal/snapshot.py +11 -8
  104. modal/token_flow.py +4 -4
  105. modal/volume.py +344 -98
  106. modal/volume.pyi +464 -68
  107. {modal-1.0.6.dev58.dist-info → modal-1.2.3.dev7.dist-info}/METADATA +9 -8
  108. modal-1.2.3.dev7.dist-info/RECORD +195 -0
  109. modal_docs/mdmd/mdmd.py +11 -1
  110. modal_proto/api.proto +399 -67
  111. modal_proto/api_grpc.py +241 -1
  112. modal_proto/api_pb2.py +1395 -1000
  113. modal_proto/api_pb2.pyi +1239 -79
  114. modal_proto/api_pb2_grpc.py +499 -4
  115. modal_proto/api_pb2_grpc.pyi +162 -14
  116. modal_proto/modal_api_grpc.py +175 -160
  117. modal_proto/sandbox_router.proto +145 -0
  118. modal_proto/sandbox_router_grpc.py +105 -0
  119. modal_proto/sandbox_router_pb2.py +149 -0
  120. modal_proto/sandbox_router_pb2.pyi +333 -0
  121. modal_proto/sandbox_router_pb2_grpc.py +203 -0
  122. modal_proto/sandbox_router_pb2_grpc.pyi +75 -0
  123. modal_proto/task_command_router.proto +144 -0
  124. modal_proto/task_command_router_grpc.py +105 -0
  125. modal_proto/task_command_router_pb2.py +149 -0
  126. modal_proto/task_command_router_pb2.pyi +333 -0
  127. modal_proto/task_command_router_pb2_grpc.py +203 -0
  128. modal_proto/task_command_router_pb2_grpc.pyi +75 -0
  129. modal_version/__init__.py +1 -1
  130. modal-1.0.6.dev58.dist-info/RECORD +0 -183
  131. modal_proto/modal_options_grpc.py +0 -3
  132. modal_proto/options.proto +0 -19
  133. modal_proto/options_grpc.py +0 -3
  134. modal_proto/options_pb2.py +0 -35
  135. modal_proto/options_pb2.pyi +0 -20
  136. modal_proto/options_pb2_grpc.py +0 -4
  137. modal_proto/options_pb2_grpc.pyi +0 -7
  138. /modal/{requirements → builder}/2023.12.312.txt +0 -0
  139. /modal/{requirements → builder}/2023.12.txt +0 -0
  140. /modal/{requirements → builder}/2024.04.txt +0 -0
  141. /modal/{requirements → builder}/2024.10.txt +0 -0
  142. /modal/{requirements → builder}/README.md +0 -0
  143. /modal/{requirements → builder}/base-images.json +0 -0
  144. {modal-1.0.6.dev58.dist-info → modal-1.2.3.dev7.dist-info}/WHEEL +0 -0
  145. {modal-1.0.6.dev58.dist-info → modal-1.2.3.dev7.dist-info}/entry_points.txt +0 -0
  146. {modal-1.0.6.dev58.dist-info → modal-1.2.3.dev7.dist-info}/licenses/LICENSE +0 -0
  147. {modal-1.0.6.dev58.dist-info → modal-1.2.3.dev7.dist-info}/top_level.txt +0 -0
modal/volume.pyi CHANGED
@@ -1,6 +1,7 @@
1
1
  import _io
2
2
  import asyncio.locks
3
3
  import collections.abc
4
+ import datetime
4
5
  import enum
5
6
  import google.protobuf.message
6
7
  import modal._object
@@ -9,6 +10,7 @@ import modal.client
9
10
  import modal.object
10
11
  import modal_proto.api_pb2
11
12
  import pathlib
13
+ import synchronicity
12
14
  import synchronicity.combined_types
13
15
  import typing
14
16
  import typing_extensions
@@ -57,6 +59,350 @@ class FileEntry:
57
59
  """Return hash(self)."""
58
60
  ...
59
61
 
62
+ class VolumeInfo:
63
+ """Information about the Volume object."""
64
+
65
+ name: typing.Optional[str]
66
+ created_at: datetime.datetime
67
+ created_by: typing.Optional[str]
68
+
69
+ def __init__(
70
+ self, name: typing.Optional[str], created_at: datetime.datetime, created_by: typing.Optional[str]
71
+ ) -> None:
72
+ """Initialize self. See help(type(self)) for accurate signature."""
73
+ ...
74
+
75
+ def __repr__(self):
76
+ """Return repr(self)."""
77
+ ...
78
+
79
+ def __eq__(self, other):
80
+ """Return self==value."""
81
+ ...
82
+
83
+ class _VolumeManager:
84
+ """Namespace with methods for managing named Volume objects."""
85
+ @staticmethod
86
+ async def create(
87
+ name: str,
88
+ *,
89
+ version: typing.Optional[int] = None,
90
+ allow_existing: bool = False,
91
+ environment_name: typing.Optional[str] = None,
92
+ client: typing.Optional[modal.client._Client] = None,
93
+ ) -> None:
94
+ """Create a new Volume object.
95
+
96
+ **Examples:**
97
+
98
+ ```python notest
99
+ modal.Volume.objects.create("my-volume")
100
+ ```
101
+
102
+ Volumes will be created in the active environment, or another one can be specified:
103
+
104
+ ```python notest
105
+ modal.Volume.objects.create("my-volume", environment_name="dev")
106
+ ```
107
+
108
+ By default, an error will be raised if the Volume already exists, but passing
109
+ `allow_existing=True` will make the creation attempt a no-op in this case.
110
+
111
+ ```python notest
112
+ modal.Volume.objects.create("my-volume", allow_existing=True)
113
+ ```
114
+
115
+ Note that this method does not return a local instance of the Volume. You can use
116
+ `modal.Volume.from_name` to perform a lookup after creation.
117
+
118
+ Added in v1.1.2.
119
+ """
120
+ ...
121
+
122
+ @staticmethod
123
+ async def list(
124
+ *,
125
+ max_objects: typing.Optional[int] = None,
126
+ created_before: typing.Union[datetime.datetime, str, None] = None,
127
+ environment_name: str = "",
128
+ client: typing.Optional[modal.client._Client] = None,
129
+ ) -> list[_Volume]:
130
+ """Return a list of hydrated Volume objects.
131
+
132
+ **Examples:**
133
+
134
+ ```python
135
+ volumes = modal.Volume.objects.list()
136
+ print([v.name for v in volumes])
137
+ ```
138
+
139
+ Volumes will be retreived from the active environment, or another one can be specified:
140
+
141
+ ```python notest
142
+ dev_volumes = modal.Volume.objects.list(environment_name="dev")
143
+ ```
144
+
145
+ By default, all named Volumes are returned, newest to oldest. It's also possible to limit the
146
+ number of results and to filter by creation date:
147
+
148
+ ```python
149
+ volumes = modal.Volume.objects.list(max_objects=10, created_before="2025-01-01")
150
+ ```
151
+
152
+ Added in v1.1.2.
153
+ """
154
+ ...
155
+
156
+ @staticmethod
157
+ async def delete(
158
+ name: str,
159
+ *,
160
+ allow_missing: bool = False,
161
+ environment_name: typing.Optional[str] = None,
162
+ client: typing.Optional[modal.client._Client] = None,
163
+ ):
164
+ """Delete a named Volume.
165
+
166
+ Warning: This deletes an *entire Volume*, not just a specific file.
167
+ Deletion is irreversible and will affect any Apps currently using the Volume.
168
+
169
+ **Examples:**
170
+
171
+ ```python notest
172
+ await modal.Volume.objects.delete("my-volume")
173
+ ```
174
+
175
+ Volumes will be deleted from the active environment, or another one can be specified:
176
+
177
+ ```python notest
178
+ await modal.Volume.objects.delete("my-volume", environment_name="dev")
179
+ ```
180
+
181
+ Added in v1.1.2.
182
+ """
183
+ ...
184
+
185
+ class VolumeManager:
186
+ """Namespace with methods for managing named Volume objects."""
187
+ def __init__(self, /, *args, **kwargs):
188
+ """Initialize self. See help(type(self)) for accurate signature."""
189
+ ...
190
+
191
+ class __create_spec(typing_extensions.Protocol):
192
+ def __call__(
193
+ self,
194
+ /,
195
+ name: str,
196
+ *,
197
+ version: typing.Optional[int] = None,
198
+ allow_existing: bool = False,
199
+ environment_name: typing.Optional[str] = None,
200
+ client: typing.Optional[modal.client.Client] = None,
201
+ ) -> None:
202
+ """Create a new Volume object.
203
+
204
+ **Examples:**
205
+
206
+ ```python notest
207
+ modal.Volume.objects.create("my-volume")
208
+ ```
209
+
210
+ Volumes will be created in the active environment, or another one can be specified:
211
+
212
+ ```python notest
213
+ modal.Volume.objects.create("my-volume", environment_name="dev")
214
+ ```
215
+
216
+ By default, an error will be raised if the Volume already exists, but passing
217
+ `allow_existing=True` will make the creation attempt a no-op in this case.
218
+
219
+ ```python notest
220
+ modal.Volume.objects.create("my-volume", allow_existing=True)
221
+ ```
222
+
223
+ Note that this method does not return a local instance of the Volume. You can use
224
+ `modal.Volume.from_name` to perform a lookup after creation.
225
+
226
+ Added in v1.1.2.
227
+ """
228
+ ...
229
+
230
+ async def aio(
231
+ self,
232
+ /,
233
+ name: str,
234
+ *,
235
+ version: typing.Optional[int] = None,
236
+ allow_existing: bool = False,
237
+ environment_name: typing.Optional[str] = None,
238
+ client: typing.Optional[modal.client.Client] = None,
239
+ ) -> None:
240
+ """Create a new Volume object.
241
+
242
+ **Examples:**
243
+
244
+ ```python notest
245
+ modal.Volume.objects.create("my-volume")
246
+ ```
247
+
248
+ Volumes will be created in the active environment, or another one can be specified:
249
+
250
+ ```python notest
251
+ modal.Volume.objects.create("my-volume", environment_name="dev")
252
+ ```
253
+
254
+ By default, an error will be raised if the Volume already exists, but passing
255
+ `allow_existing=True` will make the creation attempt a no-op in this case.
256
+
257
+ ```python notest
258
+ modal.Volume.objects.create("my-volume", allow_existing=True)
259
+ ```
260
+
261
+ Note that this method does not return a local instance of the Volume. You can use
262
+ `modal.Volume.from_name` to perform a lookup after creation.
263
+
264
+ Added in v1.1.2.
265
+ """
266
+ ...
267
+
268
+ create: __create_spec
269
+
270
+ class __list_spec(typing_extensions.Protocol):
271
+ def __call__(
272
+ self,
273
+ /,
274
+ *,
275
+ max_objects: typing.Optional[int] = None,
276
+ created_before: typing.Union[datetime.datetime, str, None] = None,
277
+ environment_name: str = "",
278
+ client: typing.Optional[modal.client.Client] = None,
279
+ ) -> list[Volume]:
280
+ """Return a list of hydrated Volume objects.
281
+
282
+ **Examples:**
283
+
284
+ ```python
285
+ volumes = modal.Volume.objects.list()
286
+ print([v.name for v in volumes])
287
+ ```
288
+
289
+ Volumes will be retreived from the active environment, or another one can be specified:
290
+
291
+ ```python notest
292
+ dev_volumes = modal.Volume.objects.list(environment_name="dev")
293
+ ```
294
+
295
+ By default, all named Volumes are returned, newest to oldest. It's also possible to limit the
296
+ number of results and to filter by creation date:
297
+
298
+ ```python
299
+ volumes = modal.Volume.objects.list(max_objects=10, created_before="2025-01-01")
300
+ ```
301
+
302
+ Added in v1.1.2.
303
+ """
304
+ ...
305
+
306
+ async def aio(
307
+ self,
308
+ /,
309
+ *,
310
+ max_objects: typing.Optional[int] = None,
311
+ created_before: typing.Union[datetime.datetime, str, None] = None,
312
+ environment_name: str = "",
313
+ client: typing.Optional[modal.client.Client] = None,
314
+ ) -> list[Volume]:
315
+ """Return a list of hydrated Volume objects.
316
+
317
+ **Examples:**
318
+
319
+ ```python
320
+ volumes = modal.Volume.objects.list()
321
+ print([v.name for v in volumes])
322
+ ```
323
+
324
+ Volumes will be retreived from the active environment, or another one can be specified:
325
+
326
+ ```python notest
327
+ dev_volumes = modal.Volume.objects.list(environment_name="dev")
328
+ ```
329
+
330
+ By default, all named Volumes are returned, newest to oldest. It's also possible to limit the
331
+ number of results and to filter by creation date:
332
+
333
+ ```python
334
+ volumes = modal.Volume.objects.list(max_objects=10, created_before="2025-01-01")
335
+ ```
336
+
337
+ Added in v1.1.2.
338
+ """
339
+ ...
340
+
341
+ list: __list_spec
342
+
343
+ class __delete_spec(typing_extensions.Protocol):
344
+ def __call__(
345
+ self,
346
+ /,
347
+ name: str,
348
+ *,
349
+ allow_missing: bool = False,
350
+ environment_name: typing.Optional[str] = None,
351
+ client: typing.Optional[modal.client.Client] = None,
352
+ ):
353
+ """Delete a named Volume.
354
+
355
+ Warning: This deletes an *entire Volume*, not just a specific file.
356
+ Deletion is irreversible and will affect any Apps currently using the Volume.
357
+
358
+ **Examples:**
359
+
360
+ ```python notest
361
+ await modal.Volume.objects.delete("my-volume")
362
+ ```
363
+
364
+ Volumes will be deleted from the active environment, or another one can be specified:
365
+
366
+ ```python notest
367
+ await modal.Volume.objects.delete("my-volume", environment_name="dev")
368
+ ```
369
+
370
+ Added in v1.1.2.
371
+ """
372
+ ...
373
+
374
+ async def aio(
375
+ self,
376
+ /,
377
+ name: str,
378
+ *,
379
+ allow_missing: bool = False,
380
+ environment_name: typing.Optional[str] = None,
381
+ client: typing.Optional[modal.client.Client] = None,
382
+ ):
383
+ """Delete a named Volume.
384
+
385
+ Warning: This deletes an *entire Volume*, not just a specific file.
386
+ Deletion is irreversible and will affect any Apps currently using the Volume.
387
+
388
+ **Examples:**
389
+
390
+ ```python notest
391
+ await modal.Volume.objects.delete("my-volume")
392
+ ```
393
+
394
+ Volumes will be deleted from the active environment, or another one can be specified:
395
+
396
+ ```python notest
397
+ await modal.Volume.objects.delete("my-volume", environment_name="dev")
398
+ ```
399
+
400
+ Added in v1.1.2.
401
+ """
402
+ ...
403
+
404
+ delete: __delete_spec
405
+
60
406
  class _Volume(modal._object._Object):
61
407
  """A writeable volume that can be used to share files between one or more Modal functions.
62
408
 
@@ -103,6 +449,10 @@ class _Volume(modal._object._Object):
103
449
  _metadata: typing.Optional[modal_proto.api_pb2.VolumeMetadata]
104
450
  _read_only: bool
105
451
 
452
+ @synchronicity.classproperty
453
+ def objects(cls) -> _VolumeManager: ...
454
+ @property
455
+ def name(self) -> typing.Optional[str]: ...
106
456
  def read_only(self) -> _Volume:
107
457
  """Configure Volume to mount as read-only.
108
458
 
@@ -121,10 +471,16 @@ class _Volume(modal._object._Object):
121
471
 
122
472
  The Volume is mounted as a read-only volume in a function. Any file system write operation into the
123
473
  mounted volume will result in an error.
474
+
475
+ Added in v1.0.5.
124
476
  """
125
477
  ...
126
478
 
479
+ def _hydrate_metadata(self, metadata: typing.Optional[google.protobuf.message.Message]): ...
480
+ def _get_metadata(self) -> typing.Optional[google.protobuf.message.Message]: ...
127
481
  async def _get_lock(self): ...
482
+ @property
483
+ def _is_v1(self) -> bool: ...
128
484
  @staticmethod
129
485
  def from_name(
130
486
  name: str,
@@ -133,6 +489,7 @@ class _Volume(modal._object._Object):
133
489
  environment_name: typing.Optional[str] = None,
134
490
  create_if_missing: bool = False,
135
491
  version: typing.Optional[int] = None,
492
+ client: typing.Optional[modal.client._Client] = None,
136
493
  ) -> _Volume:
137
494
  """Reference a Volume by name, creating if necessary.
138
495
 
@@ -153,10 +510,6 @@ class _Volume(modal._object._Object):
153
510
  """
154
511
  ...
155
512
 
156
- def _hydrate_metadata(self, metadata: typing.Optional[google.protobuf.message.Message]): ...
157
- def _get_metadata(self) -> typing.Optional[google.protobuf.message.Message]: ...
158
- @property
159
- def _is_v1(self) -> bool: ...
160
513
  @classmethod
161
514
  def ephemeral(
162
515
  cls: type[_Volume],
@@ -182,31 +535,18 @@ class _Volume(modal._object._Object):
182
535
  ...
183
536
 
184
537
  @staticmethod
185
- async def lookup(
186
- name: str,
538
+ async def create_deployed(
539
+ deployment_name: str,
187
540
  namespace=None,
188
541
  client: typing.Optional[modal.client._Client] = None,
189
542
  environment_name: typing.Optional[str] = None,
190
- create_if_missing: bool = False,
191
543
  version: typing.Optional[int] = None,
192
- ) -> _Volume:
193
- """mdmd:hidden
194
- Lookup a named Volume.
195
-
196
- DEPRECATED: This method is deprecated in favor of `modal.Volume.from_name`.
197
-
198
- In contrast to `modal.Volume.from_name`, this is an eager method
199
- that will hydrate the local object with metadata from Modal servers.
200
-
201
- ```python notest
202
- vol = modal.Volume.from_name("my-volume")
203
- print(vol.listdir("/"))
204
- ```
205
- """
544
+ ) -> str:
545
+ """mdmd:hidden"""
206
546
  ...
207
547
 
208
548
  @staticmethod
209
- async def create_deployed(
549
+ async def _create_deployed(
210
550
  deployment_name: str,
211
551
  namespace=None,
212
552
  client: typing.Optional[modal.client._Client] = None,
@@ -216,9 +556,13 @@ class _Volume(modal._object._Object):
216
556
  """mdmd:hidden"""
217
557
  ...
218
558
 
559
+ async def info(self) -> VolumeInfo:
560
+ """Return information about the Volume object."""
561
+ ...
562
+
219
563
  async def _do_reload(self, lock=True): ...
220
564
  async def commit(self):
221
- """Commit changes to the volume.
565
+ """Commit changes to a mounted volume.
222
566
 
223
567
  If successful, the changes made are now persisted in durable storage and available to other containers accessing
224
568
  the volume.
@@ -283,6 +627,14 @@ class _Volume(modal._object._Object):
283
627
  """
284
628
  ...
285
629
 
630
+ async def _read_file_into_fileobj(
631
+ self,
632
+ path: str,
633
+ fileobj: typing.IO[bytes],
634
+ concurrency: typing.Optional[int] = None,
635
+ download_semaphore: typing.Optional[asyncio.locks.Semaphore] = None,
636
+ progress_cb: typing.Optional[collections.abc.Callable[..., typing.Any]] = None,
637
+ ) -> int: ...
286
638
  async def remove_file(self, path: str, recursive: bool = False) -> None:
287
639
  """Remove a file or directory from a volume."""
288
640
  ...
@@ -337,7 +689,17 @@ class _Volume(modal._object._Object):
337
689
  @staticmethod
338
690
  async def delete(
339
691
  name: str, client: typing.Optional[modal.client._Client] = None, environment_name: typing.Optional[str] = None
340
- ): ...
692
+ ):
693
+ """mdmd:hidden
694
+ Delete a named Volume.
695
+
696
+ Warning: This deletes an *entire Volume*, not just a specific file.
697
+ Deletion is irreversible and will affect any Apps currently using the Volume.
698
+
699
+ DEPRECATED: This method is deprecated; we recommend using `modal.Volume.objects.delete` instead.
700
+ """
701
+ ...
702
+
341
703
  @staticmethod
342
704
  async def rename(
343
705
  old_name: str,
@@ -399,6 +761,10 @@ class Volume(modal.object.Object):
399
761
  """mdmd:hidden"""
400
762
  ...
401
763
 
764
+ @synchronicity.classproperty
765
+ def objects(cls) -> VolumeManager: ...
766
+ @property
767
+ def name(self) -> typing.Optional[str]: ...
402
768
  def read_only(self) -> Volume:
403
769
  """Configure Volume to mount as read-only.
404
770
 
@@ -417,15 +783,22 @@ class Volume(modal.object.Object):
417
783
 
418
784
  The Volume is mounted as a read-only volume in a function. Any file system write operation into the
419
785
  mounted volume will result in an error.
786
+
787
+ Added in v1.0.5.
420
788
  """
421
789
  ...
422
790
 
791
+ def _hydrate_metadata(self, metadata: typing.Optional[google.protobuf.message.Message]): ...
792
+ def _get_metadata(self) -> typing.Optional[google.protobuf.message.Message]: ...
793
+
423
794
  class ___get_lock_spec(typing_extensions.Protocol[SUPERSELF]):
424
795
  def __call__(self, /): ...
425
796
  async def aio(self, /): ...
426
797
 
427
798
  _get_lock: ___get_lock_spec[typing_extensions.Self]
428
799
 
800
+ @property
801
+ def _is_v1(self) -> bool: ...
429
802
  @staticmethod
430
803
  def from_name(
431
804
  name: str,
@@ -434,6 +807,7 @@ class Volume(modal.object.Object):
434
807
  environment_name: typing.Optional[str] = None,
435
808
  create_if_missing: bool = False,
436
809
  version: typing.Optional[int] = None,
810
+ client: typing.Optional[modal.client.Client] = None,
437
811
  ) -> Volume:
438
812
  """Reference a Volume by name, creating if necessary.
439
813
 
@@ -454,10 +828,6 @@ class Volume(modal.object.Object):
454
828
  """
455
829
  ...
456
830
 
457
- def _hydrate_metadata(self, metadata: typing.Optional[google.protobuf.message.Message]): ...
458
- def _get_metadata(self) -> typing.Optional[google.protobuf.message.Message]: ...
459
- @property
460
- def _is_v1(self) -> bool: ...
461
831
  @classmethod
462
832
  def ephemeral(
463
833
  cls: type[Volume],
@@ -482,60 +852,34 @@ class Volume(modal.object.Object):
482
852
  """
483
853
  ...
484
854
 
485
- class __lookup_spec(typing_extensions.Protocol):
855
+ class __create_deployed_spec(typing_extensions.Protocol):
486
856
  def __call__(
487
857
  self,
488
858
  /,
489
- name: str,
859
+ deployment_name: str,
490
860
  namespace=None,
491
861
  client: typing.Optional[modal.client.Client] = None,
492
862
  environment_name: typing.Optional[str] = None,
493
- create_if_missing: bool = False,
494
863
  version: typing.Optional[int] = None,
495
- ) -> Volume:
496
- """mdmd:hidden
497
- Lookup a named Volume.
498
-
499
- DEPRECATED: This method is deprecated in favor of `modal.Volume.from_name`.
500
-
501
- In contrast to `modal.Volume.from_name`, this is an eager method
502
- that will hydrate the local object with metadata from Modal servers.
503
-
504
- ```python notest
505
- vol = modal.Volume.from_name("my-volume")
506
- print(vol.listdir("/"))
507
- ```
508
- """
864
+ ) -> str:
865
+ """mdmd:hidden"""
509
866
  ...
510
867
 
511
868
  async def aio(
512
869
  self,
513
870
  /,
514
- name: str,
871
+ deployment_name: str,
515
872
  namespace=None,
516
873
  client: typing.Optional[modal.client.Client] = None,
517
874
  environment_name: typing.Optional[str] = None,
518
- create_if_missing: bool = False,
519
875
  version: typing.Optional[int] = None,
520
- ) -> Volume:
521
- """mdmd:hidden
522
- Lookup a named Volume.
523
-
524
- DEPRECATED: This method is deprecated in favor of `modal.Volume.from_name`.
525
-
526
- In contrast to `modal.Volume.from_name`, this is an eager method
527
- that will hydrate the local object with metadata from Modal servers.
528
-
529
- ```python notest
530
- vol = modal.Volume.from_name("my-volume")
531
- print(vol.listdir("/"))
532
- ```
533
- """
876
+ ) -> str:
877
+ """mdmd:hidden"""
534
878
  ...
535
879
 
536
- lookup: __lookup_spec
880
+ create_deployed: __create_deployed_spec
537
881
 
538
- class __create_deployed_spec(typing_extensions.Protocol):
882
+ class ___create_deployed_spec(typing_extensions.Protocol):
539
883
  def __call__(
540
884
  self,
541
885
  /,
@@ -560,7 +904,18 @@ class Volume(modal.object.Object):
560
904
  """mdmd:hidden"""
561
905
  ...
562
906
 
563
- create_deployed: __create_deployed_spec
907
+ _create_deployed: ___create_deployed_spec
908
+
909
+ class __info_spec(typing_extensions.Protocol[SUPERSELF]):
910
+ def __call__(self, /) -> VolumeInfo:
911
+ """Return information about the Volume object."""
912
+ ...
913
+
914
+ async def aio(self, /) -> VolumeInfo:
915
+ """Return information about the Volume object."""
916
+ ...
917
+
918
+ info: __info_spec[typing_extensions.Self]
564
919
 
565
920
  class ___do_reload_spec(typing_extensions.Protocol[SUPERSELF]):
566
921
  def __call__(self, /, lock=True): ...
@@ -570,7 +925,7 @@ class Volume(modal.object.Object):
570
925
 
571
926
  class __commit_spec(typing_extensions.Protocol[SUPERSELF]):
572
927
  def __call__(self, /):
573
- """Commit changes to the volume.
928
+ """Commit changes to a mounted volume.
574
929
 
575
930
  If successful, the changes made are now persisted in durable storage and available to other containers accessing
576
931
  the volume.
@@ -578,7 +933,7 @@ class Volume(modal.object.Object):
578
933
  ...
579
934
 
580
935
  async def aio(self, /):
581
- """Commit changes to the volume.
936
+ """Commit changes to a mounted volume.
582
937
 
583
938
  If successful, the changes made are now persisted in durable storage and available to other containers accessing
584
939
  the volume.
@@ -720,6 +1075,28 @@ class Volume(modal.object.Object):
720
1075
 
721
1076
  read_file_into_fileobj: __read_file_into_fileobj_spec[typing_extensions.Self]
722
1077
 
1078
+ class ___read_file_into_fileobj_spec(typing_extensions.Protocol[SUPERSELF]):
1079
+ def __call__(
1080
+ self,
1081
+ /,
1082
+ path: str,
1083
+ fileobj: typing.IO[bytes],
1084
+ concurrency: typing.Optional[int] = None,
1085
+ download_semaphore: typing.Optional[asyncio.locks.Semaphore] = None,
1086
+ progress_cb: typing.Optional[collections.abc.Callable[..., typing.Any]] = None,
1087
+ ) -> int: ...
1088
+ async def aio(
1089
+ self,
1090
+ /,
1091
+ path: str,
1092
+ fileobj: typing.IO[bytes],
1093
+ concurrency: typing.Optional[int] = None,
1094
+ download_semaphore: typing.Optional[asyncio.locks.Semaphore] = None,
1095
+ progress_cb: typing.Optional[collections.abc.Callable[..., typing.Any]] = None,
1096
+ ) -> int: ...
1097
+
1098
+ _read_file_into_fileobj: ___read_file_into_fileobj_spec[typing_extensions.Self]
1099
+
723
1100
  class __remove_file_spec(typing_extensions.Protocol[SUPERSELF]):
724
1101
  def __call__(self, /, path: str, recursive: bool = False) -> None:
725
1102
  """Remove a file or directory from a volume."""
@@ -840,14 +1217,33 @@ class Volume(modal.object.Object):
840
1217
  name: str,
841
1218
  client: typing.Optional[modal.client.Client] = None,
842
1219
  environment_name: typing.Optional[str] = None,
843
- ): ...
1220
+ ):
1221
+ """mdmd:hidden
1222
+ Delete a named Volume.
1223
+
1224
+ Warning: This deletes an *entire Volume*, not just a specific file.
1225
+ Deletion is irreversible and will affect any Apps currently using the Volume.
1226
+
1227
+ DEPRECATED: This method is deprecated; we recommend using `modal.Volume.objects.delete` instead.
1228
+ """
1229
+ ...
1230
+
844
1231
  async def aio(
845
1232
  self,
846
1233
  /,
847
1234
  name: str,
848
1235
  client: typing.Optional[modal.client.Client] = None,
849
1236
  environment_name: typing.Optional[str] = None,
850
- ): ...
1237
+ ):
1238
+ """mdmd:hidden
1239
+ Delete a named Volume.
1240
+
1241
+ Warning: This deletes an *entire Volume*, not just a specific file.
1242
+ Deletion is irreversible and will affect any Apps currently using the Volume.
1243
+
1244
+ DEPRECATED: This method is deprecated; we recommend using `modal.Volume.objects.delete` instead.
1245
+ """
1246
+ ...
851
1247
 
852
1248
  delete: __delete_spec
853
1249