modal 0.74.62__py3-none-any.whl → 0.75.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of modal might be problematic. Click here for more details.
- modal/_functions.py +92 -9
- modal/client.pyi +2 -2
- modal/file_pattern_matcher.py +2 -0
- modal/functions.pyi +7 -0
- modal/image.py +3 -2
- modal/mount.py +4 -4
- {modal-0.74.62.dist-info → modal-0.75.1.dist-info}/METADATA +1 -1
- {modal-0.74.62.dist-info → modal-0.75.1.dist-info}/RECORD +14 -14
- modal_version/__init__.py +1 -1
- modal_version/_version_generated.py +1 -1
- {modal-0.74.62.dist-info → modal-0.75.1.dist-info}/WHEEL +0 -0
- {modal-0.74.62.dist-info → modal-0.75.1.dist-info}/entry_points.txt +0 -0
- {modal-0.74.62.dist-info → modal-0.75.1.dist-info}/licenses/LICENSE +0 -0
- {modal-0.74.62.dist-info → modal-0.75.1.dist-info}/top_level.txt +0 -0
modal/_functions.py
CHANGED
@@ -336,6 +336,67 @@ class _Invocation:
|
|
336
336
|
break
|
337
337
|
|
338
338
|
|
339
|
+
class _InputPlaneInvocation:
|
340
|
+
"""Internal client representation of a single-input call to a Modal Function using the input
|
341
|
+
plane server API. As of 4/22/2025, this class is experimental and not used in production.
|
342
|
+
It is OK to make breaking changes to this class."""
|
343
|
+
|
344
|
+
stub: ModalClientModal
|
345
|
+
|
346
|
+
def __init__(
|
347
|
+
self,
|
348
|
+
stub: ModalClientModal,
|
349
|
+
attempt_token: str,
|
350
|
+
client: _Client,
|
351
|
+
):
|
352
|
+
self.stub = stub
|
353
|
+
self.client = client # Used by the deserializer.
|
354
|
+
self.attempt_token = attempt_token
|
355
|
+
|
356
|
+
@staticmethod
|
357
|
+
async def create(
|
358
|
+
function: "_Function",
|
359
|
+
args,
|
360
|
+
kwargs,
|
361
|
+
*,
|
362
|
+
client: _Client,
|
363
|
+
input_plane_url: str,
|
364
|
+
) -> "_InputPlaneInvocation":
|
365
|
+
stub = await client.get_stub(input_plane_url)
|
366
|
+
|
367
|
+
function_id = function.object_id
|
368
|
+
item = await _create_input(args, kwargs, stub, method_name=function._use_method_name)
|
369
|
+
|
370
|
+
request = api_pb2.AttemptStartRequest(
|
371
|
+
function_id=function_id,
|
372
|
+
parent_input_id=current_input_id() or "",
|
373
|
+
input=item,
|
374
|
+
)
|
375
|
+
response = await retry_transient_errors(stub.AttemptStart, request)
|
376
|
+
attempt_token = response.attempt_token
|
377
|
+
|
378
|
+
return _InputPlaneInvocation(stub, attempt_token, client)
|
379
|
+
|
380
|
+
async def run_function(self) -> Any:
|
381
|
+
# TODO(nathan): add retry logic
|
382
|
+
while True:
|
383
|
+
request = api_pb2.AttemptAwaitRequest(
|
384
|
+
attempt_token=self.attempt_token,
|
385
|
+
timeout_secs=OUTPUTS_TIMEOUT,
|
386
|
+
requested_at=time.time(),
|
387
|
+
)
|
388
|
+
response: api_pb2.AttemptAwaitResponse = await retry_transient_errors(
|
389
|
+
self.stub.AttemptAwait,
|
390
|
+
request,
|
391
|
+
attempt_timeout=OUTPUTS_TIMEOUT + ATTEMPT_TIMEOUT_GRACE_PERIOD,
|
392
|
+
)
|
393
|
+
|
394
|
+
if response.HasField("output"):
|
395
|
+
return await _process_result(
|
396
|
+
response.output.result, response.output.data_format, self.stub, self.client
|
397
|
+
)
|
398
|
+
|
399
|
+
|
339
400
|
# Wrapper type for api_pb2.FunctionStats
|
340
401
|
@dataclass(frozen=True)
|
341
402
|
class FunctionStats:
|
@@ -1323,6 +1384,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
1323
1384
|
self._class_parameter_info = metadata.class_parameter_info
|
1324
1385
|
self._method_handle_metadata = dict(metadata.method_handle_metadata)
|
1325
1386
|
self._definition_id = metadata.definition_id
|
1387
|
+
self._input_plane_url = metadata.input_plane_url
|
1326
1388
|
|
1327
1389
|
def _get_metadata(self):
|
1328
1390
|
# Overridden concrete implementation of base class method
|
@@ -1337,6 +1399,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
1337
1399
|
definition_id=self._definition_id,
|
1338
1400
|
method_handle_metadata=self._method_handle_metadata,
|
1339
1401
|
function_schema=self._metadata.function_schema if self._metadata else None,
|
1402
|
+
input_plane_url=self._input_plane_url
|
1340
1403
|
)
|
1341
1404
|
|
1342
1405
|
def _check_no_web_url(self, fn_name: str):
|
@@ -1351,9 +1414,19 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
1351
1414
|
@property
|
1352
1415
|
@live_method
|
1353
1416
|
async def web_url(self) -> Optional[str]:
|
1417
|
+
"""Deprecated. Use the `Function.get_web_url()` method instead.
|
1418
|
+
|
1419
|
+
URL of a Function running as a web endpoint.
|
1420
|
+
"""
|
1421
|
+
deprecation_msg = """The Function.web_url property will be removed in a future version of Modal.
|
1422
|
+
Use the `Function.get_web_url()` method instead.
|
1423
|
+
"""
|
1424
|
+
deprecation_warning((2025, 5, 6), deprecation_msg, pending=True)
|
1425
|
+
return self._web_url
|
1426
|
+
|
1427
|
+
@live_method
|
1428
|
+
async def get_web_url(self) -> Optional[str]:
|
1354
1429
|
"""URL of a Function running as a web endpoint."""
|
1355
|
-
# TODO If we remove the @live_method above, we may want to provide better feedback when the underlying
|
1356
|
-
# attribute is None because the object is not hydrated, rather than because it's not a web endpoint.
|
1357
1430
|
return self._web_url
|
1358
1431
|
|
1359
1432
|
@property
|
@@ -1408,13 +1481,23 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
1408
1481
|
yield item
|
1409
1482
|
|
1410
1483
|
async def _call_function(self, args, kwargs) -> ReturnType:
|
1411
|
-
invocation
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1484
|
+
invocation: Union[_Invocation, _InputPlaneInvocation]
|
1485
|
+
if self._input_plane_url:
|
1486
|
+
invocation = await _InputPlaneInvocation.create(
|
1487
|
+
self,
|
1488
|
+
args,
|
1489
|
+
kwargs,
|
1490
|
+
client=self.client,
|
1491
|
+
input_plane_url=self._input_plane_url,
|
1492
|
+
)
|
1493
|
+
else:
|
1494
|
+
invocation = await _Invocation.create(
|
1495
|
+
self,
|
1496
|
+
args,
|
1497
|
+
kwargs,
|
1498
|
+
client=self.client,
|
1499
|
+
function_call_invocation_type=api_pb2.FUNCTION_CALL_INVOCATION_TYPE_SYNC,
|
1500
|
+
)
|
1418
1501
|
|
1419
1502
|
return await invocation.run_function()
|
1420
1503
|
|
modal/client.pyi
CHANGED
@@ -27,7 +27,7 @@ class _Client:
|
|
27
27
|
_snapshotted: bool
|
28
28
|
|
29
29
|
def __init__(
|
30
|
-
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.
|
30
|
+
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.75.1"
|
31
31
|
): ...
|
32
32
|
def is_closed(self) -> bool: ...
|
33
33
|
@property
|
@@ -86,7 +86,7 @@ class Client:
|
|
86
86
|
_snapshotted: bool
|
87
87
|
|
88
88
|
def __init__(
|
89
|
-
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.
|
89
|
+
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.75.1"
|
90
90
|
): ...
|
91
91
|
def is_closed(self) -> bool: ...
|
92
92
|
@property
|
modal/file_pattern_matcher.py
CHANGED
@@ -94,6 +94,8 @@ class FilePatternMatcher(_AbstractPatternMatcher):
|
|
94
94
|
raise ValueError('Illegal exclusion pattern: "!"')
|
95
95
|
new_pattern.exclusion = True
|
96
96
|
pattern = pattern[1:]
|
97
|
+
if os.path.isabs(pattern):
|
98
|
+
raise ValueError("Ignore patterns cannot be absolute paths")
|
97
99
|
# In Python, we can proceed without explicit syntax checking
|
98
100
|
new_pattern.cleaned_pattern = pattern
|
99
101
|
new_pattern.dirs = pattern.split(os.path.sep)
|
modal/functions.pyi
CHANGED
@@ -186,6 +186,13 @@ class Function(
|
|
186
186
|
def _check_no_web_url(self, fn_name: str): ...
|
187
187
|
@property
|
188
188
|
def web_url(self) -> typing.Optional[str]: ...
|
189
|
+
|
190
|
+
class __get_web_url_spec(typing_extensions.Protocol[SUPERSELF]):
|
191
|
+
def __call__(self, /) -> typing.Optional[str]: ...
|
192
|
+
async def aio(self, /) -> typing.Optional[str]: ...
|
193
|
+
|
194
|
+
get_web_url: __get_web_url_spec[typing_extensions.Self]
|
195
|
+
|
189
196
|
@property
|
190
197
|
def is_generator(self) -> bool: ...
|
191
198
|
|
modal/image.py
CHANGED
@@ -279,8 +279,9 @@ def _create_context_mount(
|
|
279
279
|
include_fn = FilePatternMatcher(*copy_patterns)
|
280
280
|
|
281
281
|
def ignore_with_include(source: Path) -> bool:
|
282
|
-
|
283
|
-
|
282
|
+
if source.is_absolute():
|
283
|
+
source = source.relative_to(context_dir)
|
284
|
+
if not include_fn(source) or ignore_fn(source):
|
284
285
|
return True
|
285
286
|
|
286
287
|
return False
|
modal/mount.py
CHANGED
@@ -153,9 +153,9 @@ class _MountDir(_MountEntry):
|
|
153
153
|
|
154
154
|
for local_filename in gen:
|
155
155
|
local_path = Path(local_filename)
|
156
|
-
|
157
|
-
|
158
|
-
mount_path = self.remote_path /
|
156
|
+
rel_local_path = local_path.relative_to(local_dir)
|
157
|
+
if not self.ignore(rel_local_path):
|
158
|
+
mount_path = self.remote_path / rel_local_path.as_posix()
|
159
159
|
yield local_path.resolve(), mount_path
|
160
160
|
|
161
161
|
def watch_entry(self):
|
@@ -339,8 +339,8 @@ class _Mount(_Object, type_prefix="mo"):
|
|
339
339
|
return _Mount._new()._extend(
|
340
340
|
_MountDir(
|
341
341
|
local_dir=local_path,
|
342
|
-
ignore=ignore,
|
343
342
|
remote_path=remote_path,
|
343
|
+
ignore=ignore,
|
344
344
|
recursive=True,
|
345
345
|
),
|
346
346
|
)
|
@@ -3,7 +3,7 @@ modal/__main__.py,sha256=sTJcc9EbDuCKSwg3tL6ZckFw9WWdlkXW8mId1IvJCNc,2846
|
|
3
3
|
modal/_clustered_functions.py,sha256=kTf-9YBXY88NutC1akI-gCbvf01RhMPCw-zoOI_YIUE,2700
|
4
4
|
modal/_clustered_functions.pyi,sha256=2aWxN2v5WUnj-R-sk6BzJ-3AvggkQGQjwhtvbDH3pds,777
|
5
5
|
modal/_container_entrypoint.py,sha256=2Zx9O_EMJg0H77EdnC2vGKs6uFMWwbP1NLFf-qYmWmU,28962
|
6
|
-
modal/_functions.py,sha256=
|
6
|
+
modal/_functions.py,sha256=7Cec6Q7_ND6Ejlwn0c6Y2OufOmsg6huWqeRTZY6faYM,80527
|
7
7
|
modal/_ipython.py,sha256=TW1fkVOmZL3YYqdS2YlM1hqpf654Yf8ZyybHdBnlhSw,301
|
8
8
|
modal/_location.py,sha256=joiX-0ZeutEUDTrrqLF1GHXCdVLF-rHzstocbMcd_-k,366
|
9
9
|
modal/_object.py,sha256=6ve4sI2nRAnjPCuAXdSoUplaXfzC9MqRlF_ZLULwwy0,11472
|
@@ -22,7 +22,7 @@ modal/app.py,sha256=xojuGZv4LaQwZU5ntj7WbmMjeNuB9Gll8Mzqe2LyiEs,51323
|
|
22
22
|
modal/app.pyi,sha256=zNwR1_2LpmQc9AhemuAeVdk90XNYDw9keOkXAwAATeA,28732
|
23
23
|
modal/call_graph.py,sha256=1g2DGcMIJvRy-xKicuf63IVE98gJSnQsr8R_NVMptNc,2581
|
24
24
|
modal/client.py,sha256=o-aQThHpvDHUzg_kUafyhWzACViUBhY2WLZ2EitnSHA,16787
|
25
|
-
modal/client.pyi,sha256=
|
25
|
+
modal/client.pyi,sha256=pPWEh6maNF0V7pvpLnCRw60B_aUEpB8Au_EhJsW9C3M,8383
|
26
26
|
modal/cloud_bucket_mount.py,sha256=YOe9nnvSr4ZbeCn587d7_VhE9IioZYRvF9VYQTQux08,5914
|
27
27
|
modal/cloud_bucket_mount.pyi,sha256=30T3K1a89l6wzmEJ_J9iWv9SknoGqaZDx59Xs-ZQcmk,1607
|
28
28
|
modal/cls.py,sha256=aHoMEWMZUN7bOezs3tRPxzS1FP3gTxZBORVjbPmtxyg,35338
|
@@ -37,15 +37,15 @@ modal/environments.pyi,sha256=4HbI0kywveaUVI7HqDtZ4HphCTGXYi_wie2hz87up5A,3425
|
|
37
37
|
modal/exception.py,sha256=4JyO-SACaLNDe2QC48EjsK8GMkZ8AgEurZ8j1YdRu8E,5263
|
38
38
|
modal/file_io.py,sha256=lcMs_E9Xfm0YX1t9U2wNIBPnqHRxmImqjLW1GHqVmyg,20945
|
39
39
|
modal/file_io.pyi,sha256=oB7x-rKq7bmm8cA7Z7W9C9yeko7KK9m9i5GidFnkGK4,9569
|
40
|
-
modal/file_pattern_matcher.py,sha256=
|
40
|
+
modal/file_pattern_matcher.py,sha256=R0BChpQUXiCDUv__dWTovRMrw1iBTg0kw5p1vwOqcqk,6613
|
41
41
|
modal/functions.py,sha256=kcNHvqeGBxPI7Cgd57NIBBghkfbeFJzXO44WW0jSmao,325
|
42
|
-
modal/functions.pyi,sha256=
|
42
|
+
modal/functions.pyi,sha256=xc6igwNS77kYkyuVpWOlMPkanxriesIaKFTYlvmuXp0,16993
|
43
43
|
modal/gpu.py,sha256=Kbhs_u49FaC2Zi0TjCdrpstpRtT5eZgecynmQi5IZVE,6752
|
44
|
-
modal/image.py,sha256=
|
44
|
+
modal/image.py,sha256=lg3XxIWNYV8je88oEPbihzSEq_9gumc0NLbzZLAhm74,92807
|
45
45
|
modal/image.pyi,sha256=MDq7tNJevElK78VxFYrZRe_00kz9gPdg98MN5c6fFoE,25644
|
46
46
|
modal/io_streams.py,sha256=YDZVQSDv05DeXg5TwcucC9Rj5hQBx2GXdluan9rIUpw,15467
|
47
47
|
modal/io_streams.pyi,sha256=1UK6kWLREASQfq-wL9wSp5iqjLU0egRZPDn4LXs1PZY,5136
|
48
|
-
modal/mount.py,sha256=
|
48
|
+
modal/mount.py,sha256=lGxbu6tTEA8EdePQWYs2uu0Z3f3H_PjiXwDXOmStwrM,32674
|
49
49
|
modal/mount.pyi,sha256=PHs-N9LGSDfYWw70UrhvGZW_6uWwyx-1GAieROzCNNs,12583
|
50
50
|
modal/network_file_system.py,sha256=9_4EFTM1tKSTdwk0f4beSlWCiat6gC6ZjbsOWje07TM,14779
|
51
51
|
modal/network_file_system.pyi,sha256=58DiUqHGlARmI3cz-Yo7IFObKKFIiGh5UIU5JxGNFfc,8333
|
@@ -146,7 +146,7 @@ modal/requirements/2024.10.txt,sha256=qD-5cVIVM9wXesJ6JC89Ew-3m2KjEElUz3jaw_MddR
|
|
146
146
|
modal/requirements/PREVIEW.txt,sha256=qD-5cVIVM9wXesJ6JC89Ew-3m2KjEElUz3jaw_MddRo,296
|
147
147
|
modal/requirements/README.md,sha256=9tK76KP0Uph7O0M5oUgsSwEZDj5y-dcUPsnpR0Sc-Ik,854
|
148
148
|
modal/requirements/base-images.json,sha256=57vMSqzMbLBxw5tFWSaMiIkkVEps4JfX5PAtXGnkS4U,740
|
149
|
-
modal-0.
|
149
|
+
modal-0.75.1.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
|
150
150
|
modal_docs/__init__.py,sha256=svYKtV8HDwDCN86zbdWqyq5T8sMdGDj0PVlzc2tIxDM,28
|
151
151
|
modal_docs/gen_cli_docs.py,sha256=c1yfBS_x--gL5bs0N4ihMwqwX8l3IBWSkBAKNNIi6bQ,3801
|
152
152
|
modal_docs/gen_reference_docs.py,sha256=d_CQUGQ0rfw28u75I2mov9AlS773z9rG40-yq5o7g2U,6359
|
@@ -169,11 +169,11 @@ modal_proto/options_pb2.pyi,sha256=l7DBrbLO7q3Ir-XDkWsajm0d0TQqqrfuX54i4BMpdQg,1
|
|
169
169
|
modal_proto/options_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
|
170
170
|
modal_proto/options_pb2_grpc.pyi,sha256=CImmhxHsYnF09iENPoe8S4J-n93jtgUYD2JPAc0yJSI,247
|
171
171
|
modal_proto/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
172
|
-
modal_version/__init__.py,sha256=
|
172
|
+
modal_version/__init__.py,sha256=PenIvZdwt-HVdbetAyxuPoyZTtzx2moKZoJLK8iZ804,470
|
173
173
|
modal_version/__main__.py,sha256=2FO0yYQQwDTh6udt1h-cBnGd1c4ZyHnHSI4BksxzVac,105
|
174
|
-
modal_version/_version_generated.py,sha256=
|
175
|
-
modal-0.
|
176
|
-
modal-0.
|
177
|
-
modal-0.
|
178
|
-
modal-0.
|
179
|
-
modal-0.
|
174
|
+
modal_version/_version_generated.py,sha256=_nDSI8hGHxzdQjG0q_a6V1UkzG2U0-lDGnd-alp1KWU,148
|
175
|
+
modal-0.75.1.dist-info/METADATA,sha256=rI8s9zk_8oi-zEgq1ErtRePjGukBN2ino__FTqWzJ1E,2450
|
176
|
+
modal-0.75.1.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
|
177
|
+
modal-0.75.1.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
|
178
|
+
modal-0.75.1.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
|
179
|
+
modal-0.75.1.dist-info/RECORD,,
|
modal_version/__init__.py
CHANGED
@@ -7,7 +7,7 @@ from ._version_generated import build_number
|
|
7
7
|
major_number = 0
|
8
8
|
|
9
9
|
# Bump this manually on breaking changes, then reset the number in _version_generated.py
|
10
|
-
minor_number =
|
10
|
+
minor_number = 75
|
11
11
|
|
12
12
|
# Right now, automatically increment the patch number in CI
|
13
13
|
__version__ = f"{major_number}.{minor_number}.{max(build_number, 0)}"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|