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 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
- elif (isinstance(entity, Function) and entity._is_local()) or isinstance(entity, LocalEntrypoint):
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 [CLICommand(names, runnable, _is_web_endpoint(runnable)) for runnable, names in all_runnables.items()]
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 len(filtered_commands) == 1:
314
- cli_command = filtered_commands[0]
315
- return cli_command.runnable, all_usable_commands
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
- # we are here if there is more than one matching function
318
- if accept_local_entrypoint:
319
- local_entrypoint_cmds = [cmd for cmd in filtered_commands if isinstance(cmd.runnable, LocalEntrypoint)]
320
- if len(local_entrypoint_cmds) == 1:
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.0"
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.0"
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[P_INNER, ReturnType_INNER, SUPERSELF]):
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[P, ReturnType, typing_extensions.Self]
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[P_INNER, ReturnType_INNER, SUPERSELF]):
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[P, ReturnType, typing_extensions.Self]
495
+ _experimental_spawn: ___experimental_spawn_spec[ReturnType, P, typing_extensions.Self]
496
496
 
497
- class __spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
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[P, ReturnType, typing_extensions.Self]
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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: modal
3
- Version: 0.73.0
3
+ Version: 0.73.1
4
4
  Summary: Python client library for Modal
5
5
  Author: Modal Labs
6
6
  Author-email: support@modal.com
@@ -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=zrgKN8G3exCslhD6GQkTjD8tddibnNtFRMx6ZiHnyhU,7591
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=j6FWZzwFVSaxyOy4zcmCwz2wlAhWeuzqsjndNKt7VlA,26641
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=T10EjBn-7gP-Nv5jTZyd3fEAV7zCaaLtW8eJ4Zt80Mk,11865
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=Yxiko82vGjUn9KsvIwjuM1GwRICvG_28r-6MWuHV0-Q,148
173
- modal-0.73.0.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
174
- modal-0.73.0.dist-info/METADATA,sha256=TmKeZvOba2fFzlrg4VGPHQ7nr4tLVPOB_SSmTLxWjsE,2328
175
- modal-0.73.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
176
- modal-0.73.0.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
177
- modal-0.73.0.dist-info/top_level.txt,sha256=1nvYbOSIKcmU50fNrpnQnrrOpj269ei3LzgB6j9xGqg,64
178
- modal-0.73.0.dist-info/RECORD,,
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,,
@@ -1,4 +1,4 @@
1
1
  # Copyright Modal Labs 2025
2
2
 
3
3
  # Note: Reset this value to -1 whenever you make a minor `0.X` release of the client.
4
- build_number = 0 # git: 7858ac1
4
+ build_number = 1 # git: 539ddf8
File without changes