modal 0.62.16__py3-none-any.whl → 0.72.11__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.
Files changed (220) hide show
  1. modal/__init__.py +17 -13
  2. modal/__main__.py +41 -3
  3. modal/_clustered_functions.py +80 -0
  4. modal/_clustered_functions.pyi +22 -0
  5. modal/_container_entrypoint.py +420 -937
  6. modal/_ipython.py +3 -13
  7. modal/_location.py +17 -10
  8. modal/_output.py +243 -99
  9. modal/_pty.py +2 -2
  10. modal/_resolver.py +55 -59
  11. modal/_resources.py +51 -0
  12. modal/_runtime/__init__.py +1 -0
  13. modal/_runtime/asgi.py +519 -0
  14. modal/_runtime/container_io_manager.py +1036 -0
  15. modal/_runtime/execution_context.py +89 -0
  16. modal/_runtime/telemetry.py +169 -0
  17. modal/_runtime/user_code_imports.py +356 -0
  18. modal/_serialization.py +134 -9
  19. modal/_traceback.py +47 -187
  20. modal/_tunnel.py +52 -16
  21. modal/_tunnel.pyi +19 -36
  22. modal/_utils/app_utils.py +3 -17
  23. modal/_utils/async_utils.py +479 -100
  24. modal/_utils/blob_utils.py +157 -186
  25. modal/_utils/bytes_io_segment_payload.py +97 -0
  26. modal/_utils/deprecation.py +89 -0
  27. modal/_utils/docker_utils.py +98 -0
  28. modal/_utils/function_utils.py +460 -171
  29. modal/_utils/grpc_testing.py +47 -31
  30. modal/_utils/grpc_utils.py +62 -109
  31. modal/_utils/hash_utils.py +61 -19
  32. modal/_utils/http_utils.py +39 -9
  33. modal/_utils/logger.py +2 -1
  34. modal/_utils/mount_utils.py +34 -16
  35. modal/_utils/name_utils.py +58 -0
  36. modal/_utils/package_utils.py +14 -1
  37. modal/_utils/pattern_utils.py +205 -0
  38. modal/_utils/rand_pb_testing.py +5 -7
  39. modal/_utils/shell_utils.py +15 -49
  40. modal/_vendor/a2wsgi_wsgi.py +62 -72
  41. modal/_vendor/cloudpickle.py +1 -1
  42. modal/_watcher.py +14 -12
  43. modal/app.py +1003 -314
  44. modal/app.pyi +540 -264
  45. modal/call_graph.py +7 -6
  46. modal/cli/_download.py +63 -53
  47. modal/cli/_traceback.py +200 -0
  48. modal/cli/app.py +205 -45
  49. modal/cli/config.py +12 -5
  50. modal/cli/container.py +62 -14
  51. modal/cli/dict.py +128 -0
  52. modal/cli/entry_point.py +26 -13
  53. modal/cli/environment.py +40 -9
  54. modal/cli/import_refs.py +64 -58
  55. modal/cli/launch.py +32 -18
  56. modal/cli/network_file_system.py +64 -83
  57. modal/cli/profile.py +1 -1
  58. modal/cli/programs/run_jupyter.py +35 -10
  59. modal/cli/programs/vscode.py +60 -10
  60. modal/cli/queues.py +131 -0
  61. modal/cli/run.py +234 -131
  62. modal/cli/secret.py +8 -7
  63. modal/cli/token.py +7 -2
  64. modal/cli/utils.py +79 -10
  65. modal/cli/volume.py +110 -109
  66. modal/client.py +250 -144
  67. modal/client.pyi +157 -118
  68. modal/cloud_bucket_mount.py +108 -34
  69. modal/cloud_bucket_mount.pyi +32 -38
  70. modal/cls.py +535 -148
  71. modal/cls.pyi +190 -146
  72. modal/config.py +41 -19
  73. modal/container_process.py +177 -0
  74. modal/container_process.pyi +82 -0
  75. modal/dict.py +111 -65
  76. modal/dict.pyi +136 -131
  77. modal/environments.py +106 -5
  78. modal/environments.pyi +77 -25
  79. modal/exception.py +34 -43
  80. modal/experimental.py +61 -2
  81. modal/extensions/ipython.py +5 -5
  82. modal/file_io.py +537 -0
  83. modal/file_io.pyi +235 -0
  84. modal/file_pattern_matcher.py +197 -0
  85. modal/functions.py +906 -911
  86. modal/functions.pyi +466 -430
  87. modal/gpu.py +57 -44
  88. modal/image.py +1089 -479
  89. modal/image.pyi +584 -228
  90. modal/io_streams.py +434 -0
  91. modal/io_streams.pyi +122 -0
  92. modal/mount.py +314 -101
  93. modal/mount.pyi +241 -235
  94. modal/network_file_system.py +92 -92
  95. modal/network_file_system.pyi +152 -110
  96. modal/object.py +67 -36
  97. modal/object.pyi +166 -143
  98. modal/output.py +63 -0
  99. modal/parallel_map.py +434 -0
  100. modal/parallel_map.pyi +75 -0
  101. modal/partial_function.py +282 -117
  102. modal/partial_function.pyi +222 -129
  103. modal/proxy.py +15 -12
  104. modal/proxy.pyi +3 -8
  105. modal/queue.py +182 -65
  106. modal/queue.pyi +218 -118
  107. modal/requirements/2024.04.txt +29 -0
  108. modal/requirements/2024.10.txt +16 -0
  109. modal/requirements/README.md +21 -0
  110. modal/requirements/base-images.json +22 -0
  111. modal/retries.py +48 -7
  112. modal/runner.py +459 -156
  113. modal/runner.pyi +135 -71
  114. modal/running_app.py +38 -0
  115. modal/sandbox.py +514 -236
  116. modal/sandbox.pyi +397 -169
  117. modal/schedule.py +4 -4
  118. modal/scheduler_placement.py +20 -3
  119. modal/secret.py +56 -31
  120. modal/secret.pyi +62 -42
  121. modal/serving.py +51 -56
  122. modal/serving.pyi +44 -36
  123. modal/stream_type.py +15 -0
  124. modal/token_flow.py +5 -3
  125. modal/token_flow.pyi +37 -32
  126. modal/volume.py +285 -157
  127. modal/volume.pyi +249 -184
  128. {modal-0.62.16.dist-info → modal-0.72.11.dist-info}/METADATA +7 -7
  129. modal-0.72.11.dist-info/RECORD +174 -0
  130. {modal-0.62.16.dist-info → modal-0.72.11.dist-info}/top_level.txt +0 -1
  131. modal_docs/gen_reference_docs.py +3 -1
  132. modal_docs/mdmd/mdmd.py +0 -1
  133. modal_docs/mdmd/signatures.py +5 -2
  134. modal_global_objects/images/base_images.py +28 -0
  135. modal_global_objects/mounts/python_standalone.py +2 -2
  136. modal_proto/__init__.py +1 -1
  137. modal_proto/api.proto +1288 -533
  138. modal_proto/api_grpc.py +856 -456
  139. modal_proto/api_pb2.py +2165 -1157
  140. modal_proto/api_pb2.pyi +8859 -0
  141. modal_proto/api_pb2_grpc.py +1674 -855
  142. modal_proto/api_pb2_grpc.pyi +1416 -0
  143. modal_proto/modal_api_grpc.py +149 -0
  144. modal_proto/modal_options_grpc.py +3 -0
  145. modal_proto/options_pb2.pyi +20 -0
  146. modal_proto/options_pb2_grpc.pyi +7 -0
  147. modal_proto/py.typed +0 -0
  148. modal_version/__init__.py +1 -1
  149. modal_version/_version_generated.py +2 -2
  150. modal/_asgi.py +0 -370
  151. modal/_container_entrypoint.pyi +0 -378
  152. modal/_container_exec.py +0 -128
  153. modal/_sandbox_shell.py +0 -49
  154. modal/shared_volume.py +0 -23
  155. modal/shared_volume.pyi +0 -24
  156. modal/stub.py +0 -783
  157. modal/stub.pyi +0 -332
  158. modal-0.62.16.dist-info/RECORD +0 -198
  159. modal_global_objects/images/conda.py +0 -15
  160. modal_global_objects/images/debian_slim.py +0 -15
  161. modal_global_objects/images/micromamba.py +0 -15
  162. test/__init__.py +0 -1
  163. test/aio_test.py +0 -12
  164. test/async_utils_test.py +0 -262
  165. test/blob_test.py +0 -67
  166. test/cli_imports_test.py +0 -149
  167. test/cli_test.py +0 -659
  168. test/client_test.py +0 -194
  169. test/cls_test.py +0 -630
  170. test/config_test.py +0 -137
  171. test/conftest.py +0 -1420
  172. test/container_app_test.py +0 -32
  173. test/container_test.py +0 -1389
  174. test/cpu_test.py +0 -23
  175. test/decorator_test.py +0 -85
  176. test/deprecation_test.py +0 -34
  177. test/dict_test.py +0 -33
  178. test/e2e_test.py +0 -68
  179. test/error_test.py +0 -7
  180. test/function_serialization_test.py +0 -32
  181. test/function_test.py +0 -653
  182. test/function_utils_test.py +0 -101
  183. test/gpu_test.py +0 -159
  184. test/grpc_utils_test.py +0 -141
  185. test/helpers.py +0 -42
  186. test/image_test.py +0 -669
  187. test/live_reload_test.py +0 -80
  188. test/lookup_test.py +0 -70
  189. test/mdmd_test.py +0 -329
  190. test/mount_test.py +0 -162
  191. test/mounted_files_test.py +0 -329
  192. test/network_file_system_test.py +0 -181
  193. test/notebook_test.py +0 -66
  194. test/object_test.py +0 -41
  195. test/package_utils_test.py +0 -25
  196. test/queue_test.py +0 -97
  197. test/resolver_test.py +0 -58
  198. test/retries_test.py +0 -67
  199. test/runner_test.py +0 -85
  200. test/sandbox_test.py +0 -191
  201. test/schedule_test.py +0 -15
  202. test/scheduler_placement_test.py +0 -29
  203. test/secret_test.py +0 -78
  204. test/serialization_test.py +0 -42
  205. test/stub_composition_test.py +0 -10
  206. test/stub_test.py +0 -360
  207. test/test_asgi_wrapper.py +0 -234
  208. test/token_flow_test.py +0 -18
  209. test/traceback_test.py +0 -135
  210. test/tunnel_test.py +0 -29
  211. test/utils_test.py +0 -88
  212. test/version_test.py +0 -14
  213. test/volume_test.py +0 -341
  214. test/watcher_test.py +0 -30
  215. test/webhook_test.py +0 -146
  216. /modal/{requirements.312.txt → requirements/2023.12.312.txt} +0 -0
  217. /modal/{requirements.txt → requirements/2023.12.txt} +0 -0
  218. {modal-0.62.16.dist-info → modal-0.72.11.dist-info}/LICENSE +0 -0
  219. {modal-0.62.16.dist-info → modal-0.72.11.dist-info}/WHEEL +0 -0
  220. {modal-0.62.16.dist-info → modal-0.72.11.dist-info}/entry_points.txt +0 -0
