modal 1.2.1.dev17__py3-none-any.whl → 1.2.1.dev18__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.

@@ -93,6 +93,26 @@ NullaryFuncOrMethod = Union[Callable[[], Any], Callable[[Any], Any]]
93
93
  NullaryMethod = Callable[[Any], Any]
94
94
 
95
95
 
96
+ def verify_concurrent_params(params: _PartialFunctionParams, is_flash: bool = False) -> None:
97
+ def _verify_concurrent_params_with_flash_settings(params: _PartialFunctionParams) -> None:
98
+ if params.max_concurrent_inputs is not None:
99
+ raise TypeError(
100
+ "@modal.concurrent(max_inputs=...) is not yet supported for Flash functions. "
101
+ "Use `@modal.concurrent(target_inputs=...)` instead."
102
+ )
103
+ if params.target_concurrent_inputs is None:
104
+ raise TypeError("`@modal.concurrent()` missing required argument: `target_inputs`.")
105
+
106
+ def _verify_concurrent_params(params: _PartialFunctionParams) -> None:
107
+ if params.max_concurrent_inputs is None:
108
+ raise TypeError("`@modal.concurrent()` missing required argument: `max_inputs`.")
109
+
110
+ if is_flash:
111
+ _verify_concurrent_params_with_flash_settings(params)
112
+ else:
113
+ _verify_concurrent_params(params)
114
+
115
+
96
116
  class _PartialFunction(typing.Generic[P, ReturnType, OriginalReturnType]):
97
117
  """Object produced by a decorator in the `modal` namespace
98
118
 
@@ -765,7 +785,7 @@ def _batched(
765
785
  def _concurrent(
766
786
  _warn_parentheses_missing=None, # mdmd:line-hidden
767
787
  *,
768
- max_inputs: int, # Hard limit on each container's input concurrency
788
+ max_inputs: Optional[int] = None, # Hard limit on each container's input concurrency
769
789
  target_inputs: Optional[int] = None, # Input concurrency that Modal's autoscaler should target
770
790
  ) -> Callable[
771
791
  [Union[Callable[P, ReturnType], _PartialFunction[P, ReturnType, ReturnType]]],
@@ -817,7 +837,7 @@ def _concurrent(
817
837
  "Positional arguments are not allowed. Did you forget parentheses? Suggestion: `@modal.concurrent()`."
818
838
  )
819
839
 
820
- if target_inputs and target_inputs > max_inputs:
840
+ if max_inputs is not None and target_inputs is not None and target_inputs > max_inputs:
821
841
  raise InvalidError("`target_inputs` parameter cannot be greater than `max_inputs`.")
822
842
 
823
843
  flags = _PartialFunctionFlags.CONCURRENT
@@ -75,6 +75,10 @@ def is_global_object(object_qual_name: str):
75
75
  return "<locals>" not in object_qual_name.split(".")
76
76
 
77
77
 
78
+ def is_flash_object(experimental_options: Optional[dict[str, Any]]) -> bool:
79
+ return experimental_options.get("flash", False) if experimental_options else False
80
+
81
+
78
82
  def is_method_fn(object_qual_name: str):
79
83
  # methods have names like Cls.foo.
80
84
  if "<locals>" in object_qual_name:
modal/app.py CHANGED
@@ -27,13 +27,14 @@ from ._partial_function import (
27
27
  _find_partial_methods_for_user_cls,
28
28
  _PartialFunction,
29
29
  _PartialFunctionFlags,
30
+ verify_concurrent_params,
30
31
  )
31
32
  from ._utils.async_utils import synchronize_api
32
33
  from ._utils.deprecation import (
33
34
  deprecation_warning,
34
35
  warn_on_renamed_autoscaler_settings,
35
36
  )
36
- from ._utils.function_utils import FunctionInfo, is_global_object, is_method_fn
37
+ from ._utils.function_utils import FunctionInfo, is_flash_object, is_global_object, is_method_fn
37
38
  from ._utils.grpc_utils import retry_transient_errors
38
39
  from ._utils.mount_utils import validate_volumes
39
40
  from ._utils.name_utils import check_object_name, check_tag_dict
@@ -802,6 +803,7 @@ class _App:
802
803
  batch_max_size = f.params.batch_max_size
803
804
  batch_wait_ms = f.params.batch_wait_ms
804
805
  if f.flags & _PartialFunctionFlags.CONCURRENT:
806
+ verify_concurrent_params(params=f.params, is_flash=is_flash_object(experimental_options))
805
807
  max_concurrent_inputs = f.params.max_concurrent_inputs
806
808
  target_concurrent_inputs = f.params.target_concurrent_inputs
807
809
  else:
@@ -996,6 +998,7 @@ class _App:
996
998
  wrapped_cls.registered = True
997
999
  user_cls = wrapped_cls.user_cls
998
1000
  if wrapped_cls.flags & _PartialFunctionFlags.CONCURRENT:
1001
+ verify_concurrent_params(params=wrapped_cls.params, is_flash=is_flash_object(experimental_options))
999
1002
  max_concurrent_inputs = wrapped_cls.params.max_concurrent_inputs
1000
1003
  target_concurrent_inputs = wrapped_cls.params.target_concurrent_inputs
1001
1004
  else:
modal/client.pyi CHANGED
@@ -33,7 +33,7 @@ class _Client:
33
33
  server_url: str,
34
34
  client_type: int,
35
35
  credentials: typing.Optional[tuple[str, str]],
36
- version: str = "1.2.1.dev17",
36
+ version: str = "1.2.1.dev18",
37
37
  ):
38
38
  """mdmd:hidden
