modal 1.0.4.dev12__py3-none-any.whl → 1.0.5__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.
Files changed (67) hide show
  1. modal/_clustered_functions.pyi +13 -3
  2. modal/_functions.py +84 -46
  3. modal/_partial_function.py +1 -1
  4. modal/_runtime/container_io_manager.pyi +222 -40
  5. modal/_runtime/execution_context.pyi +60 -6
  6. modal/_serialization.py +25 -2
  7. modal/_tunnel.pyi +380 -12
  8. modal/_utils/async_utils.py +1 -1
  9. modal/_utils/blob_utils.py +56 -19
  10. modal/_utils/function_utils.py +33 -7
  11. modal/_utils/grpc_utils.py +11 -4
  12. modal/app.py +5 -5
  13. modal/app.pyi +658 -48
  14. modal/cli/run.py +2 -1
  15. modal/client.pyi +224 -36
  16. modal/cloud_bucket_mount.pyi +192 -4
  17. modal/cls.py +7 -7
  18. modal/cls.pyi +442 -35
  19. modal/container_process.pyi +103 -14
  20. modal/dict.py +4 -4
  21. modal/dict.pyi +453 -51
  22. modal/environments.pyi +41 -9
  23. modal/exception.py +6 -2
  24. modal/experimental/__init__.py +90 -0
  25. modal/experimental/ipython.py +11 -7
  26. modal/file_io.pyi +236 -45
  27. modal/functions.pyi +573 -65
  28. modal/gpu.py +1 -1
  29. modal/image.py +1 -1
  30. modal/image.pyi +1256 -74
  31. modal/io_streams.py +8 -4
  32. modal/io_streams.pyi +348 -38
  33. modal/mount.pyi +261 -31
  34. modal/network_file_system.py +3 -3
  35. modal/network_file_system.pyi +307 -26
  36. modal/object.pyi +48 -9
  37. modal/parallel_map.py +93 -19
  38. modal/parallel_map.pyi +160 -15
  39. modal/partial_function.pyi +255 -14
  40. modal/proxy.py +1 -1
  41. modal/proxy.pyi +28 -3
  42. modal/queue.py +4 -4
  43. modal/queue.pyi +447 -30
  44. modal/runner.pyi +160 -22
  45. modal/sandbox.py +8 -7
  46. modal/sandbox.pyi +310 -50
  47. modal/schedule.py +1 -1
  48. modal/secret.py +2 -2
  49. modal/secret.pyi +164 -15
  50. modal/snapshot.pyi +25 -4
  51. modal/token_flow.pyi +28 -8
  52. modal/volume.py +41 -4
  53. modal/volume.pyi +693 -59
  54. {modal-1.0.4.dev12.dist-info → modal-1.0.5.dist-info}/METADATA +3 -3
  55. {modal-1.0.4.dev12.dist-info → modal-1.0.5.dist-info}/RECORD +67 -67
  56. modal_proto/api.proto +56 -0
  57. modal_proto/api_grpc.py +48 -0
  58. modal_proto/api_pb2.py +874 -780
  59. modal_proto/api_pb2.pyi +194 -8
  60. modal_proto/api_pb2_grpc.py +100 -0
  61. modal_proto/api_pb2_grpc.pyi +32 -0
  62. modal_proto/modal_api_grpc.py +3 -0
  63. modal_version/__init__.py +1 -1
  64. {modal-1.0.4.dev12.dist-info → modal-1.0.5.dist-info}/WHEEL +0 -0
  65. {modal-1.0.4.dev12.dist-info → modal-1.0.5.dist-info}/entry_points.txt +0 -0
  66. {modal-1.0.4.dev12.dist-info → modal-1.0.5.dist-info}/licenses/LICENSE +0 -0
  67. {modal-1.0.4.dev12.dist-info → modal-1.0.5.dist-info}/top_level.txt +0 -0