modal/functions.pyi CHANGED
@@ -1,565 +1,601 @@
1
- import _contextvars
1
+ import collections.abc
2
2
  import google.protobuf.message
3
- import modal._output
3
+ import modal._utils.async_utils
4
4
  import modal._utils.function_utils
5
+ import modal.app
5
6
  import modal.call_graph
6
7
  import modal.client
7
8
  import modal.cloud_bucket_mount
9
+ import modal.cls
8
10
  import modal.gpu
9
11
  import modal.image
10
12
  import modal.mount
11
13
  import modal.network_file_system
12
14
  import modal.object
15
+ import modal.parallel_map
16
+ import modal.partial_function
13
17
  import modal.proxy
14
18
  import modal.retries
15
19
  import modal.schedule
16
20
  import modal.scheduler_placement
17
21
  import modal.secret
18
- import modal.stub
19
22
  import modal.volume
20
- import modal_proto.api_grpc
21
23
  import modal_proto.api_pb2
24
+ import modal_proto.modal_api_grpc
22
25
  import pathlib
23
26
  import typing
24
27
  import typing_extensions
25
28
 
26
- def exc_with_hints(exc: BaseException):
27
- ...
28
-
29
-
30
- async def _process_result(result: modal_proto.api_pb2.GenericResult, data_format: int, stub, client=None):
31
- ...
32
-
33
-
34
- async def _create_input(args, kwargs, client, idx: typing.Union[int, None] = None) -> modal_proto.api_pb2.FunctionPutInputsItem:
35
- ...
36
-
37
-
38
- def _stream_function_call_data(client, function_call_id: str, variant: typing.Literal['data_in', 'data_out']) -> typing.AsyncIterator[typing.Any]:
39
- ...
40
-
41
-
42
- class _OutputValue:
43
- value: typing.Any
44
-
45
- def __init__(self, value: typing.Any) -> None:
46
- ...
47
-
48
- def __repr__(self):
49
- ...
50
-
51
- def __eq__(self, other):
52
- ...
53
-
29
+ class _RetryContext:
30
+ function_call_invocation_type: int
31
+ retry_policy: modal_proto.api_pb2.FunctionRetryPolicy
32
+ function_call_jwt: str
33
+ input_jwt: str
34
+ input_id: str
35
+ item: modal_proto.api_pb2.FunctionPutInputsItem
36
+
37
+ def __init__(
38
+ self,
39
+ function_call_invocation_type: int,
40
+ retry_policy: modal_proto.api_pb2.FunctionRetryPolicy,
41
+ function_call_jwt: str,
42
+ input_jwt: str,
43
+ input_id: str,
44
+ item: modal_proto.api_pb2.FunctionPutInputsItem,
45
+ ) -> None: ...
46
+ def __repr__(self): ...
47
+ def __eq__(self, other): ...
54
48
 
55
49
  class _Invocation:
56
- def __init__(self, stub: modal_proto.api_grpc.ModalClientStub, function_call_id: str, client: modal.client._Client):
57
- ...
58
-
50
+ stub: modal_proto.modal_api_grpc.ModalClientModal
51
+
52
+ def __init__(
53
+ self,
54
+ stub: modal_proto.modal_api_grpc.ModalClientModal,
55
+ function_call_id: str,
56
+ client: modal.client._Client,
57
+ retry_context: typing.Optional[_RetryContext] = None,
58
+ ): ...
59
59
  @staticmethod
60
- async def create(function_id: str, args, kwargs, client: modal.client._Client) -> _Invocation:
61
- ...
62
-
63
- def pop_function_call_outputs(self, timeout: typing.Union[float, None], clear_on_success: bool) -> typing.AsyncIterator[modal_proto.api_pb2.FunctionGetOutputsItem]:
64
- ...
65
-
66
- async def run_function(self) -> typing.Any:
67
- ...
68
-
69
- async def poll_function(self, timeout: typing.Union[float, None] = None):
70
- ...
71
-
72
- def run_generator(self):
73
- ...
74
-
75
-
76
- def _map_invocation(function_id: str, input_stream: typing.AsyncIterable[typing.Any], kwargs: typing.Dict[str, typing.Any], client: modal.client._Client, order_outputs: bool, return_exceptions: bool, count_update_callback: typing.Union[typing.Callable[[int, int], None], None]):
77
- ...
78
-
60
+ async def create(
61
+ function: _Function, args, kwargs, *, client: modal.client._Client, function_call_invocation_type: int
62
+ ) -> _Invocation: ...
63
+ async def pop_function_call_outputs(
64
+ self, timeout: typing.Optional[float], clear_on_success: bool, input_jwts: typing.Optional[list[str]] = None
65
+ ) -> modal_proto.api_pb2.FunctionGetOutputsResponse: ...
66
+ async def _retry_input(self) -> None: ...
67
+ async def _get_single_output(self, expected_jwt: typing.Optional[str] = None) -> typing.Any: ...
68
+ async def run_function(self) -> typing.Any: ...
69
+ async def poll_function(self, timeout: typing.Optional[float] = None): ...
70
+ def run_generator(self): ...
79
71
 
