modal 0.73.2__py3-none-any.whl → 0.73.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- modal/_functions.py +1602 -0
- modal/_runtime/user_code_imports.py +1 -1
- modal/_utils/mount_utils.py +1 -1
- modal/app.py +2 -1
- modal/app.pyi +4 -3
- modal/cli/run.py +2 -1
- modal/client.pyi +2 -2
- modal/cls.py +1 -1
- modal/cls.pyi +9 -8
- modal/experimental.py +1 -1
- modal/functions.py +6 -1607
- modal/functions.pyi +30 -309
- modal/image.py +3 -3
- modal/image.pyi +2 -1
- modal/parallel_map.pyi +2 -2
- modal/partial_function.py +1 -1
- modal/partial_function.pyi +2 -1
- modal/runner.py +1 -1
- modal/runner.pyi +3 -3
- {modal-0.73.2.dist-info → modal-0.73.3.dist-info}/METADATA +2 -2
- {modal-0.73.2.dist-info → modal-0.73.3.dist-info}/RECORD +26 -25
- modal_version/_version_generated.py +1 -1
- {modal-0.73.2.dist-info → modal-0.73.3.dist-info}/LICENSE +0 -0
- {modal-0.73.2.dist-info → modal-0.73.3.dist-info}/WHEEL +0 -0
- {modal-0.73.2.dist-info → modal-0.73.3.dist-info}/entry_points.txt +0 -0
- {modal-0.73.2.dist-info → modal-0.73.3.dist-info}/top_level.txt +0 -0
modal/functions.pyi
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import collections.abc
|
2
2
|
import google.protobuf.message
|
3
|
-
import modal.
|
3
|
+
import modal._functions
|
4
4
|
import modal._utils.async_utils
|
5
5
|
import modal._utils.function_utils
|
6
6
|
import modal.app
|
@@ -22,292 +22,20 @@ import modal.scheduler_placement
|
|
22
22
|
import modal.secret
|
23
23
|
import modal.volume
|
24
24
|
import modal_proto.api_pb2
|
25
|
-
import modal_proto.modal_api_grpc
|
26
25
|
import pathlib
|
27
26
|
import typing
|
28
27
|
import typing_extensions
|
29
28
|
|
30
|
-
class _RetryContext:
|
31
|
-
function_call_invocation_type: int
|
32
|
-
retry_policy: modal_proto.api_pb2.FunctionRetryPolicy
|
33
|
-
function_call_jwt: str
|
34
|
-
input_jwt: str
|
35
|
-
input_id: str
|
36
|
-
item: modal_proto.api_pb2.FunctionPutInputsItem
|
37
|
-
|
38
|
-
def __init__(
|
39
|
-
self,
|
40
|
-
function_call_invocation_type: int,
|
41
|
-
retry_policy: modal_proto.api_pb2.FunctionRetryPolicy,
|
42
|
-
function_call_jwt: str,
|
43
|
-
input_jwt: str,
|
44
|
-
input_id: str,
|
45
|
-
item: modal_proto.api_pb2.FunctionPutInputsItem,
|
46
|
-
) -> None: ...
|
47
|
-
def __repr__(self): ...
|
48
|
-
def __eq__(self, other): ...
|
49
|
-
|
50
|
-
class _Invocation:
|
51
|
-
stub: modal_proto.modal_api_grpc.ModalClientModal
|
52
|
-
|
53
|
-
def __init__(
|
54
|
-
self,
|
55
|
-
stub: modal_proto.modal_api_grpc.ModalClientModal,
|
56
|
-
function_call_id: str,
|
57
|
-
client: modal.client._Client,
|
58
|
-
retry_context: typing.Optional[_RetryContext] = None,
|
59
|
-
): ...
|
60
|
-
@staticmethod
|
61
|
-
async def create(
|
62
|
-
function: _Function, args, kwargs, *, client: modal.client._Client, function_call_invocation_type: int
|
63
|
-
) -> _Invocation: ...
|
64
|
-
async def pop_function_call_outputs(
|
65
|
-
self, timeout: typing.Optional[float], clear_on_success: bool, input_jwts: typing.Optional[list[str]] = None
|
66
|
-
) -> modal_proto.api_pb2.FunctionGetOutputsResponse: ...
|
67
|
-
async def _retry_input(self) -> None: ...
|
68
|
-
async def _get_single_output(self, expected_jwt: typing.Optional[str] = None) -> typing.Any: ...
|
69
|
-
async def run_function(self) -> typing.Any: ...
|
70
|
-
async def poll_function(self, timeout: typing.Optional[float] = None): ...
|
71
|
-
def run_generator(self): ...
|
72
|
-
|
73
|
-
class FunctionStats:
|
74
|
-
backlog: int
|
75
|
-
num_total_runners: int
|
76
|
-
|
77
|
-
def __getattr__(self, name): ...
|
78
|
-
def __init__(self, backlog: int, num_total_runners: int) -> None: ...
|
79
|
-
def __repr__(self): ...
|
80
|
-
def __eq__(self, other): ...
|
81
|
-
def __setattr__(self, name, value): ...
|
82
|
-
def __delattr__(self, name): ...
|
83
|
-
def __hash__(self): ...
|
84
|
-
|
85
|
-
def _parse_retries(
|
86
|
-
retries: typing.Union[int, modal.retries.Retries, None], source: str = ""
|
87
|
-
) -> typing.Optional[modal_proto.api_pb2.FunctionRetryPolicy]: ...
|
88
|
-
|
89
|
-
class _FunctionSpec:
|
90
|
-
image: typing.Optional[modal.image._Image]
|
91
|
-
mounts: collections.abc.Sequence[modal.mount._Mount]
|
92
|
-
secrets: collections.abc.Sequence[modal.secret._Secret]
|
93
|
-
network_file_systems: dict[typing.Union[str, pathlib.PurePosixPath], modal.network_file_system._NetworkFileSystem]
|
94
|
-
volumes: dict[
|
95
|
-
typing.Union[str, pathlib.PurePosixPath],
|
96
|
-
typing.Union[modal.volume._Volume, modal.cloud_bucket_mount._CloudBucketMount],
|
97
|
-
]
|
98
|
-
gpus: typing.Union[None, bool, str, modal.gpu._GPUConfig, list[typing.Union[None, bool, str, modal.gpu._GPUConfig]]]
|
99
|
-
cloud: typing.Optional[str]
|
100
|
-
cpu: typing.Union[float, tuple[float, float], None]
|
101
|
-
memory: typing.Union[int, tuple[int, int], None]
|
102
|
-
ephemeral_disk: typing.Optional[int]
|
103
|
-
scheduler_placement: typing.Optional[modal.scheduler_placement.SchedulerPlacement]
|
104
|
-
proxy: typing.Optional[modal.proxy._Proxy]
|
105
|
-
|
106
|
-
def __init__(
|
107
|
-
self,
|
108
|
-
image: typing.Optional[modal.image._Image],
|
109
|
-
mounts: collections.abc.Sequence[modal.mount._Mount],
|
110
|
-
secrets: collections.abc.Sequence[modal.secret._Secret],
|
111
|
-
network_file_systems: dict[
|
112
|
-
typing.Union[str, pathlib.PurePosixPath], modal.network_file_system._NetworkFileSystem
|
113
|
-
],
|
114
|
-
volumes: dict[
|
115
|
-
typing.Union[str, pathlib.PurePosixPath],
|
116
|
-
typing.Union[modal.volume._Volume, modal.cloud_bucket_mount._CloudBucketMount],
|
117
|
-
],
|
118
|
-
gpus: typing.Union[
|
119
|
-
None, bool, str, modal.gpu._GPUConfig, list[typing.Union[None, bool, str, modal.gpu._GPUConfig]]
|
120
|
-
],
|
121
|
-
cloud: typing.Optional[str],
|
122
|
-
cpu: typing.Union[float, tuple[float, float], None],
|
123
|
-
memory: typing.Union[int, tuple[int, int], None],
|
124
|
-
ephemeral_disk: typing.Optional[int],
|
125
|
-
scheduler_placement: typing.Optional[modal.scheduler_placement.SchedulerPlacement],
|
126
|
-
proxy: typing.Optional[modal.proxy._Proxy],
|
127
|
-
) -> None: ...
|
128
|
-
def __repr__(self): ...
|
129
|
-
def __eq__(self, other): ...
|
130
|
-
|
131
|
-
P = typing_extensions.ParamSpec("P")
|
132
|
-
|
133
|
-
ReturnType = typing.TypeVar("ReturnType", covariant=True)
|
134
|
-
|
135
|
-
OriginalReturnType = typing.TypeVar("OriginalReturnType", covariant=True)
|
136
|
-
|
137
29
|
SUPERSELF = typing.TypeVar("SUPERSELF", covariant=True)
|
138
30
|
|
139
|
-
class _Function(typing.Generic[P, ReturnType, OriginalReturnType], modal._object._Object):
|
140
|
-
_info: typing.Optional[modal._utils.function_utils.FunctionInfo]
|
141
|
-
_serve_mounts: frozenset[modal.mount._Mount]
|
142
|
-
_app: typing.Optional[modal.app._App]
|
143
|
-
_obj: typing.Optional[modal.cls._Obj]
|
144
|
-
_webhook_config: typing.Optional[modal_proto.api_pb2.WebhookConfig]
|
145
|
-
_web_url: typing.Optional[str]
|
146
|
-
_function_name: typing.Optional[str]
|
147
|
-
_is_method: bool
|
148
|
-
_spec: typing.Optional[_FunctionSpec]
|
149
|
-
_tag: str
|
150
|
-
_raw_f: typing.Optional[collections.abc.Callable[..., typing.Any]]
|
151
|
-
_build_args: dict
|
152
|
-
_is_generator: typing.Optional[bool]
|
153
|
-
_cluster_size: typing.Optional[int]
|
154
|
-
_use_method_name: str
|
155
|
-
_class_parameter_info: typing.Optional[modal_proto.api_pb2.ClassParameterInfo]
|
156
|
-
_method_handle_metadata: typing.Optional[dict[str, modal_proto.api_pb2.FunctionHandleMetadata]]
|
157
|
-
|
158
|
-
def _bind_method(self, user_cls, method_name: str, partial_function: modal.partial_function._PartialFunction): ...
|
159
|
-
@staticmethod
|
160
|
-
def from_args(
|
161
|
-
info: modal._utils.function_utils.FunctionInfo,
|
162
|
-
app,
|
163
|
-
image: modal.image._Image,
|
164
|
-
secrets: collections.abc.Sequence[modal.secret._Secret] = (),
|
165
|
-
schedule: typing.Optional[modal.schedule.Schedule] = None,
|
166
|
-
is_generator: bool = False,
|
167
|
-
gpu: typing.Union[
|
168
|
-
None, bool, str, modal.gpu._GPUConfig, list[typing.Union[None, bool, str, modal.gpu._GPUConfig]]
|
169
|
-
] = None,
|
170
|
-
mounts: collections.abc.Collection[modal.mount._Mount] = (),
|
171
|
-
network_file_systems: dict[
|
172
|
-
typing.Union[str, pathlib.PurePosixPath], modal.network_file_system._NetworkFileSystem
|
173
|
-
] = {},
|
174
|
-
allow_cross_region_volumes: bool = False,
|
175
|
-
volumes: dict[
|
176
|
-
typing.Union[str, pathlib.PurePosixPath],
|
177
|
-
typing.Union[modal.volume._Volume, modal.cloud_bucket_mount._CloudBucketMount],
|
178
|
-
] = {},
|
179
|
-
webhook_config: typing.Optional[modal_proto.api_pb2.WebhookConfig] = None,
|
180
|
-
memory: typing.Union[int, tuple[int, int], None] = None,
|
181
|
-
proxy: typing.Optional[modal.proxy._Proxy] = None,
|
182
|
-
retries: typing.Union[int, modal.retries.Retries, None] = None,
|
183
|
-
timeout: typing.Optional[int] = None,
|
184
|
-
concurrency_limit: typing.Optional[int] = None,
|
185
|
-
allow_concurrent_inputs: typing.Optional[int] = None,
|
186
|
-
batch_max_size: typing.Optional[int] = None,
|
187
|
-
batch_wait_ms: typing.Optional[int] = None,
|
188
|
-
container_idle_timeout: typing.Optional[int] = None,
|
189
|
-
cpu: typing.Union[float, tuple[float, float], None] = None,
|
190
|
-
keep_warm: typing.Optional[int] = None,
|
191
|
-
cloud: typing.Optional[str] = None,
|
192
|
-
scheduler_placement: typing.Optional[modal.scheduler_placement.SchedulerPlacement] = None,
|
193
|
-
is_builder_function: bool = False,
|
194
|
-
is_auto_snapshot: bool = False,
|
195
|
-
enable_memory_snapshot: bool = False,
|
196
|
-
block_network: bool = False,
|
197
|
-
i6pn_enabled: bool = False,
|
198
|
-
cluster_size: typing.Optional[int] = None,
|
199
|
-
max_inputs: typing.Optional[int] = None,
|
200
|
-
ephemeral_disk: typing.Optional[int] = None,
|
201
|
-
include_source: typing.Optional[bool] = None,
|
202
|
-
_experimental_buffer_containers: typing.Optional[int] = None,
|
203
|
-
_experimental_proxy_ip: typing.Optional[str] = None,
|
204
|
-
_experimental_custom_scaling_factor: typing.Optional[float] = None,
|
205
|
-
) -> _Function: ...
|
206
|
-
def _bind_parameters(
|
207
|
-
self,
|
208
|
-
obj: modal.cls._Obj,
|
209
|
-
options: typing.Optional[modal_proto.api_pb2.FunctionOptions],
|
210
|
-
args: collections.abc.Sized,
|
211
|
-
kwargs: dict[str, typing.Any],
|
212
|
-
) -> _Function: ...
|
213
|
-
async def keep_warm(self, warm_pool_size: int) -> None: ...
|
214
|
-
@classmethod
|
215
|
-
def from_name(
|
216
|
-
cls: type[_Function], app_name: str, name: str, namespace=1, environment_name: typing.Optional[str] = None
|
217
|
-
) -> _Function: ...
|
218
|
-
@staticmethod
|
219
|
-
async def lookup(
|
220
|
-
app_name: str,
|
221
|
-
name: str,
|
222
|
-
namespace=1,
|
223
|
-
client: typing.Optional[modal.client._Client] = None,
|
224
|
-
environment_name: typing.Optional[str] = None,
|
225
|
-
) -> _Function: ...
|
226
|
-
@property
|
227
|
-
def tag(self) -> str: ...
|
228
|
-
@property
|
229
|
-
def app(self) -> modal.app._App: ...
|
230
|
-
@property
|
231
|
-
def stub(self) -> modal.app._App: ...
|
232
|
-
@property
|
233
|
-
def info(self) -> modal._utils.function_utils.FunctionInfo: ...
|
234
|
-
@property
|
235
|
-
def spec(self) -> _FunctionSpec: ...
|
236
|
-
def _is_web_endpoint(self) -> bool: ...
|
237
|
-
def get_build_def(self) -> str: ...
|
238
|
-
def _initialize_from_empty(self): ...
|
239
|
-
def _hydrate_metadata(self, metadata: typing.Optional[google.protobuf.message.Message]): ...
|
240
|
-
def _get_metadata(self): ...
|
241
|
-
def _check_no_web_url(self, fn_name: str): ...
|
242
|
-
@property
|
243
|
-
async def web_url(self) -> str: ...
|
244
|
-
@property
|
245
|
-
async def is_generator(self) -> bool: ...
|
246
|
-
@property
|
247
|
-
def cluster_size(self) -> int: ...
|
248
|
-
def _map(
|
249
|
-
self, input_queue: modal.parallel_map._SynchronizedQueue, order_outputs: bool, return_exceptions: bool
|
250
|
-
) -> collections.abc.AsyncGenerator[typing.Any, None]: ...
|
251
|
-
async def _call_function(self, args, kwargs) -> ReturnType: ...
|
252
|
-
async def _call_function_nowait(self, args, kwargs, function_call_invocation_type: int) -> _Invocation: ...
|
253
|
-
def _call_generator(self, args, kwargs): ...
|
254
|
-
async def _call_generator_nowait(self, args, kwargs): ...
|
255
|
-
async def remote(self, *args: P.args, **kwargs: P.kwargs) -> ReturnType: ...
|
256
|
-
def remote_gen(self, *args, **kwargs) -> collections.abc.AsyncGenerator[typing.Any, None]: ...
|
257
|
-
def _is_local(self): ...
|
258
|
-
def _get_info(self) -> modal._utils.function_utils.FunctionInfo: ...
|
259
|
-
def _get_obj(self) -> typing.Optional[modal.cls._Obj]: ...
|
260
|
-
def local(self, *args: P.args, **kwargs: P.kwargs) -> OriginalReturnType: ...
|
261
|
-
async def _experimental_spawn(self, *args: P.args, **kwargs: P.kwargs) -> _FunctionCall[ReturnType]: ...
|
262
|
-
async def spawn(self, *args: P.args, **kwargs: P.kwargs) -> _FunctionCall[ReturnType]: ...
|
263
|
-
def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]: ...
|
264
|
-
async def get_current_stats(self) -> FunctionStats: ...
|
265
|
-
|
266
|
-
class __map_spec(typing_extensions.Protocol[SUPERSELF]):
|
267
|
-
def __call__(
|
268
|
-
self, *input_iterators, kwargs={}, order_outputs: bool = True, return_exceptions: bool = False
|
269
|
-
) -> modal._utils.async_utils.AsyncOrSyncIterable: ...
|
270
|
-
def aio(
|
271
|
-
self,
|
272
|
-
*input_iterators: typing.Union[typing.Iterable[typing.Any], typing.AsyncIterable[typing.Any]],
|
273
|
-
kwargs={},
|
274
|
-
order_outputs: bool = True,
|
275
|
-
return_exceptions: bool = False,
|
276
|
-
) -> typing.AsyncGenerator[typing.Any, None]: ...
|
277
|
-
|
278
|
-
map: __map_spec[typing_extensions.Self]
|
279
|
-
|
280
|
-
class __starmap_spec(typing_extensions.Protocol[SUPERSELF]):
|
281
|
-
def __call__(
|
282
|
-
self,
|
283
|
-
input_iterator: typing.Iterable[typing.Sequence[typing.Any]],
|
284
|
-
kwargs={},
|
285
|
-
order_outputs: bool = True,
|
286
|
-
return_exceptions: bool = False,
|
287
|
-
) -> modal._utils.async_utils.AsyncOrSyncIterable: ...
|
288
|
-
def aio(
|
289
|
-
self,
|
290
|
-
input_iterator: typing.Union[
|
291
|
-
typing.Iterable[typing.Sequence[typing.Any]], typing.AsyncIterable[typing.Sequence[typing.Any]]
|
292
|
-
],
|
293
|
-
kwargs={},
|
294
|
-
order_outputs: bool = True,
|
295
|
-
return_exceptions: bool = False,
|
296
|
-
) -> typing.AsyncIterable[typing.Any]: ...
|
297
|
-
|
298
|
-
starmap: __starmap_spec[typing_extensions.Self]
|
299
|
-
|
300
|
-
class __for_each_spec(typing_extensions.Protocol[SUPERSELF]):
|
301
|
-
def __call__(self, *input_iterators, kwargs={}, ignore_exceptions: bool = False): ...
|
302
|
-
async def aio(self, *input_iterators, kwargs={}, ignore_exceptions: bool = False): ...
|
303
|
-
|
304
|
-
for_each: __for_each_spec[typing_extensions.Self]
|
305
|
-
|
306
31
|
ReturnType_INNER = typing.TypeVar("ReturnType_INNER", covariant=True)
|
307
32
|
|
308
33
|
P_INNER = typing_extensions.ParamSpec("P_INNER")
|
309
34
|
|
310
|
-
class Function(
|
35
|
+
class Function(
|
36
|
+
typing.Generic[modal._functions.P, modal._functions.ReturnType, modal._functions.OriginalReturnType],
|
37
|
+
modal.object.Object,
|
38
|
+
):
|
311
39
|
_info: typing.Optional[modal._utils.function_utils.FunctionInfo]
|
312
40
|
_serve_mounts: frozenset[modal.mount.Mount]
|
313
41
|
_app: typing.Optional[modal.app.App]
|
@@ -316,7 +44,7 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
|
|
316
44
|
_web_url: typing.Optional[str]
|
317
45
|
_function_name: typing.Optional[str]
|
318
46
|
_is_method: bool
|
319
|
-
_spec: typing.Optional[_FunctionSpec]
|
47
|
+
_spec: typing.Optional[modal._functions._FunctionSpec]
|
320
48
|
_tag: str
|
321
49
|
_raw_f: typing.Optional[collections.abc.Callable[..., typing.Any]]
|
322
50
|
_build_args: dict
|
@@ -423,7 +151,7 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
|
|
423
151
|
@property
|
424
152
|
def info(self) -> modal._utils.function_utils.FunctionInfo: ...
|
425
153
|
@property
|
426
|
-
def spec(self) -> _FunctionSpec: ...
|
154
|
+
def spec(self) -> modal._functions._FunctionSpec: ...
|
427
155
|
def _is_web_endpoint(self) -> bool: ...
|
428
156
|
def get_build_def(self) -> str: ...
|
429
157
|
def _initialize_from_empty(self): ...
|
@@ -451,11 +179,11 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
|
|
451
179
|
def __call__(self, args, kwargs) -> ReturnType_INNER: ...
|
452
180
|
async def aio(self, args, kwargs) -> ReturnType_INNER: ...
|
453
181
|
|
454
|
-
_call_function: ___call_function_spec[ReturnType, typing_extensions.Self]
|
182
|
+
_call_function: ___call_function_spec[modal._functions.ReturnType, typing_extensions.Self]
|
455
183
|
|
456
184
|
class ___call_function_nowait_spec(typing_extensions.Protocol[SUPERSELF]):
|
457
|
-
def __call__(self, args, kwargs, function_call_invocation_type: int) -> _Invocation: ...
|
458
|
-
async def aio(self, args, kwargs, function_call_invocation_type: int) -> _Invocation: ...
|
185
|
+
def __call__(self, args, kwargs, function_call_invocation_type: int) -> modal._functions._Invocation: ...
|
186
|
+
async def aio(self, args, kwargs, function_call_invocation_type: int) -> modal._functions._Invocation: ...
|
459
187
|
|
460
188
|
_call_function_nowait: ___call_function_nowait_spec[typing_extensions.Self]
|
461
189
|
|
@@ -475,7 +203,7 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
|
|
475
203
|
def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
|
476
204
|
async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
|
477
205
|
|
478
|
-
remote: __remote_spec[ReturnType, P, typing_extensions.Self]
|
206
|
+
remote: __remote_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
|
479
207
|
|
480
208
|
class __remote_gen_spec(typing_extensions.Protocol[SUPERSELF]):
|
481
209
|
def __call__(self, *args, **kwargs) -> typing.Generator[typing.Any, None, None]: ...
|
@@ -486,25 +214,29 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
|
|
486
214
|
def _is_local(self): ...
|
487
215
|
def _get_info(self) -> modal._utils.function_utils.FunctionInfo: ...
|
488
216
|
def _get_obj(self) -> typing.Optional[modal.cls.Obj]: ...
|
489
|
-
def local(
|
217
|
+
def local(
|
218
|
+
self, *args: modal._functions.P.args, **kwargs: modal._functions.P.kwargs
|
219
|
+
) -> modal._functions.OriginalReturnType: ...
|
490
220
|
|
491
221
|
class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
|
492
222
|
def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
|
493
223
|
async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
|
494
224
|
|
495
|
-
_experimental_spawn: ___experimental_spawn_spec[
|
225
|
+
_experimental_spawn: ___experimental_spawn_spec[
|
226
|
+
modal._functions.ReturnType, modal._functions.P, typing_extensions.Self
|
227
|
+
]
|
496
228
|
|
497
229
|
class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
|
498
230
|
def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
|
499
231
|
async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
|
500
232
|
|
501
|
-
spawn: __spawn_spec[ReturnType, P, typing_extensions.Self]
|
233
|
+
spawn: __spawn_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
|
502
234
|
|
503
235
|
def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]: ...
|
504
236
|
|
505
237
|
class __get_current_stats_spec(typing_extensions.Protocol[SUPERSELF]):
|
506
|
-
def __call__(self) -> FunctionStats: ...
|
507
|
-
async def aio(self) -> FunctionStats: ...
|
238
|
+
def __call__(self) -> modal._functions.FunctionStats: ...
|
239
|
+
async def aio(self) -> modal._functions.FunctionStats: ...
|
508
240
|
|
509
241
|
get_current_stats: __get_current_stats_spec[typing_extensions.Self]
|
510
242
|
|
@@ -548,20 +280,7 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
|
|
548
280
|
|
549
281
|
for_each: __for_each_spec[typing_extensions.Self]
|
550
282
|
|
551
|
-
class
|
552
|
-
_is_generator: bool
|
553
|
-
|
554
|
-
def _invocation(self): ...
|
555
|
-
async def get(self, timeout: typing.Optional[float] = None) -> ReturnType: ...
|
556
|
-
def get_gen(self) -> collections.abc.AsyncGenerator[typing.Any, None]: ...
|
557
|
-
async def get_call_graph(self) -> list[modal.call_graph.InputInfo]: ...
|
558
|
-
async def cancel(self, terminate_containers: bool = False): ...
|
559
|
-
@staticmethod
|
560
|
-
async def from_id(
|
561
|
-
function_call_id: str, client: typing.Optional[modal.client._Client] = None, is_generator: bool = False
|
562
|
-
) -> _FunctionCall: ...
|
563
|
-
|
564
|
-
class FunctionCall(typing.Generic[ReturnType], modal.object.Object):
|
283
|
+
class FunctionCall(typing.Generic[modal._functions.ReturnType], modal.object.Object):
|
565
284
|
_is_generator: bool
|
566
285
|
|
567
286
|
def __init__(self, *args, **kwargs): ...
|
@@ -571,7 +290,7 @@ class FunctionCall(typing.Generic[ReturnType], modal.object.Object):
|
|
571
290
|
def __call__(self, timeout: typing.Optional[float] = None) -> ReturnType_INNER: ...
|
572
291
|
async def aio(self, timeout: typing.Optional[float] = None) -> ReturnType_INNER: ...
|
573
292
|
|
574
|
-
get: __get_spec[ReturnType, typing_extensions.Self]
|
293
|
+
get: __get_spec[modal._functions.ReturnType, typing_extensions.Self]
|
575
294
|
|
576
295
|
class __get_gen_spec(typing_extensions.Protocol[SUPERSELF]):
|
577
296
|
def __call__(self) -> typing.Generator[typing.Any, None, None]: ...
|
@@ -594,17 +313,19 @@ class FunctionCall(typing.Generic[ReturnType], modal.object.Object):
|
|
594
313
|
class __from_id_spec(typing_extensions.Protocol):
|
595
314
|
def __call__(
|
596
315
|
self, function_call_id: str, client: typing.Optional[modal.client.Client] = None, is_generator: bool = False
|
597
|
-
) -> FunctionCall: ...
|
316
|
+
) -> FunctionCall[typing.Any]: ...
|
598
317
|
async def aio(
|
599
318
|
self, function_call_id: str, client: typing.Optional[modal.client.Client] = None, is_generator: bool = False
|
600
|
-
) -> FunctionCall: ...
|
319
|
+
) -> FunctionCall[typing.Any]: ...
|
601
320
|
|
602
321
|
from_id: __from_id_spec
|
603
322
|
|
604
|
-
async def _gather(*function_calls: _FunctionCall[ReturnType]) -> typing.Sequence[ReturnType]: ...
|
605
|
-
|
606
323
|
class __gather_spec(typing_extensions.Protocol):
|
607
|
-
def __call__(
|
608
|
-
|
324
|
+
def __call__(
|
325
|
+
self, *function_calls: FunctionCall[modal._functions.ReturnType]
|
326
|
+
) -> typing.Sequence[modal._functions.ReturnType]: ...
|
327
|
+
async def aio(
|
328
|
+
self, *function_calls: FunctionCall[modal._functions.ReturnType]
|
329
|
+
) -> typing.Sequence[modal._functions.ReturnType]: ...
|
609
330
|
|
610
331
|
gather: __gather_spec
|
modal/image.py
CHANGED
@@ -53,7 +53,7 @@ from .secret import _Secret
|
|
53
53
|
from .volume import _Volume
|
54
54
|
|
55
55
|
if typing.TYPE_CHECKING:
|
56
|
-
import modal.
|
56
|
+
import modal._functions
|
57
57
|
|
58
58
|
# This is used for both type checking and runtime validation
|
59
59
|
ImageBuilderVersion = Literal["2023.12", "2024.04", "2024.10"]
|
@@ -481,7 +481,7 @@ class _Image(_Object, type_prefix="im"):
|
|
481
481
|
dockerfile_function: Optional[Callable[[ImageBuilderVersion], DockerfileSpec]] = None,
|
482
482
|
secrets: Optional[Sequence[_Secret]] = None,
|
483
483
|
gpu_config: Optional[api_pb2.GPUConfig] = None,
|
484
|
-
build_function: Optional["modal.
|
484
|
+
build_function: Optional["modal._functions._Function"] = None,
|
485
485
|
build_function_input: Optional[api_pb2.FunctionInput] = None,
|
486
486
|
image_registry_config: Optional[_ImageRegistryConfig] = None,
|
487
487
|
context_mount_function: Optional[Callable[[], Optional[_Mount]]] = None,
|
@@ -1942,7 +1942,7 @@ class _Image(_Object, type_prefix="im"):
|
|
1942
1942
|
)
|
1943
1943
|
```
|
1944
1944
|
"""
|
1945
|
-
from .
|
1945
|
+
from ._functions import _Function
|
1946
1946
|
|
1947
1947
|
if not callable(raw_f):
|
1948
1948
|
raise InvalidError(f"Argument to Image.run_function must be a function, not {type(raw_f).__name__}.")
|
modal/image.pyi
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import collections.abc
|
2
2
|
import google.protobuf.message
|
3
|
+
import modal._functions
|
3
4
|
import modal._object
|
4
5
|
import modal.client
|
5
6
|
import modal.cloud_bucket_mount
|
@@ -102,7 +103,7 @@ class _Image(modal._object._Object):
|
|
102
103
|
] = None,
|
103
104
|
secrets: typing.Optional[collections.abc.Sequence[modal.secret._Secret]] = None,
|
104
105
|
gpu_config: typing.Optional[modal_proto.api_pb2.GPUConfig] = None,
|
105
|
-
build_function: typing.Optional[modal.
|
106
|
+
build_function: typing.Optional[modal._functions._Function] = None,
|
106
107
|
build_function_input: typing.Optional[modal_proto.api_pb2.FunctionInput] = None,
|
107
108
|
image_registry_config: typing.Optional[_ImageRegistryConfig] = None,
|
108
109
|
context_mount_function: typing.Optional[
|
modal/parallel_map.pyi
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import collections.abc
|
2
|
+
import modal._functions
|
2
3
|
import modal._utils.async_utils
|
3
4
|
import modal.client
|
4
|
-
import modal.functions
|
5
5
|
import typing
|
6
6
|
import typing_extensions
|
7
7
|
|
@@ -41,7 +41,7 @@ class _OutputValue:
|
|
41
41
|
def __eq__(self, other): ...
|
42
42
|
|
43
43
|
def _map_invocation(
|
44
|
-
function: modal.
|
44
|
+
function: modal._functions._Function,
|
45
45
|
raw_input_queue: _SynchronizedQueue,
|
46
46
|
client: modal.client._Client,
|
47
47
|
order_outputs: bool,
|
modal/partial_function.py
CHANGED
@@ -14,12 +14,12 @@ import typing_extensions
|
|
14
14
|
|
15
15
|
from modal_proto import api_pb2
|
16
16
|
|
17
|
+
from ._functions import _Function
|
17
18
|
from ._utils.async_utils import synchronize_api, synchronizer
|
18
19
|
from ._utils.deprecation import deprecation_error, deprecation_warning
|
19
20
|
from ._utils.function_utils import callable_has_non_self_non_default_params, callable_has_non_self_params
|
20
21
|
from .config import logger
|
21
22
|
from .exception import InvalidError
|
22
|
-
from .functions import _Function
|
23
23
|
|
24
24
|
MAX_MAX_BATCH_SIZE = 1000
|
25
25
|
MAX_BATCH_WAIT_MS = 10 * 60 * 1000 # 10 minutes
|
modal/partial_function.pyi
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import collections.abc
|
2
2
|
import enum
|
3
|
+
import modal._functions
|
3
4
|
import modal.functions
|
4
5
|
import modal_proto.api_pb2
|
5
6
|
import typing
|
@@ -51,7 +52,7 @@ class _PartialFunction(typing.Generic[P, ReturnType, OriginalReturnType]):
|
|
51
52
|
): ...
|
52
53
|
def _get_raw_f(self) -> collections.abc.Callable[P, ReturnType]: ...
|
53
54
|
def _is_web_endpoint(self) -> bool: ...
|
54
|
-
def __get__(self, obj, objtype=None) -> modal.
|
55
|
+
def __get__(self, obj, objtype=None) -> modal._functions._Function[P, ReturnType, OriginalReturnType]: ...
|
55
56
|
def __del__(self): ...
|
56
57
|
def add_flags(self, flags) -> _PartialFunction: ...
|
57
58
|
|
modal/runner.py
CHANGED
@@ -15,6 +15,7 @@ from synchronicity.async_wrap import asynccontextmanager
|
|
15
15
|
import modal_proto.api_pb2
|
16
16
|
from modal_proto import api_pb2
|
17
17
|
|
18
|
+
from ._functions import _Function
|
18
19
|
from ._object import _get_environment_name, _Object
|
19
20
|
from ._pty import get_pty_info
|
20
21
|
from ._resolver import Resolver
|
@@ -29,7 +30,6 @@ from .cls import _Cls
|
|
29
30
|
from .config import config, logger
|
30
31
|
from .environments import _get_environment_cached
|
31
32
|
from .exception import InteractiveTimeoutError, InvalidError, RemoteError, _CliUserExecutionError
|
32
|
-
from .functions import _Function
|
33
33
|
from .output import _get_output_manager, enable_output
|
34
34
|
from .running_app import RunningApp, running_app_from_layout
|
35
35
|
from .sandbox import _Sandbox
|
modal/runner.pyi
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
+
import modal._functions
|
1
2
|
import modal.client
|
2
3
|
import modal.cls
|
3
|
-
import modal.functions
|
4
4
|
import modal.running_app
|
5
5
|
import modal_proto.api_pb2
|
6
6
|
import multiprocessing.synchronize
|
@@ -29,7 +29,7 @@ async def _init_local_app_from_name(
|
|
29
29
|
async def _create_all_objects(
|
30
30
|
client: modal.client._Client,
|
31
31
|
running_app: modal.running_app.RunningApp,
|
32
|
-
functions: dict[str, modal.
|
32
|
+
functions: dict[str, modal._functions._Function],
|
33
33
|
classes: dict[str, modal.cls._Cls],
|
34
34
|
environment_name: str,
|
35
35
|
) -> None: ...
|
@@ -37,7 +37,7 @@ async def _publish_app(
|
|
37
37
|
client: modal.client._Client,
|
38
38
|
running_app: modal.running_app.RunningApp,
|
39
39
|
app_state: int,
|
40
|
-
functions: dict[str, modal.
|
40
|
+
functions: dict[str, modal._functions._Function],
|
41
41
|
classes: dict[str, modal.cls._Cls],
|
42
42
|
name: str = "",
|
43
43
|
tag: str = "",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: modal
|
3
|
-
Version: 0.73.
|
3
|
+
Version: 0.73.3
|
4
4
|
Summary: Python client library for Modal
|
5
5
|
Author: Modal Labs
|
6
6
|
Author-email: support@modal.com
|
@@ -21,7 +21,7 @@ Requires-Dist: fastapi
|
|
21
21
|
Requires-Dist: grpclib (==0.4.7)
|
22
22
|
Requires-Dist: protobuf (!=4.24.0,<6.0,>=3.19)
|
23
23
|
Requires-Dist: rich (>=12.0.0)
|
24
|
-
Requires-Dist: synchronicity (~=0.9.
|
24
|
+
Requires-Dist: synchronicity (~=0.9.10)
|
25
25
|
Requires-Dist: toml
|
26
26
|
Requires-Dist: typer (>=0.9)
|
27
27
|
Requires-Dist: types-certifi
|