modal/runner.pyi CHANGED
@@ -32,7 +32,10 @@ async def _create_all_objects(
32
32
  functions: dict[str, modal._functions._Function],
33
33
  classes: dict[str, modal.cls._Cls],
34
34
  environment_name: str,
35
- ) -> None: ...
35
+ ) -> None:
36
+ """Create objects that have been defined but not created on the server."""
37
+ ...
38
+
36
39
  async def _publish_app(
37
40
  client: modal.client._Client,
38
41
  running_app: modal.running_app.RunningApp,
@@ -42,11 +45,25 @@ async def _publish_app(
42
45
  name: str = "",
43
46
  tag: str = "",
44
47
  commit_info: typing.Optional[modal_proto.api_pb2.CommitInfo] = None,
45
- ) -> tuple[str, list[modal_proto.api_pb2.Warning]]: ...
46
- async def _disconnect(client: modal.client._Client, app_id: str, reason: int, exc_str: str = "") -> None: ...
48
+ ) -> tuple[str, list[modal_proto.api_pb2.Warning]]:
49
+ """Wrapper for AppPublish RPC."""
50
+ ...
51
+
52
+ async def _disconnect(client: modal.client._Client, app_id: str, reason: int, exc_str: str = "") -> None:
53
+ """Tell the server the client has disconnected for this app. Terminates all running tasks
54
+ for ephemeral apps.
55
+ """
56
+ ...
57
+
47
58
  async def _status_based_disconnect(
48
59
  client: modal.client._Client, app_id: str, exc_info: typing.Optional[BaseException] = None
49
- ): ...
60
+ ):
61
+ """Disconnect local session of a running app, sending relevant metadata
62
+
63
+ exc_info: Exception if an exception caused the disconnect
64
+ """
65
+ ...
66
+
50
67
  def _run_app(
51
68
  app: _App,
52
69
  *,
@@ -54,23 +71,47 @@ def _run_app(
54
71
  detach: bool = False,
55
72
  environment_name: typing.Optional[str] = None,
56
73
  interactive: bool = False,
57
- ) -> typing.AsyncContextManager[_App]: ...
74
+ ) -> typing.AsyncContextManager[_App]:
75
+ """mdmd:hidden"""
76
+ ...
77
+
58
78
  async def _serve_update(
59
79
  app: _App, existing_app_id: str, is_ready: multiprocessing.synchronize.Event, environment_name: str
60
- ) -> None: ...
80
+ ) -> None:
81
+ """mdmd:hidden"""
82
+ ...
61
83
 
62
84
  class DeployResult:
85
+ """Dataclass representing the result of deploying an app."""
86
+
63
87
  app_id: str
64
88
  app_page_url: str
65
89
  app_logs_url: str
66
90
  warnings: list[str]
67
91
 
68
- def __init__(self, app_id: str, app_page_url: str, app_logs_url: str, warnings: list[str]) -> None: ...
69
- def __repr__(self): ...
70
- def __eq__(self, other): ...
71
- def __setattr__(self, name, value): ...
72
- def __delattr__(self, name): ...
73
- def __hash__(self): ...
92
+ def __init__(self, app_id: str, app_page_url: str, app_logs_url: str, warnings: list[str]) -> None:
93
+ """Initialize self. See help(type(self)) for accurate signature."""
94
+ ...
95
+
96
+ def __repr__(self):
97
+ """Return repr(self)."""
98
+ ...
99
+
100
+ def __eq__(self, other):
101
+ """Return self==value."""
102
+ ...
103
+
104
+ def __setattr__(self, name, value):
105
+ """Implement setattr(self, name, value)."""
106
+ ...
107
+
108
+ def __delattr__(self, name):
109
+ """Implement delattr(self, name)."""
110
+ ...
111
+
112
+ def __hash__(self):
113
+ """Return hash(self)."""
114
+ ...
74
115
 
75
116
  async def _deploy_app(
76
117
  app: _App,
@@ -79,10 +120,39 @@ async def _deploy_app(
79
120
  client: typing.Optional[modal.client._Client] = None,
80
121
  environment_name: typing.Optional[str] = None,
81
122
  tag: str = "",
82
- ) -> DeployResult: ...
123
+ ) -> DeployResult:
124
+ """Internal function for deploying an App.
125
+
126
+ Users should prefer the `modal deploy` CLI or the `App.deploy` method.
127
+ """
128
+ ...
129
+
83
130
  async def _interactive_shell(
84
131
  _app: _App, cmds: list[str], environment_name: str = "", pty: bool = True, **kwargs: typing.Any
85
- ) -> None: ...
132
+ ) -> None:
133
+ """Run an interactive shell (like `bash`) within the image for this app.
134
+
135
+ This is useful for online debugging and interactive exploration of the
136
+ contents of this image. If `cmd` is optionally provided, it will be run
137
+ instead of the default shell inside this image.
138
+
139
+ **Example**
140
+
141
+ ```python
142
+ import modal
143
+
144
+ app = modal.App(image=modal.Image.debian_slim().apt_install("vim"))
145
+ ```
146
+
147
+ You can now run this using
148
+
149
+ ```
150
+ modal shell script.py --cmd /bin/bash
151
+ ```
152
+
153
+ When calling programmatically, `kwargs` are passed to `Sandbox.create()`.
154
+ """
155
+ ...
86
156
 