80
72
  class FunctionStats:
81
73
  backlog: int
82
- num_active_runners: int
83
74
  num_total_runners: int
84
75
 
85
- def __init__(self, backlog: int, num_active_runners: int, num_total_runners: int) -> None:
86
- ...
87
-
88
- def __repr__(self):
89
- ...
90
-
91
- def __eq__(self, other):
92
- ...
93
-
94
- def __setattr__(self, name, value):
95
- ...
96
-
97
- def __delattr__(self, name):
98
- ...
99
-
100
- def __hash__(self):
101
- ...
102
-
103
-
104
- def _parse_retries(retries: typing.Union[int, modal.retries.Retries, None], raw_f: typing.Union[typing.Callable, None] = None) -> typing.Union[modal_proto.api_pb2.FunctionRetryPolicy, None]:
105
- ...
106
-
107
-
108
- class FunctionEnv:
109
- image: typing.Union[modal.image._Image, None]
110
- mounts: typing.Sequence[modal.mount._Mount]
111
- secrets: typing.Sequence[modal.secret._Secret]
112
- network_file_systems: typing.Dict[typing.Union[str, pathlib.PurePosixPath], modal.network_file_system._NetworkFileSystem]
113
- volumes: typing.Dict[typing.Union[str, pathlib.PurePosixPath], typing.Union[modal.volume._Volume, modal.cloud_bucket_mount._CloudBucketMount]]
114
- gpu: typing.Union[None, bool, str, modal.gpu._GPUConfig]
115
- cloud: typing.Union[str, None]
116
- cpu: typing.Union[float, None]
117
- memory: typing.Union[int, None]
118
-
119
- def __init__(self, image: typing.Union[modal.image._Image, None], mounts: typing.Sequence[modal.mount._Mount], secrets: typing.Sequence[modal.secret._Secret], network_file_systems: typing.Dict[typing.Union[str, pathlib.PurePosixPath], modal.network_file_system._NetworkFileSystem], volumes: typing.Dict[typing.Union[str, pathlib.PurePosixPath], typing.Union[modal.volume._Volume, modal.cloud_bucket_mount._CloudBucketMount]], gpu: typing.Union[None, bool, str, modal.gpu._GPUConfig], cloud: typing.Union[str, None], cpu: typing.Union[float, None], memory: typing.Union[int, None]) -> None:
120
- ...
121
-
122
- def __repr__(self):
123
- ...
124
-
125
- def __eq__(self, other):
126
- ...
127
-
128
-
129
- class _Function(modal.object._Object):
130
- _info: typing.Union[modal._utils.function_utils.FunctionInfo, None]
131
- _all_mounts: typing.Collection[modal.mount._Mount]
132
- _stub: modal.stub._Stub
133
- _obj: typing.Any
134
- _web_url: typing.Union[str, None]
135
- _is_remote_cls_method: bool
136
- _function_name: typing.Union[str, None]
76
+ def __getattr__(self, name): ...
77
+ def __init__(self, backlog: int, num_total_runners: int) -> None: ...
78
+ def __repr__(self): ...
79
+ def __eq__(self, other): ...
80
+ def __setattr__(self, name, value): ...
81
+ def __delattr__(self, name): ...
82
+ def __hash__(self): ...
83
+
84
+ def _parse_retries(
85
+ retries: typing.Union[int, modal.retries.Retries, None], source: str = ""
86
+ ) -> typing.Optional[modal_proto.api_pb2.FunctionRetryPolicy]: ...
87
+
88
+ class _FunctionSpec:
89
+ image: typing.Optional[modal.image._Image]
90
+ mounts: collections.abc.Sequence[modal.mount._Mount]
91
+ secrets: collections.abc.Sequence[modal.secret._Secret]
92
+ network_file_systems: dict[typing.Union[str, pathlib.PurePosixPath], modal.network_file_system._NetworkFileSystem]
93
+ volumes: dict[
94
+ typing.Union[str, pathlib.PurePosixPath],
95
+ typing.Union[modal.volume._Volume, modal.cloud_bucket_mount._CloudBucketMount],
96
+ ]
97
+ gpus: typing.Union[None, bool, str, modal.gpu._GPUConfig, list[typing.Union[None, bool, str, modal.gpu._GPUConfig]]]
98
+ cloud: typing.Optional[str]
99
+ cpu: typing.Union[float, tuple[float, float], None]
100
+ memory: typing.Union[int, tuple[int, int], None]
101
+ ephemeral_disk: typing.Optional[int]
102
+ scheduler_placement: typing.Optional[modal.scheduler_placement.SchedulerPlacement]
103
+ proxy: typing.Optional[modal.proxy._Proxy]
104
+
105
+ def __init__(
106
+ self,
107
+ image: typing.Optional[modal.image._Image],
108
+ mounts: collections.abc.Sequence[modal.mount._Mount],
109
+ secrets: collections.abc.Sequence[modal.secret._Secret],
110
+ network_file_systems: dict[
111
+ typing.Union[str, pathlib.PurePosixPath], modal.network_file_system._NetworkFileSystem
112
+ ],
113
+ volumes: dict[
114
+ typing.Union[str, pathlib.PurePosixPath],
115
+ typing.Union[modal.volume._Volume, modal.cloud_bucket_mount._CloudBucketMount],
116
+ ],
117
+ gpus: typing.Union[
118
+ None, bool, str, modal.gpu._GPUConfig, list[typing.Union[None, bool, str, modal.gpu._GPUConfig]]
119
+ ],
120
+ cloud: typing.Optional[str],
121
+ cpu: typing.Union[float, tuple[float, float], None],
122
+ memory: typing.Union[int, tuple[int, int], None],
123
+ ephemeral_disk: typing.Optional[int],
124
+ scheduler_placement: typing.Optional[modal.scheduler_placement.SchedulerPlacement],
125
+ proxy: typing.Optional[modal.proxy._Proxy],
126
+ ) -> None: ...
127
+ def __repr__(self): ...
128
+ def __eq__(self, other): ...
129
+
130
+ P = typing_extensions.ParamSpec("P")
131
+
132
+ ReturnType = typing.TypeVar("ReturnType", covariant=True)
133
+
134
+ OriginalReturnType = typing.TypeVar("OriginalReturnType", covariant=True)
135
+
136
+ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object._Object):
137
+ _info: typing.Optional[modal._utils.function_utils.FunctionInfo]
138
+ _serve_mounts: frozenset[modal.mount._Mount]
139
+ _app: typing.Optional[modal.app._App]
140
+ _obj: typing.Optional[modal.cls._Obj]
141
+ _web_url: typing.Optional[str]
142
+ _function_name: typing.Optional[str]
137
143
  _is_method: bool
138
- _env: FunctionEnv
144
+ _spec: typing.Optional[_FunctionSpec]
139
145
  _tag: str
140
146
  _raw_f: typing.Callable[..., typing.Any]
141
147
  _build_args: dict
142
- _parent: _Function
148
+ _is_generator: typing.Optional[bool]
149
+ _cluster_size: typing.Optional[int]
150
+ _use_method_name: str
151
+ _class_parameter_info: typing.Optional[modal_proto.api_pb2.ClassParameterInfo]
152
+ _method_handle_metadata: typing.Optional[dict[str, modal_proto.api_pb2.FunctionHandleMetadata]]
143
153
 
