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