87
157
  class __run_app_spec(typing_extensions.Protocol):
88
158
  def __call__(
@@ -94,7 +164,10 @@ class __run_app_spec(typing_extensions.Protocol):
94
164
  detach: bool = False,
95
165
  environment_name: typing.Optional[str] = None,
96
166
  interactive: bool = False,
97
- ) -> synchronicity.combined_types.AsyncAndBlockingContextManager[_App]: ...
167
+ ) -> synchronicity.combined_types.AsyncAndBlockingContextManager[_App]:
168
+ """mdmd:hidden"""
169
+ ...
170
+
98
171
  def aio(
99
172
  self,
100
173
  /,
@@ -104,17 +177,24 @@ class __run_app_spec(typing_extensions.Protocol):
104
177
  detach: bool = False,
105
178
  environment_name: typing.Optional[str] = None,
106
179
  interactive: bool = False,
107
- ) -> typing.AsyncContextManager[_App]: ...
180
+ ) -> typing.AsyncContextManager[_App]:
181
+ """mdmd:hidden"""
182
+ ...
108
183
 
109
184
  run_app: __run_app_spec
110
185
 
111
186
  class __serve_update_spec(typing_extensions.Protocol):
112
187
  def __call__(
113
188
  self, /, app: _App, existing_app_id: str, is_ready: multiprocessing.synchronize.Event, environment_name: str
114
- ) -> None: ...
189
+ ) -> None:
190
+ """mdmd:hidden"""
191
+ ...
192
+
115
193
  async def aio(
116
194
  self, /, app: _App, existing_app_id: str, is_ready: multiprocessing.synchronize.Event, environment_name: str
117
- ) -> None: ...
195
+ ) -> None:
196
+ """mdmd:hidden"""
197
+ ...
118
198
 
119
199
  serve_update: __serve_update_spec
120
200
 
@@ -128,7 +208,13 @@ class __deploy_app_spec(typing_extensions.Protocol):
128
208
  client: typing.Optional[modal.client.Client] = None,
129
209
  environment_name: typing.Optional[str] = None,
130
210
  tag: str = "",
131
- ) -> DeployResult: ...
211
+ ) -> DeployResult:
212
+ """Internal function for deploying an App.
213
+
214
+ Users should prefer the `modal deploy` CLI or the `App.deploy` method.
215
+ """
216
+ ...
217
+
132
218
  async def aio(
133
219
  self,
134
220
  /,
@@ -138,16 +224,68 @@ class __deploy_app_spec(typing_extensions.Protocol):
138
224
  client: typing.Optional[modal.client.Client] = None,
139
225
  environment_name: typing.Optional[str] = None,
140
226
  tag: str = "",
141
- ) -> DeployResult: ...
227
+ ) -> DeployResult:
228
+ """Internal function for deploying an App.
229
+
230
+ Users should prefer the `modal deploy` CLI or the `App.deploy` method.
231
+ """
232
+ ...
142
233
 
143
234
  deploy_app: __deploy_app_spec
144
235
 
145
236
  class __interactive_shell_spec(typing_extensions.Protocol):
146
237
  def __call__(
147
238
  self, /, _app: _App, cmds: list[str], environment_name: str = "", pty: bool = True, **kwargs: typing.Any
148
- ) -> None: ...
239
+ ) -> None:
240
+ """Run an interactive shell (like `bash`) within the image for this app.
241
+
242
+ This is useful for online debugging and interactive exploration of the
243
+ contents of this image. If `cmd` is optionally provided, it will be run
244
+ instead of the default shell inside this image.
245
+
246
+ **Example**
247
+
248
+ ```python
249
+ import modal
250
+
251
+ app = modal.App(image=modal.Image.debian_slim().apt_install("vim"))
252
+ ```
253
+
254
+ You can now run this using
255
+
256
+ ```
257
+ modal shell script.py --cmd /bin/bash
258
+ ```
259
+
260
+ When calling programmatically, `kwargs` are passed to `Sandbox.create()`.
261
+ """
262
+ ...
263
+
149
264
  async def aio(
150
265
  self, /, _app: _App, cmds: list[str], environment_name: str = "", pty: bool = True, **kwargs: typing.Any
151
- ) -> None: ...
266
+ ) -> None:
267
+ """Run an interactive shell (like `bash`) within the image for this app.
268
+
269
+ This is useful for online debugging and interactive exploration of the
270
+ contents of this image. If `cmd` is optionally provided, it will be run
271
+ instead of the default shell inside this image.
272
+
273
+ **Example**
274
+
275
+ ```python
276
+ import modal
277
+
278
+ app = modal.App(image=modal.Image.debian_slim().apt_install("vim"))
279
+ ```
280
+
281
+ You can now run this using
282
+
283
+ ```
284
+ modal shell script.py --cmd /bin/bash
285
+ ```
286
+
287
+ When calling programmatically, `kwargs` are passed to `Sandbox.create()`.
288
+ """
289
+ ...
152
290
 