154
+ def _bind_method(self, user_cls, method_name: str, partial_function: modal.partial_function._PartialFunction): ...
144
155
  @staticmethod
145
- def from_args(info: modal._utils.function_utils.FunctionInfo, stub, image: modal.image._Image, secret: typing.Union[modal.secret._Secret, None] = None, secrets: typing.Sequence[modal.secret._Secret] = (), schedule: typing.Union[modal.schedule.Schedule, None] = None, is_generator=False, gpu: typing.Union[None, bool, str, modal.gpu._GPUConfig] = None, mounts: typing.Collection[modal.mount._Mount] = (), network_file_systems: typing.Dict[typing.Union[str, pathlib.PurePosixPath], modal.network_file_system._NetworkFileSystem] = {}, allow_cross_region_volumes: bool = False, volumes: typing.Dict[typing.Union[str, pathlib.PurePosixPath], typing.Union[modal.volume._Volume, modal.cloud_bucket_mount._CloudBucketMount]] = {}, webhook_config: typing.Union[modal_proto.api_pb2.WebhookConfig, None] = None, memory: typing.Union[int, None] = None, proxy: typing.Union[modal.proxy._Proxy, None] = None, retries: typing.Union[int, modal.retries.Retries, None] = None, timeout: typing.Union[int, None] = None, concurrency_limit: typing.Union[int, None] = None, allow_concurrent_inputs: typing.Union[int, None] = None, container_idle_timeout: typing.Union[int, None] = None, cpu: typing.Union[float, None] = None, keep_warm: typing.Union[int, None] = None, cloud: typing.Union[str, None] = None, _experimental_boost: bool = False, _experimental_scheduler: bool = False, _experimental_scheduler_placement: typing.Union[modal.scheduler_placement.SchedulerPlacement, None] = None, is_builder_function: bool = False, is_auto_snapshot: bool = False, enable_memory_snapshot: bool = False, checkpointing_enabled: typing.Union[bool, None] = None, allow_background_volume_commits: bool = False, block_network: bool = False, max_inputs: typing.Union[int, None] = None) -> None:
146
- ...
147
-
148
- def from_parametrized(self, obj, from_other_workspace: bool, options: typing.Union[modal_proto.api_pb2.FunctionOptions, None], args: typing.Sized, kwargs: typing.Dict[str, typing.Any]) -> _Function:
149
- ...
150
-
151
- async def keep_warm(self, warm_pool_size: int) -> None:
152
- ...
153
-
156
+ def from_args(
157
+ info: modal._utils.function_utils.FunctionInfo,
158
+ app,
159
+ image: modal.image._Image,
160
+ secrets: collections.abc.Sequence[modal.secret._Secret] = (),
161
+ schedule: typing.Optional[modal.schedule.Schedule] = None,
162
+ is_generator: bool = False,
163
+ gpu: typing.Union[
164
+ None, bool, str, modal.gpu._GPUConfig, list[typing.Union[None, bool, str, modal.gpu._GPUConfig]]
165
+ ] = None,
166
+ mounts: collections.abc.Collection[modal.mount._Mount] = (),
167
+ network_file_systems: dict[
168
+ typing.Union[str, pathlib.PurePosixPath], modal.network_file_system._NetworkFileSystem
169
+ ] = {},
170
+ allow_cross_region_volumes: bool = False,
171
+ volumes: dict[
172
+ typing.Union[str, pathlib.PurePosixPath],
173
+ typing.Union[modal.volume._Volume, modal.cloud_bucket_mount._CloudBucketMount],
174
+ ] = {},
175
+ webhook_config: typing.Optional[modal_proto.api_pb2.WebhookConfig] = None,
176
+ memory: typing.Union[int, tuple[int, int], None] = None,
177
+ proxy: typing.Optional[modal.proxy._Proxy] = None,
178
+ retries: typing.Union[int, modal.retries.Retries, None] = None,
179
+ timeout: typing.Optional[int] = None,
180
+ concurrency_limit: typing.Optional[int] = None,
181
+ allow_concurrent_inputs: typing.Optional[int] = None,
182
+ batch_max_size: typing.Optional[int] = None,
183
+ batch_wait_ms: typing.Optional[int] = None,
184
+ container_idle_timeout: typing.Optional[int] = None,
185
+ cpu: typing.Union[float, tuple[float, float], None] = None,
186
+ keep_warm: typing.Optional[int] = None,
187
+ cloud: typing.Optional[str] = None,
188
+ scheduler_placement: typing.Optional[modal.scheduler_placement.SchedulerPlacement] = None,
189
+ is_builder_function: bool = False,
190
+ is_auto_snapshot: bool = False,
191
+ enable_memory_snapshot: bool = False,
192
+ block_network: bool = False,
193
+ i6pn_enabled: bool = False,
194
+ cluster_size: typing.Optional[int] = None,
195
+ max_inputs: typing.Optional[int] = None,
196
+ ephemeral_disk: typing.Optional[int] = None,
197
+ _experimental_buffer_containers: typing.Optional[int] = None,
198
+ _experimental_proxy_ip: typing.Optional[str] = None,
199
+ _experimental_custom_scaling_factor: typing.Optional[float] = None,
200
+ ) -> None: ...
201
+ def _bind_parameters(
202
+ self,
203
+ obj: modal.cls._Obj,
204
+ options: typing.Optional[modal_proto.api_pb2.FunctionOptions],
205
+ args: collections.abc.Sized,
206
+ kwargs: dict[str, typing.Any],
207
+ ) -> _Function: ...
208
+ async def keep_warm(self, warm_pool_size: int) -> None: ...
154
209
  @classmethod
155
- def from_name(cls: typing.Type[_Function], app_name: str, tag: typing.Union[str, None] = None, namespace=1, environment_name: typing.Union[str, None] = None) -> _Function:
156
- ...
157
-
210
+ def from_name(
211
+ cls: type[_Function], app_name: str, name: str, namespace=1, environment_name: typing.Optional[str] = None
212
+ ) -> _Function: ...
158
213
  @staticmethod
159
- async def lookup(app_name: str, tag: typing.Union[str, None] = None, namespace=1, client: typing.Union[modal.client._Client, None] = None, environment_name: typing.Union[str, None] = None) -> _Function:
160
- ...
161
-
214
+ async def lookup(
215
+ app_name: str,
216
+ name: str,
217
+ namespace=1,
218
+ client: typing.Optional[modal.client._Client] = None,
219
+ environment_name: typing.Optional[str] = None,
220
+ ) -> _Function: ...
162
221
  @property
163
- def tag(self) -> str:
164
- ...
165
-
222
+ def tag(self) -> str: ...
166
223
  @property
167
- def stub(self) -> modal.stub._Stub:
168
- ...
169
-
224
+ def app(self) -> modal.app._App: ...
170
225
  @property
171
- def info(self) -> modal._utils.function_utils.FunctionInfo:
172
- ...
173
-
226
+ def stub(self) -> modal.app._App: ...
174
227
  @property
175
- def env(self) -> FunctionEnv:
176
- ...
177
-
178
- def get_build_def(self) -> str:
179
- ...
180
-
181
- def _initialize_from_empty(self):
182
- ...
183
-
184
- def _hydrate_metadata(self, metadata: typing.Union[google.protobuf.message.Message, None]):
185
- ...
186
-
187
- def _get_metadata(self):
188
- ...
189
-
190
- def _set_mute_cancellation(self, value: bool = True):
191
- ...
192
-
193
- def _set_output_mgr(self, output_mgr: modal._output.OutputManager):
194
- ...
195
-
228
+ def info(self) -> modal._utils.function_utils.FunctionInfo: ...
196
229
  @property