39
39
  The Modal client object is not intended to be instantiated directly by users.
@@ -164,7 +164,7 @@ class Client:
164
164
  server_url: str,
165
165
  client_type: int,
166
166
  credentials: typing.Optional[tuple[str, str]],
167
- version: str = "1.2.1.dev17",
167
+ version: str = "1.2.1.dev18",
168
168
  ):
169
169
  """mdmd:hidden
170
170
  The Modal client object is not intended to be instantiated directly by users.
@@ -329,7 +329,10 @@ def batched(
329
329
  ...
330
330
 
331
331
  def concurrent(
332
- _warn_parentheses_missing=None, *, max_inputs: int, target_inputs: typing.Optional[int] = None
332
+ _warn_parentheses_missing=None,
333
+ *,
334
+ max_inputs: typing.Optional[int] = None,
335
+ target_inputs: typing.Optional[int] = None,
333
336
  ) -> collections.abc.Callable[
334
337
  [
335
338
  typing.Union[
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 1.2.1.dev17
3
+ Version: 1.2.1.dev18
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License: Apache-2.0
@@ -9,7 +9,7 @@ modal/_ipython.py,sha256=TW1fkVOmZL3YYqdS2YlM1hqpf654Yf8ZyybHdBnlhSw,301
9
9
  modal/_location.py,sha256=joiX-0ZeutEUDTrrqLF1GHXCdVLF-rHzstocbMcd_-k,366
10
10
  modal/_object.py,sha256=gwsLdXb-Ecd8nH8LVCo8oVZPzzdyo9BrN1DjgQmsSuM,11967
11
11
  modal/_output.py,sha256=sdQqEuWVknHwLPzuz_7eUYqF9TvmQkSfEjm1E__bzbY,26892
12
- modal/_partial_function.py,sha256=mjCt3OdBvcbvLiz90kG1TSFC174XvFkrPXIRAMx-L5Y,37565
12
+ modal/_partial_function.py,sha256=t0yOVrYrDUdCJt7eVNyBS-atnUtjO56izKB3rDuN17Q,38573
13
13
  modal/_pty.py,sha256=E58MQ8d5-wkbMatRKpQR-G9FdbCRcZGiZxOpGy__VuY,1481
14
14
  modal/_resolver.py,sha256=2RWvm34cNSnbv1v7izJMNZgfvpLDD6LzaBlr0lIrLnY,7364
15
15
  modal/_resources.py,sha256=NMAp0GCLutiZI4GuKSIVnRHVlstoD3hNGUabjTUtzf4,1794
@@ -19,12 +19,12 @@ modal/_tunnel.py,sha256=zTBxBiuH1O22tS1OliAJdIsSmaZS8PlnifS_6S5z-mk,6320
19
19
  modal/_tunnel.pyi,sha256=rvC7USR2BcKkbZIeCJXwf7-UfGE-LPLjKsGNiK7Lxa4,13366
20
20
  modal/_type_manager.py,sha256=DWjgmjYJuOagw2erin506UUbG2H5UzZCFEekS-7hmfA,9087
21
21
  modal/_watcher.py,sha256=K6LYnlmSGQB4tWWI9JADv-tvSvQ1j522FwT71B51CX8,3584
22
- modal/app.py,sha256=tXbc6EO7ZCxphspVuqIOHOr-OKqL7De8vChDTYEAElg,54516
22
+ modal/app.py,sha256=FCU0n_qdKSIZNdNRX2EpbiukM1dY5LBdBNwro5xJB4k,54793
23
23
  modal/app.pyi,sha256=AUV5Rp8qQrZJTP2waoKHFY7rYgsXNMYibMcCAQKuSeo,50544
24
24
  modal/billing.py,sha256=zmQ3bcCJlwa4KD1IA_QgdWpm1pn13c-7qfy79iEauYI,195
25
25
  modal/call_graph.py,sha256=1g2DGcMIJvRy-xKicuf63IVE98gJSnQsr8R_NVMptNc,2581
26
26
  modal/client.py,sha256=kyAIVB3Ay-XKJizQ_1ufUFB__EagV0MLmHJpyYyJ7J0,18636
27
- modal/client.pyi,sha256=edvY77BCJ205t7U-gDfucFk7CheZXPFNlll6pmTcrUI,15831
27
+ modal/client.pyi,sha256=EiVZ37FKDhihbALk5g5bVvRp6HMPx0HgMNTumadmY_Y,15831
28
28
  modal/cloud_bucket_mount.py,sha256=I2GRXYhOWLIz2kJZjXu75jAm9EJkBNcutGc6jR2ReUw,5928
29
29
  modal/cloud_bucket_mount.pyi,sha256=VuUOipMIHqFXMkD-3g2bsoqpSxV5qswlFHDOqPQzYAo,7405
30
30
  modal/cls.py,sha256=ZxzivE3fNci4-A5uyBYNAzXMXtdqDg3gnYvgbdy5fhg,40384
@@ -57,7 +57,7 @@ modal/output.py,sha256=q4T9uHduunj4NwY-YSwkHGgjZlCXMuJbfQ5UFaAGRAc,1968
57
57
  modal/parallel_map.py,sha256=E5UYVszgLR8ppOUOqCgkqgn5A93yVMvJ5YmgGgrjyQo,68991
58
58
  modal/parallel_map.pyi,sha256=NZrtfZljig59hcMKU7Cz8lYZZFOiwK9l7oWrBtX6Oy8,15838
59
59
  modal/partial_function.py,sha256=aIdlGfTjjgqY6Fpr-biCjvRU9W542_S5N2xkNN_rYGM,1127
60
- modal/partial_function.pyi,sha256=lqqOzZ9-QvHTDWKQ_oAYYOvsXgTOBKhO9u-RI98JbUk,13986
60
+ modal/partial_function.pyi,sha256=M7aHV6sbCc7R28D4Tk6Agr39m6R0emrXvm8IfWflt1o,14023
61
61
  modal/proxy.py,sha256=CQydu_NPDgApN2GLdd7rrcg8PM-pXyFdVYcTaGMBRCQ,1491
62
62
  modal/proxy.pyi,sha256=yWGWwADCRGrC2w81B7671UTH4Uv3HMZKy5vVqlJUZoA,1417
63
63
  modal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -99,7 +99,7 @@ modal/_utils/blob_utils.py,sha256=bmPPHfLy8Kdna8e2xS3lvKwnN5pJUUt_rN39kVIYPFM,22
99
99
  modal/_utils/bytes_io_segment_payload.py,sha256=vaXPq8b52-x6G2hwE7SrjS58pg_aRm7gV3bn3yjmTzQ,4261
100
100
  modal/_utils/deprecation.py,sha256=-Bgg7jZdcJU8lROy18YyVnQYbM8hue-hVmwJqlWAGH0,5504
101
101
  modal/_utils/docker_utils.py,sha256=h1uETghR40mp_y3fSWuZAfbIASH1HMzuphJHghAL6DU,3722
102
- modal/_utils/function_utils.py,sha256=sXYXLpkGVGChnR-wFGu11-ovW640wePBvcc7f9aTUe8,28505
102
+ modal/_utils/function_utils.py,sha256=B5dAhcOM6SK3H-iwbrJjZ7XbjpweFd3YfmuFS26R8fQ,28671
103
103
  modal/_utils/git_utils.py,sha256=qtUU6JAttF55ZxYq51y55OR58B0tDPZsZWK5dJe6W5g,3182
104
104
  modal/_utils/grpc_testing.py,sha256=H1zHqthv19eGPJz2HKXDyWXWGSqO4BRsxah3L5Xaa8A,8619
105
105
  modal/_utils/grpc_utils.py,sha256=1dQgTvdHG9KSfyVTc26HhKjGnIDJpdDEJ0xZARklOrU,10205
@@ -156,7 +156,7 @@ modal/experimental/__init__.py,sha256=9gkVuDmu3m4TlKoU3MzEtTOemUSs8EEOWba40s7Aa0
156
156
  modal/experimental/flash.py,sha256=-lSyFBbeT6UT-uB29L955SNh6L6ISg_uBDy5gF4ZpLo,26919
157
157
  modal/experimental/flash.pyi,sha256=uwinKAYxpunNNfBj58FP88DXb535Qik4F6tnJKPAIwQ,14696
158
158
  modal/experimental/ipython.py,sha256=TrCfmol9LGsRZMeDoeMPx3Hv3BFqQhYnmD_iH0pqdhk,2904
159
- modal-1.2.1.dev17.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
159
+ modal-1.2.1.dev18.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
160
160
  modal_docs/__init__.py,sha256=svYKtV8HDwDCN86zbdWqyq5T8sMdGDj0PVlzc2tIxDM,28
161
161
  modal_docs/gen_cli_docs.py,sha256=c1yfBS_x--gL5bs0N4ihMwqwX8l3IBWSkBAKNNIi6bQ,3801
162
162
  modal_docs/gen_reference_docs.py,sha256=d_CQUGQ0rfw28u75I2mov9AlS773z9rG40-yq5o7g2U,6359
@@ -184,10 +184,10 @@ modal_proto/task_command_router_pb2.py,sha256=_pD2ZpU0bNzhwBdzmLoLyLtAtftI_Agxwn
184
184
  modal_proto/task_command_router_pb2.pyi,sha256=EyDgXPLr7alqjXYERV8w_MPuO404x0uCppmSkrfE9IE,14589
185
185
  modal_proto/task_command_router_pb2_grpc.py,sha256=uEQ0HdrCp8v-9bB5yIic9muA8spCShLHY6Bz9cCgOUE,10114
186
186
  modal_proto/task_command_router_pb2_grpc.pyi,sha256=s3Yxsrawdj4nr8vqQqsAxyX6ilWaGbdECy425KKbLIA,3301
187
- modal_version/__init__.py,sha256=yXxkExfmWwswJ_Ks1ArA2FSJLIZCr4HAnwKv8pT3h3U,121
187
+ modal_version/__init__.py,sha256=L_WFYLJA-bDlVzYIBSXvsgGtR9Cgj1ZzqQ4r0OGTA4I,121
188
188
  modal_version/__main__.py,sha256=2FO0yYQQwDTh6udt1h-cBnGd1c4ZyHnHSI4BksxzVac,105
189
- modal-1.2.1.dev17.dist-info/METADATA,sha256=W6Alrv7K7AiwVAUPcs6QyWLfrQL4pTT2Ar6GQZcQl-M,2484
190
- modal-1.2.1.dev17.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
191
- modal-1.2.1.dev17.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
192
- modal-1.2.1.dev17.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
193
- modal-1.2.1.dev17.dist-info/RECORD,,
189
+ modal-1.2.1.dev18.dist-info/METADATA,sha256=tsRkgWBnBafkisuWR5m8jsDcQBTrFgNR_QAJaknrl9A,2484
190
+ modal-1.2.1.dev18.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
191
+ modal-1.2.1.dev18.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
192
+ modal-1.2.1.dev18.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
193
+ modal-1.2.1.dev18.dist-info/RECORD,,
modal_version/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # Copyright Modal Labs 2025
2
2
  """Supplies the current version of the modal client library."""
3
3
 
4
- __version__ = "1.2.1.dev17"
4
+ __version__ = "1.2.1.dev18"