modal 0.77.1.dev0__py3-none-any.whl → 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of modal might be problematic. Click here for more details.
- modal/__init__.py +10 -4
- modal/_functions.py +15 -90
- modal/_object.py +0 -14
- modal/_partial_function.py +4 -14
- modal/_serialization.py +2 -2
- modal/_utils/function_utils.py +3 -6
- modal/_utils/grpc_utils.py +6 -1
- modal/app.py +1 -104
- modal/app.pyi +0 -127
- modal/cli/app.py +0 -19
- modal/cli/programs/run_jupyter.py +1 -1
- modal/cli/programs/vscode.py +1 -1
- modal/client.pyi +2 -10
- modal/cls.py +9 -14
- modal/cls.pyi +2 -17
- modal/config.py +5 -16
- modal/container_process.py +1 -9
- modal/container_process.pyi +3 -3
- modal/dict.py +3 -5
- modal/environments.py +1 -3
- modal/exception.py +1 -1
- modal/functions.pyi +8 -29
- modal/image.py +12 -36
- modal/image.pyi +2 -5
- modal/mount.py +2 -65
- modal/mount.pyi +0 -1
- modal/network_file_system.py +3 -5
- modal/object.pyi +0 -6
- modal/queue.py +3 -5
- modal/runner.py +2 -19
- modal/runner.pyi +0 -5
- modal/sandbox.py +78 -32
- modal/sandbox.pyi +102 -7
- modal/secret.py +1 -3
- modal/serving.py +0 -6
- modal/serving.pyi +0 -3
- modal/volume.py +8 -17
- {modal-0.77.1.dev0.dist-info → modal-1.0.0.dist-info}/METADATA +1 -1
- {modal-0.77.1.dev0.dist-info → modal-1.0.0.dist-info}/RECORD +51 -51
- modal_proto/api.proto +29 -2
- modal_proto/api_grpc.py +32 -0
- modal_proto/api_pb2.py +788 -756
- modal_proto/api_pb2.pyi +86 -12
- modal_proto/api_pb2_grpc.py +66 -0
- modal_proto/api_pb2_grpc.pyi +20 -0
- modal_proto/modal_api_grpc.py +2 -0
- modal_version/__init__.py +1 -1
- {modal-0.77.1.dev0.dist-info → modal-1.0.0.dist-info}/WHEEL +0 -0
- {modal-0.77.1.dev0.dist-info → modal-1.0.0.dist-info}/entry_points.txt +0 -0
- {modal-0.77.1.dev0.dist-info → modal-1.0.0.dist-info}/licenses/LICENSE +0 -0
- {modal-0.77.1.dev0.dist-info → modal-1.0.0.dist-info}/top_level.txt +0 -0
modal/app.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# Copyright Modal Labs 2022
|
2
2
|
import inspect
|
3
3
|
import typing
|
4
|
-
import warnings
|
5
4
|
from collections.abc import AsyncGenerator, Coroutine, Sequence
|
6
5
|
from pathlib import PurePosixPath
|
7
6
|
from textwrap import dedent
|
@@ -30,9 +29,7 @@ from ._partial_function import (
|
|
30
29
|
)
|
31
30
|
from ._utils.async_utils import synchronize_api
|
32
31
|
from ._utils.deprecation import (
|
33
|
-
deprecation_error,
|
34
32
|
deprecation_warning,
|
35
|
-
renamed_parameter,
|
36
33
|
warn_on_renamed_autoscaler_settings,
|
37
34
|
)
|
38
35
|
from ._utils.function_utils import FunctionInfo, is_global_object, is_method_fn
|
@@ -47,7 +44,6 @@ from .exception import ExecutionError, InvalidError
|
|
47
44
|
from .functions import Function
|
48
45
|
from .gpu import GPU_T
|
49
46
|
from .image import _Image
|
50
|
-
from .mount import _Mount
|
51
47
|
from .network_file_system import _NetworkFileSystem
|
52
48
|
from .partial_function import PartialFunction
|
53
49
|
from .proxy import _Proxy
|
@@ -80,11 +76,6 @@ class _LocalEntrypoint:
|
|
80
76
|
def app(self) -> "_App":
|
81
77
|
return self._app
|
82
78
|
|
83
|
-
@property
|
84
|
-
def stub(self) -> "_App":
|
85
|
-
# Deprecated soon, only for backwards compatibility
|
86
|
-
return self._app
|
87
|
-
|
88
79
|
|
89
80
|
LocalEntrypoint = synchronize_api(_LocalEntrypoint)
|
90
81
|
|
@@ -164,7 +155,6 @@ class _App:
|
|
164
155
|
_classes: dict[str, _Cls]
|
165
156
|
|
166
157
|
_image: Optional[_Image]
|
167
|
-
_mounts: Sequence[_Mount]
|
168
158
|
_secrets: Sequence[_Secret]
|
169
159
|
_volumes: dict[Union[str, PurePosixPath], _Volume]
|
170
160
|
_web_endpoints: list[str] # Used by the CLI
|
@@ -182,7 +172,6 @@ class _App:
|
|
182
172
|
name: Optional[str] = None,
|
183
173
|
*,
|
184
174
|
image: Optional[_Image] = None, # default image for all functions (default is `modal.Image.debian_slim()`)
|
185
|
-
mounts: Sequence[_Mount] = [], # default mounts for all functions
|
186
175
|
secrets: Sequence[_Secret] = [], # default secrets for all functions
|
187
176
|
volumes: dict[Union[str, PurePosixPath], _Volume] = {}, # default volumes for all functions
|
188
177
|
include_source: Optional[bool] = None,
|
@@ -203,7 +192,6 @@ class _App:
|
|
203
192
|
self._description = name
|
204
193
|
self._include_source_default = include_source
|
205
194
|
|
206
|
-
check_sequence(mounts, _Mount, "`mounts=` has to be a list or tuple of `modal.Mount` objects")
|
207
195
|
check_sequence(secrets, _Secret, "`secrets=` has to be a list or tuple of `modal.Secret` objects")
|
208
196
|
validate_volumes(volumes)
|
209
197
|
|
@@ -213,7 +201,6 @@ class _App:
|
|
213
201
|
self._functions = {}
|
214
202
|
self._classes = {}
|
215
203
|
self._image = image
|
216
|
-
self._mounts = mounts
|
217
204
|
self._secrets = secrets
|
218
205
|
self._volumes = volumes
|
219
206
|
self._local_entrypoints = {}
|
@@ -251,7 +238,6 @@ class _App:
|
|
251
238
|
return self._description
|
252
239
|
|
253
240
|
@staticmethod
|
254
|
-
@renamed_parameter((2024, 12, 18), "label", "name")
|
255
241
|
async def lookup(
|
256
242
|
name: str,
|
257
243
|
*,
|
@@ -330,7 +316,6 @@ class _App:
|
|
330
316
|
self,
|
331
317
|
*,
|
332
318
|
client: Optional[_Client] = None,
|
333
|
-
show_progress: Optional[bool] = None,
|
334
319
|
detach: bool = False,
|
335
320
|
interactive: bool = False,
|
336
321
|
environment_name: Optional[str] = None,
|
@@ -376,16 +361,6 @@ class _App:
|
|
376
361
|
"""
|
377
362
|
from .runner import _run_app # Defer import of runner.py, which imports a lot from Rich
|
378
363
|
|
379
|
-
# See Github discussion here: https://github.com/modal-labs/modal-client/pull/2030#issuecomment-2237266186
|
380
|
-
|
381
|
-
if show_progress is True:
|
382
|
-
deprecation_error(
|
383
|
-
(2024, 11, 20),
|
384
|
-
"`show_progress=True` is no longer supported. Use `with modal.enable_output():` instead.",
|
385
|
-
)
|
386
|
-
elif show_progress is False:
|
387
|
-
deprecation_warning((2024, 11, 20), "`show_progress=False` is deprecated (and has no effect)")
|
388
|
-
|
389
364
|
async with _run_app(
|
390
365
|
self, client=client, detach=detach, interactive=interactive, environment_name=environment_name
|
391
366
|
):
|
@@ -466,9 +441,7 @@ class _App:
|
|
466
441
|
if not self._running_app:
|
467
442
|
raise ExecutionError("`_get_watch_mounts` requires a running app.")
|
468
443
|
|
469
|
-
all_mounts = [
|
470
|
-
*self._mounts,
|
471
|
-
]
|
444
|
+
all_mounts = []
|
472
445
|
for function in self.registered_functions.values():
|
473
446
|
all_mounts.extend(function._serve_mounts)
|
474
447
|
|
@@ -548,14 +521,6 @@ class _App:
|
|
548
521
|
"""All local CLI entrypoints registered on the app."""
|
549
522
|
return self._local_entrypoints
|
550
523
|
|
551
|
-
@property
|
552
|
-
def indexed_objects(self) -> dict[str, _Object]:
|
553
|
-
deprecation_warning(
|
554
|
-
(2024, 11, 25),
|
555
|
-
"`app.indexed_objects` is deprecated! Use `app.registered_functions` or `app.registered_classes` instead.",
|
556
|
-
)
|
557
|
-
return dict(**self._functions, **self._classes)
|
558
|
-
|
559
524
|
@property
|
560
525
|
def registered_web_endpoints(self) -> list[str]:
|
561
526
|
"""Names of web endpoint (ie. webhook) functions registered on the app."""
|
@@ -640,7 +605,6 @@ class _App:
|
|
640
605
|
GPU_T, list[GPU_T]
|
641
606
|
] = None, # GPU request as string ("any", "T4", ...), object (`modal.GPU.A100()`, ...), or a list of either
|
642
607
|
serialized: bool = False, # Whether to send the function over using cloudpickle.
|
643
|
-
mounts: Sequence[_Mount] = (), # Modal Mounts added to the container
|
644
608
|
network_file_systems: dict[
|
645
609
|
Union[str, PurePosixPath], _NetworkFileSystem
|
646
610
|
] = {}, # Mountpoints for Modal NetworkFileSystems
|
@@ -803,12 +767,6 @@ class _App:
|
|
803
767
|
rdma = None
|
804
768
|
i6pn_enabled = i6pn
|
805
769
|
|
806
|
-
if info.function_name.endswith(".app"):
|
807
|
-
warnings.warn(
|
808
|
-
"Beware: the function name is `app`. Modal will soon rename `Stub` to `App`, "
|
809
|
-
"so you might run into issues if you have code like `app = modal.App()` in the same scope"
|
810
|
-
)
|
811
|
-
|
812
770
|
if is_generator is None:
|
813
771
|
is_generator = inspect.isgeneratorfunction(raw_f) or inspect.isasyncgenfunction(raw_f)
|
814
772
|
|
@@ -826,7 +784,6 @@ class _App:
|
|
826
784
|
schedule=schedule,
|
827
785
|
is_generator=is_generator,
|
828
786
|
gpu=gpu,
|
829
|
-
mounts=[*self._mounts, *mounts],
|
830
787
|
network_file_systems=network_file_systems,
|
831
788
|
volumes={**self._volumes, **volumes},
|
832
789
|
cpu=cpu,
|
@@ -877,7 +834,6 @@ class _App:
|
|
877
834
|
GPU_T, list[GPU_T]
|
878
835
|
] = None, # GPU request as string ("any", "T4", ...), object (`modal.GPU.A100()`, ...), or a list of either
|
879
836
|
serialized: bool = False, # Whether to send the function over using cloudpickle.
|
880
|
-
mounts: Sequence[_Mount] = (),
|
881
837
|
network_file_systems: dict[
|
882
838
|
Union[str, PurePosixPath], _NetworkFileSystem
|
883
839
|
] = {}, # Mountpoints for Modal NetworkFileSystems
|
@@ -999,7 +955,6 @@ class _App:
|
|
999
955
|
image=image or self._get_default_image(),
|
1000
956
|
secrets=[*self._secrets, *secrets],
|
1001
957
|
gpu=gpu,
|
1002
|
-
mounts=[*self._mounts, *mounts],
|
1003
958
|
network_file_systems=network_file_systems,
|
1004
959
|
volumes={**self._volumes, **volumes},
|
1005
960
|
cpu=cpu,
|
@@ -1039,44 +994,6 @@ class _App:
|
|
1039
994
|
|
1040
995
|
return wrapper
|
1041
996
|
|
1042
|
-
async def spawn_sandbox(
|
1043
|
-
self,
|
1044
|
-
*entrypoint_args: str,
|
1045
|
-
image: Optional[_Image] = None, # The image to run as the container for the sandbox.
|
1046
|
-
mounts: Sequence[_Mount] = (), # Mounts to attach to the sandbox.
|
1047
|
-
secrets: Sequence[_Secret] = (), # Environment variables to inject into the sandbox.
|
1048
|
-
network_file_systems: dict[Union[str, PurePosixPath], _NetworkFileSystem] = {},
|
1049
|
-
timeout: Optional[int] = None, # Maximum execution time of the sandbox in seconds.
|
1050
|
-
workdir: Optional[str] = None, # Working directory of the sandbox.
|
1051
|
-
gpu: GPU_T = None,
|
1052
|
-
cloud: Optional[str] = None,
|
1053
|
-
region: Optional[Union[str, Sequence[str]]] = None, # Region or regions to run the sandbox on.
|
1054
|
-
# Specify, in fractional CPU cores, how many CPU cores to request.
|
1055
|
-
# Or, pass (request, limit) to additionally specify a hard limit in fractional CPU cores.
|
1056
|
-
# CPU throttling will prevent a container from exceeding its specified limit.
|
1057
|
-
cpu: Optional[Union[float, tuple[float, float]]] = None,
|
1058
|
-
# Specify, in MiB, a memory request which is the minimum memory required.
|
1059
|
-
# Or, pass (request, limit) to additionally specify a hard limit in MiB.
|
1060
|
-
memory: Optional[Union[int, tuple[int, int]]] = None,
|
1061
|
-
block_network: bool = False, # Whether to block network access
|
1062
|
-
volumes: dict[
|
1063
|
-
Union[str, PurePosixPath], Union[_Volume, _CloudBucketMount]
|
1064
|
-
] = {}, # Mount points for Modal Volumes and CloudBucketMounts
|
1065
|
-
pty_info: Optional[api_pb2.PTYInfo] = None,
|
1066
|
-
_experimental_scheduler_placement: Optional[
|
1067
|
-
SchedulerPlacement
|
1068
|
-
] = None, # Experimental controls over fine-grained scheduling (alpha).
|
1069
|
-
) -> None:
|
1070
|
-
"""mdmd:hidden"""
|
1071
|
-
arglist = ", ".join(repr(s) for s in entrypoint_args)
|
1072
|
-
message = (
|
1073
|
-
"`App.spawn_sandbox` is deprecated.\n\n"
|
1074
|
-
"Sandboxes can be created using the `Sandbox` object:\n\n"
|
1075
|
-
f"```\nsb = Sandbox.create({arglist}, app=app)\n```\n\n"
|
1076
|
-
"See https://modal.com/docs/guide/sandbox for more info on working with sandboxes."
|
1077
|
-
)
|
1078
|
-
deprecation_error((2024, 7, 5), message)
|
1079
|
-
|
1080
997
|
def include(self, /, other_app: "_App") -> typing_extensions.Self:
|
1081
998
|
"""Include another App's objects in this one.
|
1082
999
|
|
@@ -1156,23 +1073,3 @@ class _App:
|
|
1156
1073
|
|
1157
1074
|
|
1158
1075
|
App = synchronize_api(_App)
|
1159
|
-
|
1160
|
-
|
1161
|
-
class _Stub(_App):
|
1162
|
-
"""mdmd:hidden
|
1163
|
-
This enables using a "Stub" class instead of "App".
|
1164
|
-
|
1165
|
-
For most of Modal's history, the app class was called "Stub", so this exists for
|
1166
|
-
backwards compatibility, in order to facilitate moving from "Stub" to "App".
|
1167
|
-
"""
|
1168
|
-
|
1169
|
-
def __new__(cls, *args, **kwargs):
|
1170
|
-
deprecation_warning(
|
1171
|
-
(2024, 4, 29),
|
1172
|
-
'The use of "Stub" has been deprecated in favor of "App".'
|
1173
|
-
" This is a pure name change with no other implications.",
|
1174
|
-
)
|
1175
|
-
return _App(*args, **kwargs)
|
1176
|
-
|
1177
|
-
|
1178
|
-
Stub = synchronize_api(_Stub)
|
modal/app.pyi
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import collections.abc
|
2
2
|
import modal._functions
|
3
|
-
import modal._object
|
4
3
|
import modal._partial_function
|
5
4
|
import modal._utils.function_utils
|
6
5
|
import modal.client
|
@@ -9,9 +8,7 @@ import modal.cls
|
|
9
8
|
import modal.functions
|
10
9
|
import modal.gpu
|
11
10
|
import modal.image
|
12
|
-
import modal.mount
|
13
11
|
import modal.network_file_system
|
14
|
-
import modal.object
|
15
12
|
import modal.partial_function
|
16
13
|
import modal.proxy
|
17
14
|
import modal.retries
|
@@ -20,7 +17,6 @@ import modal.schedule
|
|
20
17
|
import modal.scheduler_placement
|
21
18
|
import modal.secret
|
22
19
|
import modal.volume
|
23
|
-
import modal_proto.api_pb2
|
24
20
|
import pathlib
|
25
21
|
import synchronicity.combined_types
|
26
22
|
import typing
|
@@ -36,8 +32,6 @@ class _LocalEntrypoint:
|
|
36
32
|
def info(self) -> modal._utils.function_utils.FunctionInfo: ...
|
37
33
|
@property
|
38
34
|
def app(self) -> _App: ...
|
39
|
-
@property
|
40
|
-
def stub(self) -> _App: ...
|
41
35
|
|
42
36
|
class LocalEntrypoint:
|
43
37
|
_info: modal._utils.function_utils.FunctionInfo
|
@@ -49,8 +43,6 @@ class LocalEntrypoint:
|
|
49
43
|
def info(self) -> modal._utils.function_utils.FunctionInfo: ...
|
50
44
|
@property
|
51
45
|
def app(self) -> App: ...
|
52
|
-
@property
|
53
|
-
def stub(self) -> App: ...
|
54
46
|
|
55
47
|
def check_sequence(items: typing.Sequence[typing.Any], item_type: type[typing.Any], error_msg: str) -> None: ...
|
56
48
|
|
@@ -84,7 +76,6 @@ class _App:
|
|
84
76
|
_functions: dict[str, modal._functions._Function]
|
85
77
|
_classes: dict[str, modal.cls._Cls]
|
86
78
|
_image: typing.Optional[modal.image._Image]
|
87
|
-
_mounts: collections.abc.Sequence[modal.mount._Mount]
|
88
79
|
_secrets: collections.abc.Sequence[modal.secret._Secret]
|
89
80
|
_volumes: dict[typing.Union[str, pathlib.PurePosixPath], modal.volume._Volume]
|
90
81
|
_web_endpoints: list[str]
|
@@ -99,7 +90,6 @@ class _App:
|
|
99
90
|
name: typing.Optional[str] = None,
|
100
91
|
*,
|
101
92
|
image: typing.Optional[modal.image._Image] = None,
|
102
|
-
mounts: collections.abc.Sequence[modal.mount._Mount] = [],
|
103
93
|
secrets: collections.abc.Sequence[modal.secret._Secret] = [],
|
104
94
|
volumes: dict[typing.Union[str, pathlib.PurePosixPath], modal.volume._Volume] = {},
|
105
95
|
include_source: typing.Optional[bool] = None,
|
@@ -134,7 +124,6 @@ class _App:
|
|
134
124
|
self,
|
135
125
|
*,
|
136
126
|
client: typing.Optional[modal.client._Client] = None,
|
137
|
-
show_progress: typing.Optional[bool] = None,
|
138
127
|
detach: bool = False,
|
139
128
|
interactive: bool = False,
|
140
129
|
environment_name: typing.Optional[str] = None,
|
@@ -159,8 +148,6 @@ class _App:
|
|
159
148
|
@property
|
160
149
|
def registered_entrypoints(self) -> dict[str, _LocalEntrypoint]: ...
|
161
150
|
@property
|
162
|
-
def indexed_objects(self) -> dict[str, modal._object._Object]: ...
|
163
|
-
@property
|
164
151
|
def registered_web_endpoints(self) -> list[str]: ...
|
165
152
|
def local_entrypoint(
|
166
153
|
self, _warn_parentheses_missing: typing.Any = None, *, name: typing.Optional[str] = None
|
@@ -174,7 +161,6 @@ class _App:
|
|
174
161
|
secrets: collections.abc.Sequence[modal.secret._Secret] = (),
|
175
162
|
gpu: typing.Union[None, str, modal.gpu._GPUConfig, list[typing.Union[None, str, modal.gpu._GPUConfig]]] = None,
|
176
163
|
serialized: bool = False,
|
177
|
-
mounts: collections.abc.Sequence[modal.mount._Mount] = (),
|
178
164
|
network_file_systems: dict[
|
179
165
|
typing.Union[str, pathlib.PurePosixPath], modal.network_file_system._NetworkFileSystem
|
180
166
|
] = {},
|
@@ -226,7 +212,6 @@ class _App:
|
|
226
212
|
secrets: collections.abc.Sequence[modal.secret._Secret] = (),
|
227
213
|
gpu: typing.Union[None, str, modal.gpu._GPUConfig, list[typing.Union[None, str, modal.gpu._GPUConfig]]] = None,
|
228
214
|
serialized: bool = False,
|
229
|
-
mounts: collections.abc.Sequence[modal.mount._Mount] = (),
|
230
215
|
network_file_systems: dict[
|
231
216
|
typing.Union[str, pathlib.PurePosixPath], modal.network_file_system._NetworkFileSystem
|
232
217
|
] = {},
|
@@ -263,30 +248,6 @@ class _App:
|
|
263
248
|
_experimental_buffer_containers: typing.Optional[int] = None,
|
264
249
|
allow_cross_region_volumes: typing.Optional[bool] = None,
|
265
250
|
) -> collections.abc.Callable[[typing.Union[CLS_T, modal._partial_function._PartialFunction]], CLS_T]: ...
|
266
|
-
async def spawn_sandbox(
|
267
|
-
self,
|
268
|
-
*entrypoint_args: str,
|
269
|
-
image: typing.Optional[modal.image._Image] = None,
|
270
|
-
mounts: collections.abc.Sequence[modal.mount._Mount] = (),
|
271
|
-
secrets: collections.abc.Sequence[modal.secret._Secret] = (),
|
272
|
-
network_file_systems: dict[
|
273
|
-
typing.Union[str, pathlib.PurePosixPath], modal.network_file_system._NetworkFileSystem
|
274
|
-
] = {},
|
275
|
-
timeout: typing.Optional[int] = None,
|
276
|
-
workdir: typing.Optional[str] = None,
|
277
|
-
gpu: typing.Union[None, str, modal.gpu._GPUConfig] = None,
|
278
|
-
cloud: typing.Optional[str] = None,
|
279
|
-
region: typing.Union[str, collections.abc.Sequence[str], None] = None,
|
280
|
-
cpu: typing.Union[float, tuple[float, float], None] = None,
|
281
|
-
memory: typing.Union[int, tuple[int, int], None] = None,
|
282
|
-
block_network: bool = False,
|
283
|
-
volumes: dict[
|
284
|
-
typing.Union[str, pathlib.PurePosixPath],
|
285
|
-
typing.Union[modal.volume._Volume, modal.cloud_bucket_mount._CloudBucketMount],
|
286
|
-
] = {},
|
287
|
-
pty_info: typing.Optional[modal_proto.api_pb2.PTYInfo] = None,
|
288
|
-
_experimental_scheduler_placement: typing.Optional[modal.scheduler_placement.SchedulerPlacement] = None,
|
289
|
-
) -> None: ...
|
290
251
|
def include(self, /, other_app: _App) -> typing_extensions.Self: ...
|
291
252
|
def _logs(
|
292
253
|
self, client: typing.Optional[modal.client._Client] = None
|
@@ -306,7 +267,6 @@ class App:
|
|
306
267
|
_functions: dict[str, modal.functions.Function]
|
307
268
|
_classes: dict[str, modal.cls.Cls]
|
308
269
|
_image: typing.Optional[modal.image.Image]
|
309
|
-
_mounts: collections.abc.Sequence[modal.mount.Mount]
|
310
270
|
_secrets: collections.abc.Sequence[modal.secret.Secret]
|
311
271
|
_volumes: dict[typing.Union[str, pathlib.PurePosixPath], modal.volume.Volume]
|
312
272
|
_web_endpoints: list[str]
|
@@ -321,7 +281,6 @@ class App:
|
|
321
281
|
name: typing.Optional[str] = None,
|
322
282
|
*,
|
323
283
|
image: typing.Optional[modal.image.Image] = None,
|
324
|
-
mounts: collections.abc.Sequence[modal.mount.Mount] = [],
|
325
284
|
secrets: collections.abc.Sequence[modal.secret.Secret] = [],
|
326
285
|
volumes: dict[typing.Union[str, pathlib.PurePosixPath], modal.volume.Volume] = {},
|
327
286
|
include_source: typing.Optional[bool] = None,
|
@@ -381,7 +340,6 @@ class App:
|
|
381
340
|
/,
|
382
341
|
*,
|
383
342
|
client: typing.Optional[modal.client.Client] = None,
|
384
|
-
show_progress: typing.Optional[bool] = None,
|
385
343
|
detach: bool = False,
|
386
344
|
interactive: bool = False,
|
387
345
|
environment_name: typing.Optional[str] = None,
|
@@ -391,7 +349,6 @@ class App:
|
|
391
349
|
/,
|
392
350
|
*,
|
393
351
|
client: typing.Optional[modal.client.Client] = None,
|
394
|
-
show_progress: typing.Optional[bool] = None,
|
395
352
|
detach: bool = False,
|
396
353
|
interactive: bool = False,
|
397
354
|
environment_name: typing.Optional[str] = None,
|
@@ -433,8 +390,6 @@ class App:
|
|
433
390
|
@property
|
434
391
|
def registered_entrypoints(self) -> dict[str, LocalEntrypoint]: ...
|
435
392
|
@property
|
436
|
-
def indexed_objects(self) -> dict[str, modal.object.Object]: ...
|
437
|
-
@property
|
438
393
|
def registered_web_endpoints(self) -> list[str]: ...
|
439
394
|
def local_entrypoint(
|
440
395
|
self, _warn_parentheses_missing: typing.Any = None, *, name: typing.Optional[str] = None
|
@@ -448,7 +403,6 @@ class App:
|
|
448
403
|
secrets: collections.abc.Sequence[modal.secret.Secret] = (),
|
449
404
|
gpu: typing.Union[None, str, modal.gpu._GPUConfig, list[typing.Union[None, str, modal.gpu._GPUConfig]]] = None,
|
450
405
|
serialized: bool = False,
|
451
|
-
mounts: collections.abc.Sequence[modal.mount.Mount] = (),
|
452
406
|
network_file_systems: dict[
|
453
407
|
typing.Union[str, pathlib.PurePosixPath], modal.network_file_system.NetworkFileSystem
|
454
408
|
] = {},
|
@@ -500,7 +454,6 @@ class App:
|
|
500
454
|
secrets: collections.abc.Sequence[modal.secret.Secret] = (),
|
501
455
|
gpu: typing.Union[None, str, modal.gpu._GPUConfig, list[typing.Union[None, str, modal.gpu._GPUConfig]]] = None,
|
502
456
|
serialized: bool = False,
|
503
|
-
mounts: collections.abc.Sequence[modal.mount.Mount] = (),
|
504
457
|
network_file_systems: dict[
|
505
458
|
typing.Union[str, pathlib.PurePosixPath], modal.network_file_system.NetworkFileSystem
|
506
459
|
] = {},
|
@@ -537,61 +490,6 @@ class App:
|
|
537
490
|
_experimental_buffer_containers: typing.Optional[int] = None,
|
538
491
|
allow_cross_region_volumes: typing.Optional[bool] = None,
|
539
492
|
) -> collections.abc.Callable[[typing.Union[CLS_T, modal.partial_function.PartialFunction]], CLS_T]: ...
|
540
|
-
|
541
|
-
class __spawn_sandbox_spec(typing_extensions.Protocol[SUPERSELF]):
|
542
|
-
def __call__(
|
543
|
-
self,
|
544
|
-
/,
|
545
|
-
*entrypoint_args: str,
|
546
|
-
image: typing.Optional[modal.image.Image] = None,
|
547
|
-
mounts: collections.abc.Sequence[modal.mount.Mount] = (),
|
548
|
-
secrets: collections.abc.Sequence[modal.secret.Secret] = (),
|
549
|
-
network_file_systems: dict[
|
550
|
-
typing.Union[str, pathlib.PurePosixPath], modal.network_file_system.NetworkFileSystem
|
551
|
-
] = {},
|
552
|
-
timeout: typing.Optional[int] = None,
|
553
|
-
workdir: typing.Optional[str] = None,
|
554
|
-
gpu: typing.Union[None, str, modal.gpu._GPUConfig] = None,
|
555
|
-
cloud: typing.Optional[str] = None,
|
556
|
-
region: typing.Union[str, collections.abc.Sequence[str], None] = None,
|
557
|
-
cpu: typing.Union[float, tuple[float, float], None] = None,
|
558
|
-
memory: typing.Union[int, tuple[int, int], None] = None,
|
559
|
-
block_network: bool = False,
|
560
|
-
volumes: dict[
|
561
|
-
typing.Union[str, pathlib.PurePosixPath],
|
562
|
-
typing.Union[modal.volume.Volume, modal.cloud_bucket_mount.CloudBucketMount],
|
563
|
-
] = {},
|
564
|
-
pty_info: typing.Optional[modal_proto.api_pb2.PTYInfo] = None,
|
565
|
-
_experimental_scheduler_placement: typing.Optional[modal.scheduler_placement.SchedulerPlacement] = None,
|
566
|
-
) -> None: ...
|
567
|
-
async def aio(
|
568
|
-
self,
|
569
|
-
/,
|
570
|
-
*entrypoint_args: str,
|
571
|
-
image: typing.Optional[modal.image.Image] = None,
|
572
|
-
mounts: collections.abc.Sequence[modal.mount.Mount] = (),
|
573
|
-
secrets: collections.abc.Sequence[modal.secret.Secret] = (),
|
574
|
-
network_file_systems: dict[
|
575
|
-
typing.Union[str, pathlib.PurePosixPath], modal.network_file_system.NetworkFileSystem
|
576
|
-
] = {},
|
577
|
-
timeout: typing.Optional[int] = None,
|
578
|
-
workdir: typing.Optional[str] = None,
|
579
|
-
gpu: typing.Union[None, str, modal.gpu._GPUConfig] = None,
|
580
|
-
cloud: typing.Optional[str] = None,
|
581
|
-
region: typing.Union[str, collections.abc.Sequence[str], None] = None,
|
582
|
-
cpu: typing.Union[float, tuple[float, float], None] = None,
|
583
|
-
memory: typing.Union[int, tuple[int, int], None] = None,
|
584
|
-
block_network: bool = False,
|
585
|
-
volumes: dict[
|
586
|
-
typing.Union[str, pathlib.PurePosixPath],
|
587
|
-
typing.Union[modal.volume.Volume, modal.cloud_bucket_mount.CloudBucketMount],
|
588
|
-
] = {},
|
589
|
-
pty_info: typing.Optional[modal_proto.api_pb2.PTYInfo] = None,
|
590
|
-
_experimental_scheduler_placement: typing.Optional[modal.scheduler_placement.SchedulerPlacement] = None,
|
591
|
-
) -> None: ...
|
592
|
-
|
593
|
-
spawn_sandbox: __spawn_sandbox_spec[typing_extensions.Self]
|
594
|
-
|
595
493
|
def include(self, /, other_app: App) -> typing_extensions.Self: ...
|
596
494
|
|
597
495
|
class ___logs_spec(typing_extensions.Protocol[SUPERSELF]):
|
@@ -609,29 +507,4 @@ class App:
|
|
609
507
|
@classmethod
|
610
508
|
def _reset_container_app(cls): ...
|
611
509
|
|
612
|
-
class _Stub(_App):
|
613
|
-
@staticmethod
|
614
|
-
def __new__(
|
615
|
-
cls,
|
616
|
-
name: typing.Optional[str] = None,
|
617
|
-
*,
|
618
|
-
image: typing.Optional[modal.image._Image] = None,
|
619
|
-
mounts: collections.abc.Sequence[modal.mount._Mount] = [],
|
620
|
-
secrets: collections.abc.Sequence[modal.secret._Secret] = [],
|
621
|
-
volumes: dict[typing.Union[str, pathlib.PurePosixPath], modal.volume._Volume] = {},
|
622
|
-
include_source: typing.Optional[bool] = None,
|
623
|
-
): ...
|
624
|
-
|
625
|
-
class Stub(App):
|
626
|
-
def __init__(
|
627
|
-
self,
|
628
|
-
name: typing.Optional[str] = None,
|
629
|
-
*,
|
630
|
-
image: typing.Optional[modal.image.Image] = None,
|
631
|
-
mounts: collections.abc.Sequence[modal.mount.Mount] = [],
|
632
|
-
secrets: collections.abc.Sequence[modal.secret.Secret] = [],
|
633
|
-
volumes: dict[typing.Union[str, pathlib.PurePosixPath], modal.volume.Volume] = {},
|
634
|
-
include_source: typing.Optional[bool] = None,
|
635
|
-
) -> None: ...
|
636
|
-
|
637
510
|
_default_image: modal.image._Image
|
modal/cli/app.py
CHANGED
@@ -11,7 +11,6 @@ from typer import Argument
|
|
11
11
|
|
12
12
|
from modal._object import _get_environment_name
|
13
13
|
from modal._utils.async_utils import synchronizer
|
14
|
-
from modal._utils.deprecation import deprecation_warning
|
15
14
|
from modal.client import _Client
|
16
15
|
from modal.environments import ensure_env
|
17
16
|
from modal_proto import api_pb2
|
@@ -43,18 +42,6 @@ async def get_app_id(app_identifier: str, env: Optional[str], client: Optional[_
|
|
43
42
|
return await get_app_id_from_name.aio(app_identifier, env, client)
|
44
43
|
|
45
44
|
|
46
|
-
def warn_on_name_option(command: str, app_identifier: str, name: str) -> str:
|
47
|
-
if name:
|
48
|
-
message = (
|
49
|
-
"Passing an App name using --name is deprecated;"
|
50
|
-
" App names can now be passed directly as positional arguments:"
|
51
|
-
f"\n\n modal app {command} {name} ..."
|
52
|
-
)
|
53
|
-
deprecation_warning((2024, 8, 15), message, show_source=False)
|
54
|
-
return name
|
55
|
-
return app_identifier
|
56
|
-
|
57
|
-
|
58
45
|
@app_cli.command("list")
|
59
46
|
@synchronizer.create_blocking
|
60
47
|
async def list_(env: Optional[str] = ENV_OPTION, json: bool = False):
|
@@ -96,7 +83,6 @@ async def list_(env: Optional[str] = ENV_OPTION, json: bool = False):
|
|
96
83
|
def logs(
|
97
84
|
app_identifier: str = APP_IDENTIFIER,
|
98
85
|
*,
|
99
|
-
name: str = NAME_OPTION,
|
100
86
|
env: Optional[str] = ENV_OPTION,
|
101
87
|
):
|
102
88
|
"""Show App logs, streaming while active.
|
@@ -116,7 +102,6 @@ def logs(
|
|
116
102
|
```
|
117
103
|
|
118
104
|
"""
|
119
|
-
app_identifier = warn_on_name_option("logs", app_identifier, name)
|
120
105
|
app_id = get_app_id(app_identifier, env)
|
121
106
|
stream_app_logs(app_id)
|
122
107
|
|
@@ -176,11 +161,9 @@ async def rollback(
|
|
176
161
|
async def stop(
|
177
162
|
app_identifier: str = APP_IDENTIFIER,
|
178
163
|
*,
|
179
|
-
name: str = NAME_OPTION,
|
180
164
|
env: Optional[str] = ENV_OPTION,
|
181
165
|
):
|
182
166
|
"""Stop an app."""
|
183
|
-
app_identifier = warn_on_name_option("stop", app_identifier, name)
|
184
167
|
client = await _Client.from_env()
|
185
168
|
app_id = await get_app_id.aio(app_identifier, env)
|
186
169
|
req = api_pb2.AppStopRequest(app_id=app_id, source=api_pb2.APP_STOP_SOURCE_CLI)
|
@@ -193,7 +176,6 @@ async def history(
|
|
193
176
|
app_identifier: str = APP_IDENTIFIER,
|
194
177
|
*,
|
195
178
|
env: Optional[str] = ENV_OPTION,
|
196
|
-
name: str = NAME_OPTION,
|
197
179
|
json: bool = False,
|
198
180
|
):
|
199
181
|
"""Show App deployment history, for a currently deployed app
|
@@ -213,7 +195,6 @@ async def history(
|
|
213
195
|
```
|
214
196
|
|
215
197
|
"""
|
216
|
-
app_identifier = warn_on_name_option("history", app_identifier, name)
|
217
198
|
env = ensure_env(env)
|
218
199
|
client = await _Client.from_env()
|
219
200
|
app_id = await get_app_id.aio(app_identifier, env, client)
|
@@ -15,7 +15,7 @@ from modal import App, Image, Queue, Secret, Volume, forward
|
|
15
15
|
# Passed by `modal launch` locally via CLI, plumbed to remote runner through secrets.
|
16
16
|
args: dict[str, Any] = json.loads(os.environ.get("MODAL_LAUNCH_ARGS", "{}"))
|
17
17
|
|
18
|
-
app = App(
|
18
|
+
app = App()
|
19
19
|
|
20
20
|
image = Image.from_registry(args.get("image"), add_python=args.get("add_python")).pip_install("jupyterlab")
|
21
21
|
|
modal/cli/programs/vscode.py
CHANGED
@@ -22,7 +22,7 @@ CODE_SERVER_ENTRYPOINT = (
|
|
22
22
|
FIXUD_INSTALLER = "https://github.com/boxboat/fixuid/releases/download/v0.6.0/fixuid-0.6.0-linux-$ARCH.tar.gz"
|
23
23
|
|
24
24
|
|
25
|
-
app = App(
|
25
|
+
app = App()
|
26
26
|
image = (
|
27
27
|
Image.from_registry(args.get("image"), add_python="3.11")
|
28
28
|
.apt_install("curl", "dumb-init", "git", "git-lfs")
|
modal/client.pyi
CHANGED
@@ -27,11 +27,7 @@ class _Client:
|
|
27
27
|
_snapshotted: bool
|
28
28
|
|
29
29
|
def __init__(
|
30
|
-
self,
|
31
|
-
server_url: str,
|
32
|
-
client_type: int,
|
33
|
-
credentials: typing.Optional[tuple[str, str]],
|
34
|
-
version: str = "0.77.1.dev0",
|
30
|
+
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "1.0.0"
|
35
31
|
): ...
|
36
32
|
def is_closed(self) -> bool: ...
|
37
33
|
@property
|
@@ -90,11 +86,7 @@ class Client:
|
|
90
86
|
_snapshotted: bool
|
91
87
|
|
92
88
|
def __init__(
|
93
|
-
self,
|
94
|
-
server_url: str,
|
95
|
-
client_type: int,
|
96
|
-
credentials: typing.Optional[tuple[str, str]],
|
97
|
-
version: str = "0.77.1.dev0",
|
89
|
+
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "1.0.0"
|
98
90
|
): ...
|
99
91
|
def is_closed(self) -> bool: ...
|
100
92
|
@property
|