197
- def web_url(self) -> str:
198
- ...
199
-
230
+ def spec(self) -> _FunctionSpec: ...
231
+ def get_build_def(self) -> str: ...
232
+ def _initialize_from_empty(self): ...
233
+ def _hydrate_metadata(self, metadata: typing.Optional[google.protobuf.message.Message]): ...
234
+ def _get_metadata(self): ...
235
+ def _check_no_web_url(self, fn_name: str): ...
200
236
  @property
201
- def is_generator(self) -> bool:
202
- ...
203
-
204
- def _map(self, input_stream: typing.AsyncIterable[typing.Any], order_outputs: bool, return_exceptions: bool, kwargs={}):
205
- ...
206
-
207
- async def _call_function(self, args, kwargs):
208
- ...
209
-
210
- async def _call_function_nowait(self, args, kwargs) -> _Invocation:
211
- ...
212
-
213
- def _call_generator(self, args, kwargs):
214
- ...
215
-
216
- async def _call_generator_nowait(self, args, kwargs):
217
- ...
218
-
219
- def map(self, *input_iterators, kwargs={}, order_outputs: bool = True, return_exceptions: bool = False) -> typing.AsyncGenerator[typing.Any, None]:
220
- ...
221
-
222
- async def for_each(self, *input_iterators, kwargs={}, ignore_exceptions: bool = False):
223
- ...
224
-
225
- def starmap(self, input_iterator, kwargs={}, order_outputs: bool = True, return_exceptions: bool = False) -> typing.AsyncGenerator[typing.Any, None]:
226
- ...
227
-
228
- async def remote(self, *args, **kwargs) -> typing.Any:
229
- ...
230
-
231
- def remote_gen(self, *args, **kwargs) -> typing.AsyncGenerator[typing.Any, None]:
232
- ...
233
-
234
- async def shell(self, *args, **kwargs) -> None:
235
- ...
237
+ async def web_url(self) -> str: ...
238
+ @property
239
+ async def is_generator(self) -> bool: ...
240
+ @property
241
+ def cluster_size(self) -> int: ...
242
+ def _map(
243
+ self, input_queue: modal.parallel_map._SynchronizedQueue, order_outputs: bool, return_exceptions: bool
244
+ ) -> collections.abc.AsyncGenerator[typing.Any, None]: ...
245
+ async def _call_function(self, args, kwargs) -> ReturnType: ...
246
+ async def _call_function_nowait(self, args, kwargs, function_call_invocation_type: int) -> _Invocation: ...
247
+ def _call_generator(self, args, kwargs): ...
248
+ async def _call_generator_nowait(self, args, kwargs): ...
249
+ async def remote(self, *args: P.args, **kwargs: P.kwargs) -> ReturnType: ...
250
+ def remote_gen(self, *args, **kwargs) -> collections.abc.AsyncGenerator[typing.Any, None]: ...
251
+ def _is_local(self): ...
252
+ def _get_info(self) -> modal._utils.function_utils.FunctionInfo: ...
253
+ def _get_obj(self) -> typing.Optional[modal.cls._Obj]: ...
254
+ def local(self, *args: P.args, **kwargs: P.kwargs) -> OriginalReturnType: ...
255
+ async def _experimental_spawn(self, *args: P.args, **kwargs: P.kwargs) -> _FunctionCall[ReturnType]: ...
256
+ async def spawn(self, *args: P.args, **kwargs: P.kwargs) -> _FunctionCall[ReturnType]: ...
257
+ def get_raw_f(self) -> typing.Callable[..., typing.Any]: ...
258
+ async def get_current_stats(self) -> FunctionStats: ...
236
259
 
237
- def _get_is_remote_cls_method(self):
238
- ...
260
+ class __map_spec(typing_extensions.Protocol):
261
+ def __call__(
262
+ self, *input_iterators, kwargs={}, order_outputs: bool = True, return_exceptions: bool = False
263
+ ) -> modal._utils.async_utils.AsyncOrSyncIterable: ...
264
+ def aio(
265
+ self,
266
+ *input_iterators: typing.Union[typing.Iterable[typing.Any], typing.AsyncIterable[typing.Any]],
267
+ kwargs={},
268
+ order_outputs: bool = True,
269
+ return_exceptions: bool = False,
270
+ ) -> typing.AsyncGenerator[typing.Any, None]: ...
239
271
 
240
- def _get_info(self):
241
- ...
272
+ map: __map_spec
242
273
 
243
- def _get_obj(self):
244
- ...
274
+ class __starmap_spec(typing_extensions.Protocol):
275
+ def __call__(
276
+ self,
277
+ input_iterator: typing.Iterable[typing.Sequence[typing.Any]],
278
+ kwargs={},
279
+ order_outputs: bool = True,
280
+ return_exceptions: bool = False,
281
+ ) -> modal._utils.async_utils.AsyncOrSyncIterable: ...
282
+ def aio(
283
+ self,
284
+ input_iterator: typing.Union[
285
+ typing.Iterable[typing.Sequence[typing.Any]], typing.AsyncIterable[typing.Sequence[typing.Any]]
286
+ ],
287
+ kwargs={},
288
+ order_outputs: bool = True,
289
+ return_exceptions: bool = False,
290
+ ) -> typing.AsyncIterable[typing.Any]: ...
245
291
 
246
- def local(self, *args, **kwargs) -> typing.Any:
247
- ...
292
+ starmap: __starmap_spec
248
293
 
249
- async def spawn(self, *args, **kwargs) -> typing.Union[_FunctionCall, None]:
250
- ...
294
+ class __for_each_spec(typing_extensions.Protocol):
295
+ def __call__(self, *input_iterators, kwargs={}, ignore_exceptions: bool = False): ...
296
+ async def aio(self, *input_iterators, kwargs={}, ignore_exceptions: bool = False): ...
251
297
 
252
- def get_raw_f(self) -> typing.Callable[..., typing.Any]:
253
- ...
298
+ for_each: __for_each_spec
254
299
 
255
- async def get_current_stats(self) -> FunctionStats:
256
- ...
300
+ ReturnType_INNER = typing.TypeVar("ReturnType_INNER", covariant=True)
257
301
 
302
+ P_INNER = typing_extensions.ParamSpec("P_INNER")
258
303
 
259
- class Function(modal.object.Object):
260
- _info: typing.Union[modal._utils.function_utils.FunctionInfo, None]
261
- _all_mounts: typing.Collection[modal.mount.Mount]
262
- _stub: modal.stub.Stub
263
- _obj: typing.Any
264
- _web_url: typing.Union[str, None]
265
- _is_remote_cls_method: bool
266
- _function_name: typing.Union[str, None]
304
+ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.Object):
305
+ _info: typing.Optional[modal._utils.function_utils.FunctionInfo]
306
+ _serve_mounts: frozenset[modal.mount.Mount]
307
+ _app: typing.Optional[modal.app.App]
308
+ _obj: typing.Optional[modal.cls.Obj]
309
+ _web_url: typing.Optional[str]
310
+ _function_name: typing.Optional[str]
267
311
  _is_method: bool
268
- _env: FunctionEnv
312
+ _spec: typing.Optional[_FunctionSpec]
269
313
  _tag: str
270
314
  _raw_f: typing.Callable[..., typing.Any]
271
315
  _build_args: dict
272
- _parent: Function
273
-
274
- def __init__(self, *args, **kwargs):
275
- ...
276
-
316
+ _is_generator: typing.Optional[bool]
317
+ _cluster_size: typing.Optional[int]
318
+ _use_method_name: str
319
+ _class_parameter_info: typing.Optional[modal_proto.api_pb2.ClassParameterInfo]
320
+ _method_handle_metadata: typing.Optional[dict[str, modal_proto.api_pb2.FunctionHandleMetadata]]
321
+
322
+ def __init__(self, *args, **kwargs): ...
323
+ def _bind_method(self, user_cls, method_name: str, partial_function: modal.partial_function.PartialFunction): ...
277
324
  @staticmethod
