modal 1.0.0.dev8__py3-none-any.whl → 1.0.0.dev11__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/_functions.py +10 -36
- modal/_partial_function.py +1 -1
- modal/_serialization.py +2 -2
- modal/_utils/function_utils.py +3 -6
- modal/app.py +0 -8
- modal/app.pyi +0 -6
- 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 -2
- modal/cls.py +8 -11
- modal/cls.pyi +2 -17
- modal/config.py +5 -16
- modal/dict.py +2 -1
- modal/image.py +4 -15
- modal/image.pyi +0 -1
- modal/network_file_system.py +2 -1
- modal/queue.py +2 -1
- modal/sandbox.py +5 -8
- modal/volume.py +2 -1
- {modal-1.0.0.dev8.dist-info → modal-1.0.0.dev11.dist-info}/METADATA +1 -1
- {modal-1.0.0.dev8.dist-info → modal-1.0.0.dev11.dist-info}/RECORD +30 -30
- modal_proto/api.proto +1 -1
- modal_proto/api_pb2.py +756 -756
- modal_proto/api_pb2.pyi +1 -5
- modal_version/__init__.py +1 -1
- {modal-1.0.0.dev8.dist-info → modal-1.0.0.dev11.dist-info}/WHEEL +0 -0
- {modal-1.0.0.dev8.dist-info → modal-1.0.0.dev11.dist-info}/entry_points.txt +0 -0
- {modal-1.0.0.dev8.dist-info → modal-1.0.0.dev11.dist-info}/licenses/LICENSE +0 -0
- {modal-1.0.0.dev8.dist-info → modal-1.0.0.dev11.dist-info}/top_level.txt +0 -0
modal/_functions.py
CHANGED
@@ -41,7 +41,7 @@ from ._utils.async_utils import (
|
|
41
41
|
synchronizer,
|
42
42
|
warn_if_generator_is_not_consumed,
|
43
43
|
)
|
44
|
-
from ._utils.deprecation import
|
44
|
+
from ._utils.deprecation import deprecation_warning
|
45
45
|
from ._utils.function_utils import (
|
46
46
|
ATTEMPT_TIMEOUT_GRACE_PERIOD,
|
47
47
|
OUTPUTS_TIMEOUT,
|
@@ -71,7 +71,7 @@ from .exception import (
|
|
71
71
|
)
|
72
72
|
from .gpu import GPU_T, parse_gpu_config
|
73
73
|
from .image import _Image
|
74
|
-
from .mount import _get_client_mount, _Mount
|
74
|
+
from .mount import _get_client_mount, _Mount
|
75
75
|
from .network_file_system import _NetworkFileSystem, network_file_system_mount_protos
|
76
76
|
from .output import _get_output_manager
|
77
77
|
from .parallel_map import (
|
@@ -405,12 +405,6 @@ class FunctionStats:
|
|
405
405
|
backlog: int
|
406
406
|
num_total_runners: int
|
407
407
|
|
408
|
-
def __getattr__(self, name):
|
409
|
-
if name == "num_active_runners":
|
410
|
-
msg = "'FunctionStats.num_active_runners' is no longer available."
|
411
|
-
deprecation_error((2024, 6, 14), msg)
|
412
|
-
raise AttributeError(f"'FunctionStats' object has no attribute '{name}'")
|
413
|
-
|
414
408
|
|
415
409
|
def _parse_retries(
|
416
410
|
retries: Optional[Union[int, Retries]],
|
@@ -581,30 +575,6 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
581
575
|
*entrypoint_mounts.values(),
|
582
576
|
]
|
583
577
|
|
584
|
-
if include_source_mode is IncludeSourceMode.INCLUDE_FIRST_PARTY and is_local():
|
585
|
-
auto_mounts = get_sys_modules_mounts()
|
586
|
-
# don't need to add entrypoint modules to automounts:
|
587
|
-
for entrypoint_module in entrypoint_mounts:
|
588
|
-
auto_mounts.pop(entrypoint_module, None)
|
589
|
-
|
590
|
-
warn_missing_modules = set(auto_mounts.keys()) - image._added_python_source_set
|
591
|
-
|
592
|
-
if warn_missing_modules:
|
593
|
-
python_stringified_modules = ", ".join(f'"{mod}"' for mod in sorted(warn_missing_modules))
|
594
|
-
deprecation_warning(
|
595
|
-
(2025, 2, 3),
|
596
|
-
(
|
597
|
-
'Modal will stop implicitly adding local Python modules to the Image ("automounting") in a '
|
598
|
-
"future update. The following modules need to be explicitly added for future "
|
599
|
-
"compatibility:\n"
|
600
|
-
)
|
601
|
-
+ "\n".join(sorted([f"* {m}" for m in warn_missing_modules]))
|
602
|
-
+ "\n\n"
|
603
|
-
+ (f"e.g.:\nimage_with_source = my_image.add_local_python_source({python_stringified_modules})\n\n")
|
604
|
-
+ "For more information, see https://modal.com/docs/guide/modal-1-0-migration",
|
605
|
-
)
|
606
|
-
all_mounts += auto_mounts.values()
|
607
|
-
|
608
578
|
retry_policy = _parse_retries(
|
609
579
|
retries, f"Function '{info.get_tag()}'" if info.raw_f else f"Class '{info.get_tag()}'"
|
610
580
|
)
|
@@ -1190,7 +1160,8 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
1190
1160
|
|
1191
1161
|
@live_method
|
1192
1162
|
async def keep_warm(self, warm_pool_size: int) -> None:
|
1193
|
-
"""
|
1163
|
+
"""mdmd:hidden
|
1164
|
+
Set the warm pool size for the Function.
|
1194
1165
|
|
1195
1166
|
DEPRECATED: Please adapt your code to use the more general `update_autoscaler` method instead:
|
1196
1167
|
|
@@ -1294,7 +1265,8 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
1294
1265
|
client: Optional[_Client] = None,
|
1295
1266
|
environment_name: Optional[str] = None,
|
1296
1267
|
) -> "_Function":
|
1297
|
-
"""
|
1268
|
+
"""mdmd:hidden
|
1269
|
+
Lookup a Function from a deployed App by its name.
|
1298
1270
|
|
1299
1271
|
DEPRECATED: This method is deprecated in favor of `modal.Function.from_name`.
|
1300
1272
|
|
@@ -1418,7 +1390,8 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
1418
1390
|
@property
|
1419
1391
|
@live_method
|
1420
1392
|
async def web_url(self) -> Optional[str]:
|
1421
|
-
"""
|
1393
|
+
"""mdmd:hidden
|
1394
|
+
Deprecated. Use the `Function.get_web_url()` method instead.
|
1422
1395
|
|
1423
1396
|
URL of a Function running as a web endpoint.
|
1424
1397
|
"""
|
@@ -1861,7 +1834,8 @@ class _FunctionCall(typing.Generic[ReturnType], _Object, type_prefix="fc"):
|
|
1861
1834
|
|
1862
1835
|
|
1863
1836
|
async def _gather(*function_calls: _FunctionCall[T]) -> typing.Sequence[T]:
|
1864
|
-
"""
|
1837
|
+
"""mdmd:hidden
|
1838
|
+
Deprecated: Please use `modal.FunctionCall.gather()` instead."""
|
1865
1839
|
deprecation_warning(
|
1866
1840
|
(2025, 2, 24),
|
1867
1841
|
"`modal.functions.gather()` is deprecated; please use `modal.FunctionCall.gather()` instead.",
|
modal/_partial_function.py
CHANGED
@@ -649,7 +649,7 @@ def _web_server(
|
|
649
649
|
def _build(
|
650
650
|
_warn_parentheses_missing=None, *, force: bool = False, timeout: int = 86400
|
651
651
|
) -> Callable[[Union[_PartialFunction, NullaryMethod]], _PartialFunction]:
|
652
|
-
"""
|
652
|
+
"""mdmd:hidden
|
653
653
|
Decorator for methods that execute at _build time_ to create a new Image layer.
|
654
654
|
|
655
655
|
**Deprecated**: This function is deprecated. We recommend using `modal.Volume`
|
modal/_serialization.py
CHANGED
@@ -324,8 +324,8 @@ def _deserialize_asgi(asgi: api_pb2.Asgi) -> Any:
|
|
324
324
|
elif msg_type == "websocket_send":
|
325
325
|
return {
|
326
326
|
"type": "websocket.send",
|
327
|
-
"bytes": asgi.websocket_send.bytes if asgi.websocket_send.HasField("bytes") else
|
328
|
-
"text": asgi.websocket_send.text if asgi.websocket_send.HasField("text") else
|
327
|
+
**({"bytes": asgi.websocket_send.bytes} if asgi.websocket_send.HasField("bytes") else {}),
|
328
|
+
**({"text": asgi.websocket_send.text} if asgi.websocket_send.HasField("text") else {}),
|
329
329
|
}
|
330
330
|
elif msg_type == "websocket_disconnect":
|
331
331
|
return {
|
modal/_utils/function_utils.py
CHANGED
@@ -23,7 +23,7 @@ from .._serialization import (
|
|
23
23
|
signature_to_parameter_specs,
|
24
24
|
)
|
25
25
|
from .._traceback import append_modal_tb
|
26
|
-
from ..config import
|
26
|
+
from ..config import logger
|
27
27
|
from ..exception import (
|
28
28
|
DeserializationError,
|
29
29
|
ExecutionError,
|
@@ -627,8 +627,7 @@ class FunctionCreationStatus:
|
|
627
627
|
|
628
628
|
class IncludeSourceMode(enum.Enum):
|
629
629
|
INCLUDE_NOTHING = False # can only be set in source, can't be set in config
|
630
|
-
INCLUDE_MAIN_PACKAGE = True #
|
631
|
-
INCLUDE_FIRST_PARTY = "legacy" # mounts all "local" modules in sys.modules - represented by AUTOMOUNT=1 in config
|
630
|
+
INCLUDE_MAIN_PACKAGE = True # Default behavior
|
632
631
|
|
633
632
|
|
634
633
|
def get_include_source_mode(function_or_app_specific) -> IncludeSourceMode:
|
@@ -650,6 +649,4 @@ def get_include_source_mode(function_or_app_specific) -> IncludeSourceMode:
|
|
650
649
|
# explicitly set in app/function
|
651
650
|
return IncludeSourceMode(function_or_app_specific)
|
652
651
|
|
653
|
-
|
654
|
-
legacy_automount_mode: bool = config.get("automount")
|
655
|
-
return IncludeSourceMode.INCLUDE_FIRST_PARTY if legacy_automount_mode else IncludeSourceMode.INCLUDE_MAIN_PACKAGE
|
652
|
+
return IncludeSourceMode.INCLUDE_MAIN_PACKAGE
|
modal/app.py
CHANGED
@@ -534,14 +534,6 @@ class _App:
|
|
534
534
|
"""All local CLI entrypoints registered on the app."""
|
535
535
|
return self._local_entrypoints
|
536
536
|
|
537
|
-
@property
|
538
|
-
def indexed_objects(self) -> dict[str, _Object]:
|
539
|
-
deprecation_warning(
|
540
|
-
(2024, 11, 25),
|
541
|
-
"`app.indexed_objects` is deprecated! Use `app.registered_functions` or `app.registered_classes` instead.",
|
542
|
-
)
|
543
|
-
return dict(**self._functions, **self._classes)
|
544
|
-
|
545
537
|
@property
|
546
538
|
def registered_web_endpoints(self) -> list[str]:
|
547
539
|
"""Names of web endpoint (ie. webhook) functions registered on the app."""
|
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
|
@@ -11,7 +10,6 @@ import modal.gpu
|
|
11
10
|
import modal.image
|
12
11
|
import modal.mount
|
13
12
|
import modal.network_file_system
|
14
|
-
import modal.object
|
15
13
|
import modal.partial_function
|
16
14
|
import modal.proxy
|
17
15
|
import modal.retries
|
@@ -157,8 +155,6 @@ class _App:
|
|
157
155
|
@property
|
158
156
|
def registered_entrypoints(self) -> dict[str, _LocalEntrypoint]: ...
|
159
157
|
@property
|
160
|
-
def indexed_objects(self) -> dict[str, modal._object._Object]: ...
|
161
|
-
@property
|
162
158
|
def registered_web_endpoints(self) -> list[str]: ...
|
163
159
|
def local_entrypoint(
|
164
160
|
self, _warn_parentheses_missing: typing.Any = None, *, name: typing.Optional[str] = None
|
@@ -405,8 +401,6 @@ class App:
|
|
405
401
|
@property
|
406
402
|
def registered_entrypoints(self) -> dict[str, LocalEntrypoint]: ...
|
407
403
|
@property
|
408
|
-
def indexed_objects(self) -> dict[str, modal.object.Object]: ...
|
409
|
-
@property
|
410
404
|
def registered_web_endpoints(self) -> list[str]: ...
|
411
405
|
def local_entrypoint(
|
412
406
|
self, _warn_parentheses_missing: typing.Any = None, *, name: typing.Optional[str] = None
|
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
@@ -31,7 +31,7 @@ class _Client:
|
|
31
31
|
server_url: str,
|
32
32
|
client_type: int,
|
33
33
|
credentials: typing.Optional[tuple[str, str]],
|
34
|
-
version: str = "1.0.0.
|
34
|
+
version: str = "1.0.0.dev11",
|
35
35
|
): ...
|
36
36
|
def is_closed(self) -> bool: ...
|
37
37
|
@property
|
@@ -94,7 +94,7 @@ class Client:
|
|
94
94
|
server_url: str,
|
95
95
|
client_type: int,
|
96
96
|
credentials: typing.Optional[tuple[str, str]],
|
97
|
-
version: str = "1.0.0.
|
97
|
+
version: str = "1.0.0.dev11",
|
98
98
|
): ...
|
99
99
|
def is_closed(self) -> bool: ...
|
100
100
|
@property
|
modal/cls.py
CHANGED
@@ -276,7 +276,8 @@ class _Obj:
|
|
276
276
|
)
|
277
277
|
|
278
278
|
async def keep_warm(self, warm_pool_size: int) -> None:
|
279
|
-
"""
|
279
|
+
"""mdmd:hidden
|
280
|
+
Set the warm pool size for the class containers
|
280
281
|
|
281
282
|
DEPRECATED: Please adapt your code to use the more general `update_autoscaler` method instead:
|
282
283
|
|
@@ -593,7 +594,6 @@ More information on class parameterization can be found here: https://modal.com/
|
|
593
594
|
*,
|
594
595
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
595
596
|
environment_name: Optional[str] = None,
|
596
|
-
workspace: Optional[str] = None, # Deprecated and unused
|
597
597
|
) -> "_Cls":
|
598
598
|
"""Reference a Cls from a deployed App by its name.
|
599
599
|
|
@@ -607,18 +607,12 @@ More information on class parameterization can be found here: https://modal.com/
|
|
607
607
|
"""
|
608
608
|
_environment_name = environment_name or config.get("environment")
|
609
609
|
|
610
|
-
if workspace is not None:
|
611
|
-
deprecation_warning(
|
612
|
-
(2025, 1, 27), "The `workspace` argument is no longer used and will be removed in a future release."
|
613
|
-
)
|
614
|
-
|
615
610
|
async def _load_remote(self: _Cls, resolver: Resolver, existing_object_id: Optional[str]):
|
616
611
|
request = api_pb2.ClassGetRequest(
|
617
612
|
app_name=app_name,
|
618
613
|
object_tag=name,
|
619
614
|
namespace=namespace,
|
620
615
|
environment_name=_environment_name,
|
621
|
-
lookup_published=workspace is not None,
|
622
616
|
only_class_function=True,
|
623
617
|
)
|
624
618
|
try:
|
@@ -791,9 +785,9 @@ More information on class parameterization can be found here: https://modal.com/
|
|
791
785
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
792
786
|
client: Optional[_Client] = None,
|
793
787
|
environment_name: Optional[str] = None,
|
794
|
-
workspace: Optional[str] = None, # Deprecated and unused
|
795
788
|
) -> "_Cls":
|
796
|
-
"""
|
789
|
+
"""mdmd:hidden
|
790
|
+
Lookup a Cls from a deployed App by its name.
|
797
791
|
|
798
792
|
DEPRECATED: This method is deprecated in favor of `modal.Cls.from_name`.
|
799
793
|
|
@@ -813,7 +807,10 @@ More information on class parameterization can be found here: https://modal.com/
|
|
813
807
|
"\n\nSee https://modal.com/docs/guide/modal-1-0-migration for more information.",
|
814
808
|
)
|
815
809
|
obj = _Cls.from_name(
|
816
|
-
app_name,
|
810
|
+
app_name,
|
811
|
+
name,
|
812
|
+
namespace=namespace,
|
813
|
+
environment_name=environment_name,
|
817
814
|
)
|
818
815
|
if client is None:
|
819
816
|
client = await _Client.from_env()
|
modal/cls.pyi
CHANGED
@@ -172,13 +172,7 @@ class _Cls(modal._object._Object):
|
|
172
172
|
def from_local(user_cls, app: modal.app._App, class_service_function: modal._functions._Function) -> _Cls: ...
|
173
173
|
@classmethod
|
174
174
|
def from_name(
|
175
|
-
cls: type[_Cls],
|
176
|
-
app_name: str,
|
177
|
-
name: str,
|
178
|
-
*,
|
179
|
-
namespace=1,
|
180
|
-
environment_name: typing.Optional[str] = None,
|
181
|
-
workspace: typing.Optional[str] = None,
|
175
|
+
cls: type[_Cls], app_name: str, name: str, *, namespace=1, environment_name: typing.Optional[str] = None
|
182
176
|
) -> _Cls: ...
|
183
177
|
def with_options(
|
184
178
|
self: _Cls,
|
@@ -206,7 +200,6 @@ class _Cls(modal._object._Object):
|
|
206
200
|
namespace=1,
|
207
201
|
client: typing.Optional[modal.client._Client] = None,
|
208
202
|
environment_name: typing.Optional[str] = None,
|
209
|
-
workspace: typing.Optional[str] = None,
|
210
203
|
) -> _Cls: ...
|
211
204
|
def __call__(self, *args, **kwargs) -> _Obj: ...
|
212
205
|
def __getattr__(self, k): ...
|
@@ -238,13 +231,7 @@ class Cls(modal.object.Object):
|
|
238
231
|
def from_local(user_cls, app: modal.app.App, class_service_function: modal.functions.Function) -> Cls: ...
|
239
232
|
@classmethod
|
240
233
|
def from_name(
|
241
|
-
cls: type[Cls],
|
242
|
-
app_name: str,
|
243
|
-
name: str,
|
244
|
-
*,
|
245
|
-
namespace=1,
|
246
|
-
environment_name: typing.Optional[str] = None,
|
247
|
-
workspace: typing.Optional[str] = None,
|
234
|
+
cls: type[Cls], app_name: str, name: str, *, namespace=1, environment_name: typing.Optional[str] = None
|
248
235
|
) -> Cls: ...
|
249
236
|
def with_options(
|
250
237
|
self: Cls,
|
@@ -275,7 +262,6 @@ class Cls(modal.object.Object):
|
|
275
262
|
namespace=1,
|
276
263
|
client: typing.Optional[modal.client.Client] = None,
|
277
264
|
environment_name: typing.Optional[str] = None,
|
278
|
-
workspace: typing.Optional[str] = None,
|
279
265
|
) -> Cls: ...
|
280
266
|
async def aio(
|
281
267
|
self,
|
@@ -285,7 +271,6 @@ class Cls(modal.object.Object):
|
|
285
271
|
namespace=1,
|
286
272
|
client: typing.Optional[modal.client.Client] = None,
|
287
273
|
environment_name: typing.Optional[str] = None,
|
288
|
-
workspace: typing.Optional[str] = None,
|
289
274
|
) -> Cls: ...
|
290
275
|
|
291
276
|
lookup: __lookup_spec
|
modal/config.py
CHANGED
@@ -51,10 +51,6 @@ Other possible configuration options are:
|
|
51
51
|
Defaults to 10.
|
52
52
|
Number of seconds to wait for logs to drain when closing the session,
|
53
53
|
before giving up.
|
54
|
-
* `automount` (in the .toml file) / `MODAL_AUTOMOUNT` (as an env var).
|
55
|
-
Defaults to True.
|
56
|
-
By default, Modal automatically mounts modules imported in the current scope, that
|
57
|
-
are deemed to be "local". This can be turned off by setting this to False.
|
58
54
|
* `force_build` (in the .toml file) / `MODAL_FORCE_BUILD` (as an env var).
|
59
55
|
Defaults to False.
|
60
56
|
When set, ignores the Image cache and builds all Image layers. Note that this
|
@@ -91,14 +87,12 @@ import logging
|
|
91
87
|
import os
|
92
88
|
import typing
|
93
89
|
import warnings
|
94
|
-
from textwrap import dedent
|
95
90
|
from typing import Any, Callable, Optional
|
96
91
|
|
97
92
|
from google.protobuf.empty_pb2 import Empty
|
98
93
|
|
99
94
|
from modal_proto import api_pb2
|
100
95
|
|
101
|
-
from ._utils.deprecation import deprecation_error
|
102
96
|
from ._utils.logger import configure_logger
|
103
97
|
from .exception import InvalidError
|
104
98
|
|
@@ -186,16 +180,12 @@ def _check_config() -> None:
|
|
186
180
|
f"({user_config_path})."
|
187
181
|
)
|
188
182
|
elif num_profiles > 1 and num_active == 0 and _profile == "default":
|
189
|
-
#
|
190
|
-
|
191
|
-
|
192
|
-
""
|
193
|
-
|
194
|
-
Please use `modal profile activate` to activate one of your profiles.
|
195
|
-
(Use `modal profile list` to see the options.)
|
196
|
-
"""
|
183
|
+
# TODO: We should get rid of the `_profile = "default"` concept entirely now
|
184
|
+
raise InvalidError(
|
185
|
+
"No Modal profile is active.\n\n"
|
186
|
+
"Please fix by running `modal profile activate` or by editing your Modal config file "
|
187
|
+
f"({user_config_path})."
|
197
188
|
)
|
198
|
-
deprecation_error((2024, 2, 6), message)
|
199
189
|
|
200
190
|
|
201
191
|
_profile = os.environ.get("MODAL_PROFILE") or _config_active_profile()
|
@@ -233,7 +223,6 @@ _SETTINGS = {
|
|
233
223
|
"sync_entrypoint": _Setting(),
|
234
224
|
"logs_timeout": _Setting(10, float),
|
235
225
|
"image_id": _Setting(),
|
236
|
-
"automount": _Setting(True, transform=_to_boolean),
|
237
226
|
"heartbeat_interval": _Setting(15, float),
|
238
227
|
"function_runtime": _Setting(),
|
239
228
|
"function_runtime_debug": _Setting(False, transform=_to_boolean), # For internal debugging use.
|
modal/dict.py
CHANGED
@@ -166,7 +166,8 @@ class _Dict(_Object, type_prefix="di"):
|
|
166
166
|
environment_name: Optional[str] = None,
|
167
167
|
create_if_missing: bool = False,
|
168
168
|
) -> "_Dict":
|
169
|
-
"""
|
169
|
+
"""mdmd:hidden
|
170
|
+
Lookup a named Dict.
|
170
171
|
|
171
172
|
DEPRECATED: This method is deprecated in favor of `modal.Dict.from_name`.
|
172
173
|
|
modal/image.py
CHANGED
@@ -193,18 +193,6 @@ def _validate_packages(packages: list[str]) -> bool:
|
|
193
193
|
return not any(pkg.startswith("-") for pkg in packages)
|
194
194
|
|
195
195
|
|
196
|
-
def _warn_invalid_packages(old_command: str) -> None:
|
197
|
-
deprecation_warning(
|
198
|
-
(2024, 7, 3),
|
199
|
-
"Passing flags to `pip` via the `packages` argument of `pip_install` is deprecated."
|
200
|
-
" Please pass flags via the `extra_options` argument instead."
|
201
|
-
"\nNote that this will cause a rebuild of this image layer."
|
202
|
-
" To avoid rebuilding, you can pass the following to `run_commands` instead:"
|
203
|
-
f'\n`image.run_commands("{old_command}")`',
|
204
|
-
show_source=False,
|
205
|
-
)
|
206
|
-
|
207
|
-
|
208
196
|
def _make_pip_install_args(
|
209
197
|
find_links: Optional[str] = None, # Passes -f (--find-links) pip install
|
210
198
|
index_url: Optional[str] = None, # Passes -i (--index-url) to pip install
|
@@ -685,7 +673,7 @@ class _Image(_Object, type_prefix="im"):
|
|
685
673
|
return obj
|
686
674
|
|
687
675
|
def copy_mount(self, mount: _Mount, remote_path: Union[str, Path] = ".") -> "_Image":
|
688
|
-
"""
|
676
|
+
"""mdmd:hidden
|
689
677
|
**Deprecated**: Use image.add_local_dir(..., copy=True) or similar instead.
|
690
678
|
|
691
679
|
Copy the entire contents of a `modal.Mount` into an image.
|
@@ -815,7 +803,8 @@ class _Image(_Object, type_prefix="im"):
|
|
815
803
|
return self._add_mount_layer_or_copy(mount, copy=copy)
|
816
804
|
|
817
805
|
def copy_local_file(self, local_path: Union[str, Path], remote_path: Union[str, Path] = "./") -> "_Image":
|
818
|
-
"""
|
806
|
+
"""mdmd:hidden
|
807
|
+
Copy a file into the image as a part of building it.
|
819
808
|
|
820
809
|
This works in a similar way to [`COPY`](https://docs.docker.com/engine/reference/builder/#copy)
|
821
810
|
works in a `Dockerfile`.
|
@@ -888,7 +877,7 @@ class _Image(_Object, type_prefix="im"):
|
|
888
877
|
# Which follows dockerignore syntax.
|
889
878
|
ignore: Union[Sequence[str], Callable[[Path], bool]] = [],
|
890
879
|
) -> "_Image":
|
891
|
-
"""
|
880
|
+
"""mdmd:hidden
|
892
881
|
**Deprecated**: Use image.add_local_dir instead
|
893
882
|
|
894
883
|
Copy a directory into the image as a part of building the image.
|
modal/image.pyi
CHANGED
@@ -45,7 +45,6 @@ def _flatten_str_args(
|
|
45
45
|
function_name: str, arg_name: str, args: collections.abc.Sequence[typing.Union[str, list[str]]]
|
46
46
|
) -> list[str]: ...
|
47
47
|
def _validate_packages(packages: list[str]) -> bool: ...
|
48
|
-
def _warn_invalid_packages(old_command: str) -> None: ...
|
49
48
|
def _make_pip_install_args(
|
50
49
|
find_links: typing.Optional[str] = None,
|
51
50
|
index_url: typing.Optional[str] = None,
|
modal/network_file_system.py
CHANGED
@@ -172,7 +172,8 @@ class _NetworkFileSystem(_Object, type_prefix="sv"):
|
|
172
172
|
environment_name: Optional[str] = None,
|
173
173
|
create_if_missing: bool = False,
|
174
174
|
) -> "_NetworkFileSystem":
|
175
|
-
"""
|
175
|
+
"""mdmd:hidden
|
176
|
+
Lookup a named NetworkFileSystem.
|
176
177
|
|
177
178
|
DEPRECATED: This method is deprecated in favor of `modal.NetworkFileSystem.from_name`.
|
178
179
|
|
modal/queue.py
CHANGED
@@ -185,7 +185,8 @@ class _Queue(_Object, type_prefix="qu"):
|
|
185
185
|
environment_name: Optional[str] = None,
|
186
186
|
create_if_missing: bool = False,
|
187
187
|
) -> "_Queue":
|
188
|
-
"""
|
188
|
+
"""mdmd:hidden
|
189
|
+
Lookup a named Queue.
|
189
190
|
|
190
191
|
DEPRECATED: This method is deprecated in favor of `modal.Queue.from_name`.
|
191
192
|
|
modal/sandbox.py
CHANGED
@@ -19,7 +19,6 @@ from ._object import _get_environment_name, _Object
|
|
19
19
|
from ._resolver import Resolver
|
20
20
|
from ._resources import convert_fn_config_to_resources_config
|
21
21
|
from ._utils.async_utils import TaskContext, synchronize_api
|
22
|
-
from ._utils.deprecation import deprecation_error
|
23
22
|
from ._utils.grpc_utils import retry_transient_errors
|
24
23
|
from ._utils.mount_utils import validate_network_file_systems, validate_volumes
|
25
24
|
from .client import _Client
|
@@ -315,14 +314,12 @@ class _Sandbox(_Object, type_prefix="sb"):
|
|
315
314
|
app_id = container_app.app_id
|
316
315
|
app_client = container_app._client
|
317
316
|
else:
|
318
|
-
|
319
|
-
|
320
|
-
(
|
321
|
-
"Creating a `Sandbox` without an `App` is deprecated.\n\n"
|
322
|
-
"You may pass in an `App` object, or reference one by name with `App.lookup`:\n\n"
|
317
|
+
raise InvalidError(
|
318
|
+
"Sandboxes require an App when created outside of a Modal container.\n\n"
|
319
|
+
"Run an ephemeral App (`with app.run(): ...`), or reference a deployed App using `App.lookup`:\n\n"
|
323
320
|
"```\n"
|
324
|
-
|
325
|
-
|
321
|
+
'app = modal.App.lookup("sandbox-app", create_if_missing=True)\n'
|
322
|
+
"sb = modal.Sandbox.create(..., app=app)\n"
|
326
323
|
"```",
|
327
324
|
)
|
328
325
|
|
modal/volume.py
CHANGED
@@ -251,7 +251,8 @@ class _Volume(_Object, type_prefix="vo"):
|
|
251
251
|
create_if_missing: bool = False,
|
252
252
|
version: "typing.Optional[modal_proto.api_pb2.VolumeFsVersion.ValueType]" = None,
|
253
253
|
) -> "_Volume":
|
254
|
-
"""
|
254
|
+
"""mdmd:hidden
|
255
|
+
Lookup a named Volume.
|
255
256
|
|
256
257
|
DEPRECATED: This method is deprecated in favor of `modal.Volume.from_name`.
|
257
258
|
|