153
291
  interactive_shell: __interactive_shell_spec
modal/sandbox.py CHANGED
@@ -70,7 +70,7 @@ class _Sandbox(_Object, type_prefix="sb"):
70
70
  """A `Sandbox` object lets you interact with a running sandbox. This API is similar to Python's
71
71
  [asyncio.subprocess.Process](https://docs.python.org/3/library/asyncio-subprocess.html#asyncio.subprocess.Process).
72
72
 
73
- Refer to the [guide](/docs/guide/sandbox) on how to spawn and use sandboxes.
73
+ Refer to the [guide](https://modal.com/docs/guide/sandbox) on how to spawn and use sandboxes.
74
74
  """
75
75
 
76
76
  _result: Optional[api_pb2.GenericResult]
@@ -151,6 +151,7 @@ class _Sandbox(_Object, type_prefix="sb"):
151
151
  mount_path=path,
152
152
  volume_id=volume.object_id,
153
153
  allow_background_commits=True,
154
+ read_only=volume._read_only,
154
155
  )
155
156
  for path, volume in validated_volumes
156
157
  ]
@@ -516,7 +517,7 @@ class _Sandbox(_Object, type_prefix="sb"):
516
517
 
517
518
  Returns a dictionary of `Tunnel` objects which are keyed by the container port.
518
519
 
519
- NOTE: Previous to client [v0.64.153](/docs/reference/changelog#064153-2024-09-30), this
520
+ NOTE: Previous to client [v0.64.153](https://modal.com/docs/reference/changelog#064153-2024-09-30), this
520
521
  returned a list of `TunnelData` objects.
521
522
  """
522
523
 
@@ -617,7 +618,7 @@ class _Sandbox(_Object, type_prefix="sb"):
617
618
  ):
618
619
  """Execute a command in the Sandbox and return a ContainerProcess handle.
619
620
 
620
- See the [`ContainerProcess`](/docs/reference/modal.container_process#modalcontainer_processcontainerprocess)
621
+ See the [`ContainerProcess`](https://modal.com/docs/reference/modal.container_process#modalcontainer_processcontainerprocess)
621
622
  docs for more information.
622
623
 
623
624
  **Usage**
@@ -722,7 +723,7 @@ class _Sandbox(_Object, type_prefix="sb"):
722
723
  ):
723
724
  """Open a file in the Sandbox and return a FileIO handle.
724
725
 
725
- See the [`FileIO`](/docs/reference/modal.file_io#modalfile_iofileio) docs for more information.
726
+ See the [`FileIO`](https://modal.com/docs/reference/modal.file_io#modalfile_iofileio) docs for more information.
726
727
 
727
728
  **Usage**
728
729
 
@@ -766,7 +767,7 @@ class _Sandbox(_Object, type_prefix="sb"):
766
767
  @property
767
768
  def stdout(self) -> _StreamReader[str]:
768
769
  """
769
- [`StreamReader`](/docs/reference/modal.io_streams#modalio_streamsstreamreader) for
770
+ [`StreamReader`](https://modal.com/docs/reference/modal.io_streams#modalio_streamsstreamreader) for
770
771
  the sandbox's stdout stream.
771
772
  """
772
773
 
@@ -774,7 +775,7 @@ class _Sandbox(_Object, type_prefix="sb"):
774
775
 
775
776
  @property
776
777
  def stderr(self) -> _StreamReader[str]:
777
- """[`StreamReader`](/docs/reference/modal.io_streams#modalio_streamsstreamreader) for
778
+ """[`StreamReader`](https://modal.com/docs/reference/modal.io_streams#modalio_streamsstreamreader) for
778
779
  the Sandbox's stderr stream.
779
780
  """
780
781
 
@@ -783,7 +784,7 @@ class _Sandbox(_Object, type_prefix="sb"):
783
784
  @property
784
785
  def stdin(self) -> _StreamWriter:
785
786
  """
786
- [`StreamWriter`](/docs/reference/modal.io_streams#modalio_streamsstreamwriter) for
787
+ [`StreamWriter`](https://modal.com/docs/reference/modal.io_streams#modalio_streamsstreamwriter) for
787
788
  the Sandbox's stdin stream.
788
789
  """
789
790