278
- def from_args(info: modal._utils.function_utils.FunctionInfo, stub, image: modal.image.Image, secret: typing.Union[modal.secret.Secret, None] = None, secrets: typing.Sequence[modal.secret.Secret] = (), schedule: typing.Union[modal.schedule.Schedule, None] = None, is_generator=False, gpu: typing.Union[None, bool, str, modal.gpu._GPUConfig] = None, mounts: typing.Collection[modal.mount.Mount] = (), network_file_systems: typing.Dict[typing.Union[str, pathlib.PurePosixPath], modal.network_file_system.NetworkFileSystem] = {}, allow_cross_region_volumes: bool = False, volumes: typing.Dict[typing.Union[str, pathlib.PurePosixPath], typing.Union[modal.volume.Volume, modal.cloud_bucket_mount.CloudBucketMount]] = {}, webhook_config: typing.Union[modal_proto.api_pb2.WebhookConfig, None] = None, memory: typing.Union[int, None] = None, proxy: typing.Union[modal.proxy.Proxy, None] = None, retries: typing.Union[int, modal.retries.Retries, None] = None, timeout: typing.Union[int, None] = None, concurrency_limit: typing.Union[int, None] = None, allow_concurrent_inputs: typing.Union[int, None] = None, container_idle_timeout: typing.Union[int, None] = None, cpu: typing.Union[float, None] = None, keep_warm: typing.Union[int, None] = None, cloud: typing.Union[str, None] = None, _experimental_boost: bool = False, _experimental_scheduler: bool = False, _experimental_scheduler_placement: typing.Union[modal.scheduler_placement.SchedulerPlacement, None] = None, is_builder_function: bool = False, is_auto_snapshot: bool = False, enable_memory_snapshot: bool = False, checkpointing_enabled: typing.Union[bool, None] = None, allow_background_volume_commits: bool = False, block_network: bool = False, max_inputs: typing.Union[int, None] = None) -> None:
279
- ...
280
-
281
- def from_parametrized(self, obj, from_other_workspace: bool, options: typing.Union[modal_proto.api_pb2.FunctionOptions, None], args: typing.Sized, kwargs: typing.Dict[str, typing.Any]) -> Function:
282
- ...
325
+ def from_args(
326
+ info: modal._utils.function_utils.FunctionInfo,
327
+ app,
328
+ image: modal.image.Image,
329
+ secrets: collections.abc.Sequence[modal.secret.Secret] = (),
330
+ schedule: typing.Optional[modal.schedule.Schedule] = None,
331
+ is_generator: bool = False,
332
+ gpu: typing.Union[
333
+ None, bool, str, modal.gpu._GPUConfig, list[typing.Union[None, bool, str, modal.gpu._GPUConfig]]
334
+ ] = None,
335
+ mounts: collections.abc.Collection[modal.mount.Mount] = (),
336
+ network_file_systems: dict[
337
+ typing.Union[str, pathlib.PurePosixPath], modal.network_file_system.NetworkFileSystem
338
+ ] = {},
339
+ allow_cross_region_volumes: bool = False,
340
+ volumes: dict[
341
+ typing.Union[str, pathlib.PurePosixPath],
342
+ typing.Union[modal.volume.Volume, modal.cloud_bucket_mount.CloudBucketMount],
343
+ ] = {},
344
+ webhook_config: typing.Optional[modal_proto.api_pb2.WebhookConfig] = None,
345
+ memory: typing.Union[int, tuple[int, int], None] = None,
346
+ proxy: typing.Optional[modal.proxy.Proxy] = None,
347
+ retries: typing.Union[int, modal.retries.Retries, None] = None,
348
+ timeout: typing.Optional[int] = None,
349
+ concurrency_limit: typing.Optional[int] = None,
350
+ allow_concurrent_inputs: typing.Optional[int] = None,
351
+ batch_max_size: typing.Optional[int] = None,
352
+ batch_wait_ms: typing.Optional[int] = None,
353
+ container_idle_timeout: typing.Optional[int] = None,
354
+ cpu: typing.Union[float, tuple[float, float], None] = None,
355
+ keep_warm: typing.Optional[int] = None,
356
+ cloud: typing.Optional[str] = None,
357
+ scheduler_placement: typing.Optional[modal.scheduler_placement.SchedulerPlacement] = None,
358
+ is_builder_function: bool = False,
359
+ is_auto_snapshot: bool = False,
360
+ enable_memory_snapshot: bool = False,
361
+ block_network: bool = False,
362
+ i6pn_enabled: bool = False,
363
+ cluster_size: typing.Optional[int] = None,
364
+ max_inputs: typing.Optional[int] = None,
365
+ ephemeral_disk: typing.Optional[int] = None,
366
+ _experimental_buffer_containers: typing.Optional[int] = None,
367
+ _experimental_proxy_ip: typing.Optional[str] = None,
368
+ _experimental_custom_scaling_factor: typing.Optional[float] = None,
369
+ ) -> None: ...
370
+ def _bind_parameters(
371
+ self,
372
+ obj: modal.cls.Obj,
373
+ options: typing.Optional[modal_proto.api_pb2.FunctionOptions],
374
+ args: collections.abc.Sized,
375
+ kwargs: dict[str, typing.Any],
376
+ ) -> Function: ...
283
377
 
284
378
  class __keep_warm_spec(typing_extensions.Protocol):
285
- def __call__(self, warm_pool_size: int) -> None:
286
- ...
287
-
288
- async def aio(self, *args, **kwargs) -> None:
289
- ...
379
+ def __call__(self, warm_pool_size: int) -> None: ...
380
+ async def aio(self, warm_pool_size: int) -> None: ...
290
381
 
291
382
  keep_warm: __keep_warm_spec
292
383
 
293
384
  @classmethod
294
- def from_name(cls: typing.Type[Function], app_name: str, tag: typing.Union[str, None] = None, namespace=1, environment_name: typing.Union[str, None] = None) -> Function:
295
- ...
385
+ def from_name(
386
+ cls: type[Function], app_name: str, name: str, namespace=1, environment_name: typing.Optional[str] = None
387
+ ) -> Function: ...
296
388
 
297
389
  class __lookup_spec(typing_extensions.Protocol):
298
- def __call__(self, app_name: str, tag: typing.Union[str, None] = None, namespace=1, client: typing.Union[modal.client.Client, None] = None, environment_name: typing.Union[str, None] = None) -> Function:
299
- ...
300
-
301
- async def aio(self, *args, **kwargs) -> Function:
302
- ...
390
+ def __call__(
391
+ self,
392
+ app_name: str,
393
+ name: str,
394
+ namespace=1,
395
+ client: typing.Optional[modal.client.Client] = None,
396
+ environment_name: typing.Optional[str] = None,
397
+ ) -> Function: ...
398
+ async def aio(
399
+ self,
400
+ app_name: str,
401
+ name: str,
402
+ namespace=1,
403
+ client: typing.Optional[modal.client.Client] = None,
404
+ environment_name: typing.Optional[str] = None,
405
+ ) -> Function: ...
303
406
 
304
407
  lookup: __lookup_spec
305
408
 
306
409
  @property
307
- def tag(self) -> str:
308
- ...
309
-
410
+ def tag(self) -> str: ...
310
411
  @property
311
- def stub(self) -> modal.stub.Stub:
312
- ...
313
-
412
+ def app(self) -> modal.app.App: ...
314
413
  @property
315
- def info(self) -> modal._utils.function_utils.FunctionInfo:
316
- ...
317
-
414
+ def stub(self) -> modal.app.App: ...
318
415
  @property
