modal 0.73.0__py3-none-any.whl → 0.73.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- modal/cli/import_refs.py +33 -11
- modal/client.pyi +2 -2
- modal/functions.pyi +6 -6
- {modal-0.73.0.dist-info → modal-0.73.1.dist-info}/METADATA +1 -1
- {modal-0.73.0.dist-info → modal-0.73.1.dist-info}/RECORD +10 -10
- modal_version/_version_generated.py +1 -1
- {modal-0.73.0.dist-info → modal-0.73.1.dist-info}/LICENSE +0 -0
- {modal-0.73.0.dist-info → modal-0.73.1.dist-info}/WHEEL +0 -0
- {modal-0.73.0.dist-info → modal-0.73.1.dist-info}/entry_points.txt +0 -0
- {modal-0.73.0.dist-info → modal-0.73.1.dist-info}/top_level.txt +0 -0
modal/cli/import_refs.py
CHANGED
@@ -109,6 +109,14 @@ class CLICommand:
|
|
109
109
|
names: list[str]
|
110
110
|
runnable: Runnable
|
111
111
|
is_web_endpoint: bool
|
112
|
+
priority: int
|
113
|
+
|
114
|
+
|
115
|
+
class AutoRunPriority:
|
116
|
+
MODULE_LOCAL_ENTRYPOINT = 0
|
117
|
+
MODULE_FUNCTION = 1
|
118
|
+
APP_LOCAL_ENTRYPOINT = 2
|
119
|
+
APP_FUNCTION = 3
|
112
120
|
|
113
121
|
|
114
122
|
def list_cli_commands(
|
@@ -127,17 +135,21 @@ def list_cli_commands(
|
|
127
135
|
apps = cast(list[tuple[str, App]], inspect.getmembers(module, lambda x: isinstance(x, App)))
|
128
136
|
|
129
137
|
all_runnables: dict[Runnable, list[str]] = defaultdict(list)
|
138
|
+
priorities: dict[Runnable, int] = defaultdict(lambda: AutoRunPriority.APP_FUNCTION)
|
130
139
|
for app_name, app in apps:
|
131
140
|
for name, local_entrypoint in app.registered_entrypoints.items():
|
132
141
|
all_runnables[local_entrypoint].append(f"{app_name}.{name}")
|
142
|
+
priorities[local_entrypoint] = AutoRunPriority.APP_LOCAL_ENTRYPOINT
|
133
143
|
for name, function in app.registered_functions.items():
|
134
144
|
if name.endswith(".*"):
|
135
145
|
continue
|
136
146
|
all_runnables[function].append(f"{app_name}.{name}")
|
147
|
+
priorities[function] = AutoRunPriority.APP_FUNCTION
|
137
148
|
for cls_name, cls in app.registered_classes.items():
|
138
149
|
for method_name in cls._get_method_names():
|
139
150
|
method_ref = MethodReference(cls, method_name)
|
140
151
|
all_runnables[method_ref].append(f"{app_name}.{cls_name}.{method_name}")
|
152
|
+
priorities[method_ref] = AutoRunPriority.APP_FUNCTION
|
141
153
|
|
142
154
|
# If any class or function is exported as a module level object, use that
|
143
155
|
# as the preferred name by putting it first in the list
|
@@ -150,8 +162,13 @@ def list_cli_commands(
|
|
150
162
|
for method_name in entity._get_method_names():
|
151
163
|
method_ref = MethodReference(entity, method_name)
|
152
164
|
all_runnables.setdefault(method_ref, []).insert(0, f"{name}.{method_name}")
|
153
|
-
|
165
|
+
priorities[method_ref] = AutoRunPriority.MODULE_FUNCTION
|
166
|
+
elif isinstance(entity, Function) and entity._is_local():
|
154
167
|
all_runnables.setdefault(entity, []).insert(0, name)
|
168
|
+
priorities[entity] = AutoRunPriority.MODULE_FUNCTION
|
169
|
+
elif isinstance(entity, LocalEntrypoint):
|
170
|
+
all_runnables.setdefault(entity, []).insert(0, name)
|
171
|
+
priorities[entity] = AutoRunPriority.MODULE_LOCAL_ENTRYPOINT
|
155
172
|
|
156
173
|
def _is_web_endpoint(runnable: Runnable) -> bool:
|
157
174
|
if isinstance(runnable, Function) and runnable._is_web_endpoint():
|
@@ -164,7 +181,10 @@ def list_cli_commands(
|
|
164
181
|
|
165
182
|
return False
|
166
183
|
|
167
|
-
return [
|
184
|
+
return [
|
185
|
+
CLICommand(names, runnable, _is_web_endpoint(runnable), priority=priorities[runnable])
|
186
|
+
for runnable, names in all_runnables.items()
|
187
|
+
]
|
168
188
|
|
169
189
|
|
170
190
|
def filter_cli_commands(
|
@@ -308,17 +328,19 @@ def import_and_filter(
|
|
308
328
|
filtered_commands = filter_cli_commands(
|
309
329
|
cli_commands, import_ref.object_path, accept_local_entrypoint, accept_webhook
|
310
330
|
)
|
331
|
+
|
311
332
|
all_usable_commands = filter_cli_commands(cli_commands, "", accept_local_entrypoint, accept_webhook)
|
312
333
|
|
313
|
-
if
|
314
|
-
|
315
|
-
|
334
|
+
if filtered_commands:
|
335
|
+
# if there is a single command with "highest run prio" - use that
|
336
|
+
filtered_commands_by_prio = defaultdict(list)
|
337
|
+
for cmd in filtered_commands:
|
338
|
+
filtered_commands_by_prio[cmd.priority].append(cmd)
|
316
339
|
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
# if there is a single local entrypoint - use that
|
322
|
-
return local_entrypoint_cmds[0].runnable, all_usable_commands
|
340
|
+
_, highest_prio_commands = min(filtered_commands_by_prio.items())
|
341
|
+
if len(highest_prio_commands) == 1:
|
342
|
+
cli_command = highest_prio_commands[0]
|
343
|
+
return cli_command.runnable, all_usable_commands
|
323
344
|
|
345
|
+
# otherwise, just return the list of all commands
|
324
346
|
return None, all_usable_commands
|
modal/client.pyi
CHANGED
@@ -27,7 +27,7 @@ class _Client:
|
|
27
27
|
_snapshotted: bool
|
28
28
|
|
29
29
|
def __init__(
|
30
|
-
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.73.
|
30
|
+
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.73.1"
|
31
31
|
): ...
|
32
32
|
def is_closed(self) -> bool: ...
|
33
33
|
@property
|
@@ -85,7 +85,7 @@ class Client:
|
|
85
85
|
_snapshotted: bool
|
86
86
|
|
87
87
|
def __init__(
|
88
|
-
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.73.
|
88
|
+
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.73.1"
|
89
89
|
): ...
|
90
90
|
def is_closed(self) -> bool: ...
|
91
91
|
@property
|
modal/functions.pyi
CHANGED
@@ -471,11 +471,11 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
|
|
471
471
|
|
472
472
|
_call_generator_nowait: ___call_generator_nowait_spec[typing_extensions.Self]
|
473
473
|
|
474
|
-
class __remote_spec(typing_extensions.Protocol[
|
474
|
+
class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
|
475
475
|
def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
|
476
476
|
async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
|
477
477
|
|
478
|
-
remote: __remote_spec[
|
478
|
+
remote: __remote_spec[ReturnType, P, typing_extensions.Self]
|
479
479
|
|
480
480
|
class __remote_gen_spec(typing_extensions.Protocol[SUPERSELF]):
|
481
481
|
def __call__(self, *args, **kwargs) -> typing.Generator[typing.Any, None, None]: ...
|
@@ -488,17 +488,17 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
|
|
488
488
|
def _get_obj(self) -> typing.Optional[modal.cls.Obj]: ...
|
489
489
|
def local(self, *args: P.args, **kwargs: P.kwargs) -> OriginalReturnType: ...
|
490
490
|
|
491
|
-
class ___experimental_spawn_spec(typing_extensions.Protocol[
|
491
|
+
class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
|
492
492
|
def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
|
493
493
|
async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
|
494
494
|
|
495
|
-
_experimental_spawn: ___experimental_spawn_spec[
|
495
|
+
_experimental_spawn: ___experimental_spawn_spec[ReturnType, P, typing_extensions.Self]
|
496
496
|
|
497
|
-
class __spawn_spec(typing_extensions.Protocol[
|
497
|
+
class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
|
498
498
|
def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
|
499
499
|
async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
|
500
500
|
|
501
|
-
spawn: __spawn_spec[
|
501
|
+
spawn: __spawn_spec[ReturnType, P, typing_extensions.Self]
|
502
502
|
|
503
503
|
def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]: ...
|
504
504
|
|
@@ -20,7 +20,7 @@ modal/app.py,sha256=BEl90AuVlcrVlXKhM0wDFn1E8hewvbia9Qdq6SiT-FE,44225
|
|
20
20
|
modal/app.pyi,sha256=NnUpnKq5y5fM45F5cXLMZK5zVJZA9T_UKawloOXCVXE,25858
|
21
21
|
modal/call_graph.py,sha256=1g2DGcMIJvRy-xKicuf63IVE98gJSnQsr8R_NVMptNc,2581
|
22
22
|
modal/client.py,sha256=8SQawr7P1PNUCq1UmJMUQXG2jIo4Nmdcs311XqrNLRE,15276
|
23
|
-
modal/client.pyi,sha256=
|
23
|
+
modal/client.pyi,sha256=B6N3IX6_KfMiukhFzQtUJVgjMMD7wuiUHTQWphpAKaQ,7591
|
24
24
|
modal/cloud_bucket_mount.py,sha256=YOe9nnvSr4ZbeCn587d7_VhE9IioZYRvF9VYQTQux08,5914
|
25
25
|
modal/cloud_bucket_mount.pyi,sha256=30T3K1a89l6wzmEJ_J9iWv9SknoGqaZDx59Xs-ZQcmk,1607
|
26
26
|
modal/cls.py,sha256=7k3_FwhPUzewRXRZP8bcVJA9AZstoxGJuHKQ5Db-YoY,32683
|
@@ -39,7 +39,7 @@ modal/file_io.py,sha256=lcMs_E9Xfm0YX1t9U2wNIBPnqHRxmImqjLW1GHqVmyg,20945
|
|
39
39
|
modal/file_io.pyi,sha256=NTRft1tbPSWf9TlWVeZmTlgB5AZ_Zhu2srWIrWr7brk,9445
|
40
40
|
modal/file_pattern_matcher.py,sha256=1cZ4V2wSLiaXqAqStETSwp3bzDD6QZOt6pmmjk3Okz4,6505
|
41
41
|
modal/functions.py,sha256=bD4NbWgAfo5jsiqlT5XT0nGTaQ_6zOfyNmwYu0I-aVY,69951
|
42
|
-
modal/functions.pyi,sha256=
|
42
|
+
modal/functions.pyi,sha256=eHwUCC7wt_DkCWDnNKuL8LBc4JIRm-rzCOtdmdUgGKY,26641
|
43
43
|
modal/gpu.py,sha256=2qZMNnoMrjU-5Bu7fx68pANUAKTtZq0EWEEeBA9OUVQ,7426
|
44
44
|
modal/image.py,sha256=c6-RsdVDCscmfOoZI26gj8GvBBw1oVC18n8WaYKBWAw,90949
|
45
45
|
modal/image.pyi,sha256=QMKS6E3CsZr5DoyNqGpcJPBYJTJZSvtAQIsAhPVd_E4,26347
|
@@ -118,7 +118,7 @@ modal/cli/container.py,sha256=FYwEgjf93j4NMorAjGbSV98i1wpebqdAeNU1wfrFp1k,3668
|
|
118
118
|
modal/cli/dict.py,sha256=8Wq3w-UDaywk8EVNdj-ECCNV9TYHqh4kzhUqhhulatM,4593
|
119
119
|
modal/cli/entry_point.py,sha256=aaNxFAqZcmtSjwzkYIA_Ba9CkL4cL4_i2gy5VjoXxkM,4228
|
120
120
|
modal/cli/environment.py,sha256=Ayddkiq9jdj3XYDJ8ZmUqFpPPH8xajYlbexRkzGtUcg,4334
|
121
|
-
modal/cli/import_refs.py,sha256=
|
121
|
+
modal/cli/import_refs.py,sha256=YYseLJ6cU_wln7DjVWfKPgEhv77hxfA0klWAkTK_1HA,12672
|
122
122
|
modal/cli/launch.py,sha256=pzQt2QlcrbIUU0MVzWWPAvMQ6MCyqsHZ0X9JcV-sY04,3242
|
123
123
|
modal/cli/network_file_system.py,sha256=eq3JnwjbfFNsJodIyANHL06ByYc3BSavzdmu8C96cHA,7948
|
124
124
|
modal/cli/profile.py,sha256=rLXfjJObfPNjaZvNfHGIKqs7y9bGYyGe-K7V0w-Ni0M,3110
|
@@ -169,10 +169,10 @@ modal_proto/options_pb2_grpc.pyi,sha256=CImmhxHsYnF09iENPoe8S4J-n93jtgUYD2JPAc0y
|
|
169
169
|
modal_proto/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
170
170
|
modal_version/__init__.py,sha256=wiJQ53c-OMs0Xf1UeXOxQ7FwlV1VzIjnX6o-pRYZ_Pk,470
|
171
171
|
modal_version/__main__.py,sha256=2FO0yYQQwDTh6udt1h-cBnGd1c4ZyHnHSI4BksxzVac,105
|
172
|
-
modal_version/_version_generated.py,sha256=
|
173
|
-
modal-0.73.
|
174
|
-
modal-0.73.
|
175
|
-
modal-0.73.
|
176
|
-
modal-0.73.
|
177
|
-
modal-0.73.
|
178
|
-
modal-0.73.
|
172
|
+
modal_version/_version_generated.py,sha256=b5X16t-GbrJxsrM_vcD_WXLcjcejIbm7gcrXoJd5e64,148
|
173
|
+
modal-0.73.1.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
|
174
|
+
modal-0.73.1.dist-info/METADATA,sha256=qsi27dGq0I0z2jCMDbs8cfkdh_kjKztW9uR00_IPuj8,2328
|
175
|
+
modal-0.73.1.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
176
|
+
modal-0.73.1.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
|
177
|
+
modal-0.73.1.dist-info/top_level.txt,sha256=1nvYbOSIKcmU50fNrpnQnrrOpj269ei3LzgB6j9xGqg,64
|
178
|
+
modal-0.73.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|