319
- def env(self) -> FunctionEnv:
320
- ...
321
-
322
- def get_build_def(self) -> str:
323
- ...
324
-
325
- def _initialize_from_empty(self):
326
- ...
327
-
328
- def _hydrate_metadata(self, metadata: typing.Union[google.protobuf.message.Message, None]):
329
- ...
330
-
331
- def _get_metadata(self):
332
- ...
333
-
334
- def _set_mute_cancellation(self, value: bool = True):
335
- ...
336
-
337
- def _set_output_mgr(self, output_mgr: modal._output.OutputManager):
338
- ...
339
-
416
+ def info(self) -> modal._utils.function_utils.FunctionInfo: ...
340
417
  @property
341
- def web_url(self) -> str:
342
- ...
343
-
418
+ def spec(self) -> _FunctionSpec: ...
419
+ def get_build_def(self) -> str: ...
420
+ def _initialize_from_empty(self): ...
421
+ def _hydrate_metadata(self, metadata: typing.Optional[google.protobuf.message.Message]): ...
422
+ def _get_metadata(self): ...
423
+ def _check_no_web_url(self, fn_name: str): ...
424
+ @property
425
+ def web_url(self) -> str: ...
426
+ @property
427
+ def is_generator(self) -> bool: ...
344
428
  @property
345
- def is_generator(self) -> bool:
346
- ...
429
+ def cluster_size(self) -> int: ...
347
430
 
348
431
  class ___map_spec(typing_extensions.Protocol):
349
- def __call__(self, input_stream: typing.Iterable[typing.Any], order_outputs: bool, return_exceptions: bool, kwargs={}):
350
- ...
351
-
352
- def aio(self, input_stream: typing.AsyncIterable[typing.Any], order_outputs: bool, return_exceptions: bool, kwargs={}):
353
- ...
432
+ def __call__(
433
+ self, input_queue: modal.parallel_map.SynchronizedQueue, order_outputs: bool, return_exceptions: bool
434
+ ) -> typing.Generator[typing.Any, None, None]: ...
435
+ def aio(
436
+ self, input_queue: modal.parallel_map.SynchronizedQueue, order_outputs: bool, return_exceptions: bool
437
+ ) -> collections.abc.AsyncGenerator[typing.Any, None]: ...
354
438
 
355
439
  _map: ___map_spec
356
440
 
357
- class ___call_function_spec(typing_extensions.Protocol):
358
- def __call__(self, args, kwargs):
359
- ...
360
-
361
- async def aio(self, *args, **kwargs):
362
- ...
441
+ class ___call_function_spec(typing_extensions.Protocol[ReturnType_INNER]):
442
+ def __call__(self, args, kwargs) -> ReturnType_INNER: ...
443
+ async def aio(self, args, kwargs) -> ReturnType_INNER: ...
363
444
 
364
- _call_function: ___call_function_spec
445
+ _call_function: ___call_function_spec[ReturnType]
365
446
 
366
447
  class ___call_function_nowait_spec(typing_extensions.Protocol):
367
- def __call__(self, args, kwargs) -> _Invocation:
368
- ...
369
-
370
- async def aio(self, *args, **kwargs) -> _Invocation:
371
- ...
448
+ def __call__(self, args, kwargs, function_call_invocation_type: int) -> _Invocation: ...
449
+ async def aio(self, args, kwargs, function_call_invocation_type: int) -> _Invocation: ...
372
450
 
373
451
  _call_function_nowait: ___call_function_nowait_spec
374
452
 
375
- def _call_generator(self, args, kwargs):
376
- ...
453
+ class ___call_generator_spec(typing_extensions.Protocol):
454
+ def __call__(self, args, kwargs): ...
455
+ def aio(self, args, kwargs): ...
377
456
 
378
- class ___call_generator_nowait_spec(typing_extensions.Protocol):
379
- def __call__(self, args, kwargs):
380
- ...
457
+ _call_generator: ___call_generator_spec
381
458
 
382
- async def aio(self, *args, **kwargs):
383
- ...
459
+ class ___call_generator_nowait_spec(typing_extensions.Protocol):
460
+ def __call__(self, args, kwargs): ...
461
+ async def aio(self, args, kwargs): ...
384
462
 
385
463
  _call_generator_nowait: ___call_generator_nowait_spec
386
464
 
387
- class __map_spec(typing_extensions.Protocol):
388
- def __call__(self, *input_iterators, kwargs={}, order_outputs: bool = True, return_exceptions: bool = False) -> typing.Generator[typing.Any, None, None]:
389
- ...
390
-
391
- def aio(self, *input_iterators, kwargs={}, order_outputs: bool = True, return_exceptions: bool = False) -> typing.AsyncGenerator[typing.Any, None]:
392
- ...
465
+ class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
466
+ def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
467
+ async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
393
468
 
394
- map: __map_spec
395
-
396
- class __for_each_spec(typing_extensions.Protocol):
397
- def __call__(self, *input_iterators, kwargs={}, ignore_exceptions: bool = False):
398
- ...
399
-
400
- async def aio(self, *args, **kwargs):
401
- ...
402
-
403
- for_each: __for_each_spec
404
-
405
- class __starmap_spec(typing_extensions.Protocol):
406
- def __call__(self, input_iterator, kwargs={}, order_outputs: bool = True, return_exceptions: bool = False) -> typing.Generator[typing.Any, None, None]:
407
- ...
408
-
409
- def aio(self, input_iterator, kwargs={}, order_outputs: bool = True, return_exceptions: bool = False) -> typing.AsyncGenerator[typing.Any, None]:
410
- ...
411
-
412
- starmap: __starmap_spec
413
-
414
- class __remote_spec(typing_extensions.Protocol):
415
- def __call__(self, *args, **kwargs) -> typing.Any:
416
- ...
417
-
418
- async def aio(self, *args, **kwargs) -> typing.Any:
419
- ...
420
-
421
- remote: __remote_spec
469
+ remote: __remote_spec[ReturnType, P]
422
470
 
423
471
  class __remote_gen_spec(typing_extensions.Protocol):
424
- def __call__(self, *args, **kwargs) -> typing.Generator[typing.Any, None, None]:
425
- ...
426
-
427
- def aio(self, *args, **kwargs) -> typing.AsyncGenerator[typing.Any, None]:
428
- ...
472
+ def __call__(self, *args, **kwargs) -> typing.Generator[typing.Any, None, None]: ...
473
+ def aio(self, *args, **kwargs) -> collections.abc.AsyncGenerator[typing.Any, None]: ...
429
474
 
430
475
  remote_gen: __remote_gen_spec
431
476
 
432
- class __shell_spec(typing_extensions.Protocol):
433
- def __call__(self, *args, **kwargs) -> None:
434
- ...
435
-
436
- async def aio(self, *args, **kwargs) -> None:
437
- ...
438
-
439
- shell: __shell_spec
440
-
441
- def _get_is_remote_cls_method(self):
442
- ...
443
-
444
- def _get_info(self):
445
- ...
477
+ def _is_local(self): ...
478
+ def _get_info(self) -> modal._utils.function_utils.FunctionInfo: ...
479
+ def _get_obj(self) -> typing.Optional[modal.cls.Obj]: ...
480
+ def local(self, *args: P.args, **kwargs: P.kwargs) -> OriginalReturnType: ...
446
481
 
447
- def _get_obj(self):
448
- ...
482
+ class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
483
+ def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
484
+ async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
449
485
 
450
- def local(self, *args, **kwargs) -> typing.Any:
451
- ...
486
+ _experimental_spawn: ___experimental_spawn_spec[ReturnType, P]
452
487
 
453
- class __spawn_spec(typing_extensions.Protocol):
454
- def __call__(self, *args, **kwargs) -> typing.Union[FunctionCall, None]:
455
- ...
488
+ class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
489
+ def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
490
+ async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
456
491
 
457
- async def aio(self, *args, **kwargs) -> typing.Union[FunctionCall, None]:
458
- ...
492
+ spawn: __spawn_spec[ReturnType, P]
459
493
 
460
- spawn: __spawn_spec
461
-
462
- def get_raw_f(self) -> typing.Callable[..., typing.Any]:
463
- ...
494
+ def get_raw_f(self) -> typing.Callable[..., typing.Any]: ...
464
495
 
465
496
  class __get_current_stats_spec(typing_extensions.Protocol):
466
- def __call__(self) -> FunctionStats:
467
- ...
468
-
469
- async def aio(self, *args, **kwargs) -> FunctionStats:
470
- ...
497
+ def __call__(self) -> FunctionStats: ...
498
+ async def aio(self) -> FunctionStats: ...
471
499
 
472
500
  get_current_stats: __get_current_stats_spec
473
501
 
502
+ class __map_spec(typing_extensions.Protocol):
503
+ def __call__(
504
+ self, *input_iterators, kwargs={}, order_outputs: bool = True, return_exceptions: bool = False
505
+ ) -> modal._utils.async_utils.AsyncOrSyncIterable: ...
506
+ def aio(
507
+ self,
508
+ *input_iterators: typing.Union[typing.Iterable[typing.Any], typing.AsyncIterable[typing.Any]],
509
+ kwargs={},
510
+ order_outputs: bool = True,
511
+ return_exceptions: bool = False,
512
+ ) -> typing.AsyncGenerator[typing.Any, None]: ...
513
+
514
+ map: __map_spec
515
+
516
+ class __starmap_spec(typing_extensions.Protocol):
517
+ def __call__(
518
+ self,
519
+ input_iterator: typing.Iterable[typing.Sequence[typing.Any]],
520
+ kwargs={},
521
+ order_outputs: bool = True,
522
+ return_exceptions: bool = False,
523
+ ) -> modal._utils.async_utils.AsyncOrSyncIterable: ...
524
+ def aio(
525
+ self,
526
+ input_iterator: typing.Union[
527
+ typing.Iterable[typing.Sequence[typing.Any]], typing.AsyncIterable[typing.Sequence[typing.Any]]
528
+ ],
529
+ kwargs={},
530
+ order_outputs: bool = True,
531
+ return_exceptions: bool = False,
532
+ ) -> typing.AsyncIterable[typing.Any]: ...
474
533
 
475
- class _FunctionCall(modal.object._Object):
476
- def _invocation(self):
477
- ...
534
+ starmap: __starmap_spec
478
535
 
479
- async def get(self, timeout: typing.Union[float, None] = None):
480
- ...
536
+ class __for_each_spec(typing_extensions.Protocol):
537
+ def __call__(self, *input_iterators, kwargs={}, ignore_exceptions: bool = False): ...
538
+ async def aio(self, *input_iterators, kwargs={}, ignore_exceptions: bool = False): ...
481
539
 
482
- async def get_call_graph(self) -> typing.List[modal.call_graph.InputInfo]:
483
- ...
540
+ for_each: __for_each_spec
484
541
 
485
- async def cancel(self):
486
- ...
542
+ class _FunctionCall(typing.Generic[ReturnType], modal.object._Object):
543
+ _is_generator: bool
487
544
 
545
+ def _invocation(self): ...
546
+ async def get(self, timeout: typing.Optional[float] = None) -> ReturnType: ...
547
+ def get_gen(self) -> collections.abc.AsyncGenerator[typing.Any, None]: ...
548
+ async def get_call_graph(self) -> list[modal.call_graph.InputInfo]: ...
549
+ async def cancel(self, terminate_containers: bool = False): ...
488
550
  @staticmethod
489
- async def from_id(function_call_id: str, client: typing.Union[modal.client._Client, None] = None) -> _FunctionCall:
490
- ...
551
+ async def from_id(
552
+ function_call_id: str, client: typing.Optional[modal.client._Client] = None, is_generator: bool = False
553
+ ) -> _FunctionCall: ...
491
554
 
555
+ class FunctionCall(typing.Generic[ReturnType], modal.object.Object):
556
+ _is_generator: bool
492
557
 
493
- class FunctionCall(modal.object.Object):
494
- def __init__(self, *args, **kwargs):
495
- ...
558
+ def __init__(self, *args, **kwargs): ...
559
+ def _invocation(self): ...
496
560
 
497
- def _invocation(self):
498
- ...
561
+ class __get_spec(typing_extensions.Protocol[ReturnType_INNER]):
562
+ def __call__(self, timeout: typing.Optional[float] = None) -> ReturnType_INNER: ...
563
+ async def aio(self, timeout: typing.Optional[float] = None) -> ReturnType_INNER: ...
499
564
 
500
- class __get_spec(typing_extensions.Protocol):
501
- def __call__(self, timeout: typing.Union[float, None] = None):
502
- ...
565
+ get: __get_spec[ReturnType]
503
566
 
504
- async def aio(self, *args, **kwargs):
505
- ...
567
+ class __get_gen_spec(typing_extensions.Protocol):
568
+ def __call__(self) -> typing.Generator[typing.Any, None, None]: ...
569
+ def aio(self) -> collections.abc.AsyncGenerator[typing.Any, None]: ...
506
570
 
507
- get: __get_spec
571
+ get_gen: __get_gen_spec
508
572
 
509
573
  class __get_call_graph_spec(typing_extensions.Protocol):
510
- def __call__(self) -> typing.List[modal.call_graph.InputInfo]:
511
- ...
512
-
513
- async def aio(self, *args, **kwargs) -> typing.List[modal.call_graph.InputInfo]:
514
- ...
574
+ def __call__(self) -> list[modal.call_graph.InputInfo]: ...
575
+ async def aio(self) -> list[modal.call_graph.InputInfo]: ...
515
576
 
516
577
  get_call_graph: __get_call_graph_spec
517
578
 
518
579
  class __cancel_spec(typing_extensions.Protocol):
519
- def __call__(self):
520
- ...
521
-
522
- async def aio(self, *args, **kwargs):
523
- ...
580
+ def __call__(self, terminate_containers: bool = False): ...
581
+ async def aio(self, terminate_containers: bool = False): ...
524
582
 
525
583
  cancel: __cancel_spec
526
584
 
527
585
  class __from_id_spec(typing_extensions.Protocol):
528
- def __call__(self, function_call_id: str, client: typing.Union[modal.client.Client, None] = None) -> FunctionCall:
529
- ...
530
-
531
- async def aio(self, *args, **kwargs) -> FunctionCall:
532
- ...
586
+ def __call__(
587
+ self, function_call_id: str, client: typing.Optional[modal.client.Client] = None, is_generator: bool = False
588
+ ) -> FunctionCall: ...
589
+ async def aio(
590
+ self, function_call_id: str, client: typing.Optional[modal.client.Client] = None, is_generator: bool = False
591
+ ) -> FunctionCall: ...
533
592
 
534
593
  from_id: __from_id_spec
535
594
 
536
-
537
- async def _gather(*function_calls: _FunctionCall):
538
- ...
539
-
595
+ async def _gather(*function_calls: _FunctionCall[ReturnType]) -> typing.Sequence[ReturnType]: ...
540
596
 
541
597
  class __gather_spec(typing_extensions.Protocol):
542
- def __call__(self, *function_calls: FunctionCall):
543
- ...
544
-
545
- async def aio(self, *args, **kwargs):
546
- ...
598
+ def __call__(self, *function_calls: FunctionCall[ReturnType]) -> typing.Sequence[ReturnType]: ...
599
+ async def aio(self, *function_calls: FunctionCall[ReturnType]) -> typing.Sequence[ReturnType]: ...
547
600
 
548
601
  gather: __gather_spec
549
-
550
-
551
- def current_input_id() -> typing.Union[str, None]:
552
- ...
553
-
554
-
555
- def current_function_call_id() -> typing.Union[str, None]:
556
- ...
557
-
558
-
559
- def _set_current_context_ids(input_id: str, function_call_id: str) -> typing.Callable[[], None]:
560
- ...
561
-
562
-
563
- _current_input_id: _contextvars.ContextVar
564
-
565
- _current_function_call_id: _contextvars.ContextVar