modAL 1.3.1.dev2__py3-none-any.whl → 1.3.1.dev3__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.
@@ -4,7 +4,6 @@ import dataclasses
4
4
  import hashlib
5
5
  import os
6
6
  import platform
7
- import random
8
7
  import time
9
8
  from collections.abc import AsyncIterator
10
9
  from contextlib import AbstractContextManager, contextmanager
@@ -58,10 +57,8 @@ MULTIPART_UPLOAD_THRESHOLD = 1024**3
58
57
  # For block based storage like volumefs2: the size of a block
59
58
  BLOCK_SIZE: int = 8 * 1024 * 1024
60
59
 
61
- HEALTHY_R2_UPLOAD_PERCENTAGE = 0.95
62
60
 
63
-
64
- @retry(n_attempts=5, base_delay=0.5, timeout=None)
61
+ @retry(n_attempts=3, base_delay=0.3, timeout=None)
65
62
  async def _upload_to_s3_url(
66
63
  upload_url,
67
64
  payload: "BytesIOSegmentPayload",
@@ -191,13 +188,10 @@ def get_content_length(data: BinaryIO) -> int:
191
188
  async def _blob_upload_with_fallback(
192
189
  items, blob_ids: list[str], callback, content_length: int
193
190
  ) -> tuple[str, bool, int]:
191
+ """Try uploading to each provider in order, with fallback on failure."""
194
192
  r2_throughput_bytes_s = 0
195
193
  r2_failed = False
196
194
  for idx, (item, blob_id) in enumerate(zip(items, blob_ids)):
197
- # We want to default to R2 95% of the time and S3 5% of the time.
198
- # To ensure the failure path is continuously exercised.
199
- if idx == 0 and len(items) > 1 and random.random() > HEALTHY_R2_UPLOAD_PERCENTAGE:
200
- continue
201
195
  try:
202
196
  if blob_id.endswith(":r2"):
203
197
  t0 = time.monotonic_ns()
@@ -207,7 +201,7 @@ async def _blob_upload_with_fallback(
207
201
  else:
208
202
  await callback(item)
209
203
  return blob_id, r2_failed, r2_throughput_bytes_s
210
- except Exception as _:
204
+ except Exception:
211
205
  if blob_id.endswith(":r2"):
212
206
  r2_failed = True
213
207
  # Ignore all errors except the last one, since we're out of fallback options.
modal/client.pyi CHANGED
@@ -33,7 +33,7 @@ class _Client:
33
33
  server_url: str,
34
34
  client_type: int,
35
35
  credentials: typing.Optional[tuple[str, str]],
36
- version: str = "1.3.1.dev2",
36
+ version: str = "1.3.1.dev3",
37
37
  ):
38
38
  """mdmd:hidden
39
39
  The Modal client object is not intended to be instantiated directly by users.
@@ -163,7 +163,7 @@ class Client:
163
163
  server_url: str,
164
164
  client_type: int,
165
165
  credentials: typing.Optional[tuple[str, str]],
166
- version: str = "1.3.1.dev2",
166
+ version: str = "1.3.1.dev3",
167
167
  ):
168
168
  """mdmd:hidden
169
169
  The Modal client object is not intended to be instantiated directly by users.
modal/functions.pyi CHANGED
@@ -407,7 +407,7 @@ class Function(
407
407
 
408
408
  _call_generator: ___call_generator_spec
409
409
 
410
- class __remote_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
410
+ class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
411
411
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER:
412
412
  """Calls the function remotely, executing it with the given arguments and returning the execution's result."""
413
413
  ...
@@ -416,7 +416,7 @@ class Function(
416
416
  """Calls the function remotely, executing it with the given arguments and returning the execution's result."""
417
417
  ...
418
418
 
419
- remote: __remote_spec[modal._functions.P, modal._functions.ReturnType]
419
+ remote: __remote_spec[modal._functions.ReturnType, modal._functions.P]
420
420
 
421
421
  class __remote_gen_spec(typing_extensions.Protocol):
422
422
  def __call__(self, /, *args, **kwargs) -> typing.Generator[typing.Any, None, None]:
@@ -443,7 +443,7 @@ class Function(
443
443
  """
444
444
  ...
445
445
 
446
- class ___experimental_spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
446
+ class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
447
447
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
448
448
  """[Experimental] Calls the function with the given arguments, without waiting for the results.
449
449
 
@@ -466,7 +466,7 @@ class Function(
466
466
  """
467
467
  ...
468
468
 
469
- _experimental_spawn: ___experimental_spawn_spec[modal._functions.P, modal._functions.ReturnType]
469
+ _experimental_spawn: ___experimental_spawn_spec[modal._functions.ReturnType, modal._functions.P]
470
470
 
471
471
  class ___spawn_map_inner_spec(typing_extensions.Protocol[P_INNER]):
472
472
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> None: ...
@@ -474,7 +474,7 @@ class Function(
474
474
 
475
475
  _spawn_map_inner: ___spawn_map_inner_spec[modal._functions.P]
476
476
 
477
- class __spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
477
+ class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
478
478
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
479
479
  """Calls the function with the given arguments, without waiting for the results.
480
480
 
@@ -495,7 +495,7 @@ class Function(
495
495
  """
496
496
  ...
497
497
 
498
- spawn: __spawn_spec[modal._functions.P, modal._functions.ReturnType]
498
+ spawn: __spawn_spec[modal._functions.ReturnType, modal._functions.P]
499
499
 
500
500
  def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]:
501
501
  """Return the inner Python object wrapped by this Modal Function."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 1.3.1.dev2
3
+ Version: 1.3.1.dev3
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License: Apache-2.0
@@ -26,7 +26,7 @@ modal/app.pyi,sha256=WR0nGSUh8-8OYRHFqEnijGoPp_IbawNY1JW_0pozXsE,50857
26
26
  modal/billing.py,sha256=zmQ3bcCJlwa4KD1IA_QgdWpm1pn13c-7qfy79iEauYI,195
27
27
  modal/call_graph.py,sha256=1g2DGcMIJvRy-xKicuf63IVE98gJSnQsr8R_NVMptNc,2581
28
28
  modal/client.py,sha256=CXnyJYLhY--xaCkjv3tpjYDca8AuXGQG1IiaXQVX4y4,14436
29
- modal/client.pyi,sha256=zCGUF3RioFCBkCy14L6a3gZ8kvoucamb3bKgVijBo98,14471
29
+ modal/client.pyi,sha256=sKu4ntyow0FACrqj2l6yYw6p090ERM17bhoAmUOpbqY,14471
30
30
  modal/cloud_bucket_mount.py,sha256=cvVj5Rt4nDHoQbTneoJPTaAcnl_Ab_mrsjnnzd0v9OI,6013
31
31
  modal/cloud_bucket_mount.pyi,sha256=vXusGMOUk9HjCs4lhxteuCK4xLQclPfugGWKo7LECEA,7539
32
32
  modal/cls.py,sha256=Cmqt1vOw0-01ktjJBOrdzvdyDbHpjKMTaZ2eEy_8YUE,41694
@@ -43,7 +43,7 @@ modal/file_io.py,sha256=dx90C5L8cQv2Z7pVVPaQmE0R3pUOGv2h-wn1qNNXbGQ,19818
43
43
  modal/file_io.pyi,sha256=up9OhV2Y54n-X7nlfV6j_eBwJ8D2cNMEswZ1iddrEQw,15877
44
44
  modal/file_pattern_matcher.py,sha256=A_Kdkej6q7YQyhM_2-BvpFmPqJ0oHb54B6yf9VqvPVE,8116
45
45
  modal/functions.py,sha256=kcNHvqeGBxPI7Cgd57NIBBghkfbeFJzXO44WW0jSmao,325
46
- modal/functions.pyi,sha256=fDH5yZSKq_uUrcze_zwWWZyxSCeEI1PfGlGOqCutCTY,36465
46
+ modal/functions.pyi,sha256=fkjxeYAqh6sX9C84gjUGoLVgHT1IfNB_07h0fpmIyWw,36465
47
47
  modal/gpu.py,sha256=Fe5ORvVPDIstSq1xjmM6OoNgLYFWvogP9r5BgmD3hYg,6769
48
48
  modal/image.py,sha256=sPaYxx4Dwdod1FjVooDaDDcPbcyyBXY4ChpbQvWe5mc,108197
49
49
  modal/image.pyi,sha256=UMwAaYu4feSDzJS9l-5xKYP_yaJm18bY_s3pREOQF6A,78249
@@ -98,7 +98,7 @@ modal/_utils/__init__.py,sha256=waLjl5c6IPDhSsdWAm9Bji4e2PVxamYABKAze6CHVXY,28
98
98
  modal/_utils/app_utils.py,sha256=88BT4TPLWfYAQwKTHcyzNQRHg8n9B-QE2UyJs96iV-0,108
99
99
  modal/_utils/async_utils.py,sha256=2KQs7W2OwU6-5wxCoYbkt8_sLocDDQSyyBbb1gulZ20,43322
100
100
  modal/_utils/auth_token_manager.py,sha256=QsDokl1c1dN9m6Z9N-Se-8cY3laphByjJtNdRXUTieI,5151
101
- modal/_utils/blob_utils.py,sha256=L4lEL-rvZwoxCxrGaa8zWVoaHjhq1eQfO4SLrvt4g8k,23376
101
+ modal/_utils/blob_utils.py,sha256=LIWNN7w0ma5IG1rP3gaOrn6YKcGTXMbI1_rSpJay8pY,23147
102
102
  modal/_utils/bytes_io_segment_payload.py,sha256=vaXPq8b52-x6G2hwE7SrjS58pg_aRm7gV3bn3yjmTzQ,4261
103
103
  modal/_utils/deprecation.py,sha256=-Bgg7jZdcJU8lROy18YyVnQYbM8hue-hVmwJqlWAGH0,5504
104
104
  modal/_utils/docker_utils.py,sha256=h1uETghR40mp_y3fSWuZAfbIASH1HMzuphJHghAL6DU,3722
@@ -158,7 +158,7 @@ modal/experimental/__init__.py,sha256=GOuo3t4-Le0ZVddiHIOw0MQxkdTJge-bVbhDvgnblm
158
158
  modal/experimental/flash.py,sha256=GJZwSr-4OHlP6gCIZdcbsSb8D8WX9xJwMphjwcfsRoU,31262
159
159
  modal/experimental/flash.pyi,sha256=W62a0AhmLUuH9a0n8Y3-DYhyEEFH3-bRUQFphOQfKHg,16418
160
160
  modal/experimental/ipython.py,sha256=TrCfmol9LGsRZMeDoeMPx3Hv3BFqQhYnmD_iH0pqdhk,2904
161
- modal-1.3.1.dev2.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
161
+ modal-1.3.1.dev3.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
162
162
  modal_docs/__init__.py,sha256=svYKtV8HDwDCN86zbdWqyq5T8sMdGDj0PVlzc2tIxDM,28
163
163
  modal_docs/gen_cli_docs.py,sha256=c1yfBS_x--gL5bs0N4ihMwqwX8l3IBWSkBAKNNIi6bQ,3801
164
164
  modal_docs/gen_reference_docs.py,sha256=d_CQUGQ0rfw28u75I2mov9AlS773z9rG40-yq5o7g2U,6359
@@ -180,10 +180,10 @@ modal_proto/task_command_router_pb2.py,sha256=2Y8wRvnq4_7RiQ-5ZAPIgXaxrHv_MXzgS5
180
180
  modal_proto/task_command_router_pb2.pyi,sha256=yI4tFteErLlonFA2HyaWtONfhY_VGSe7KCWFIspvmkE,16323
181
181
  modal_proto/task_command_router_pb2_grpc.py,sha256=q2VWfK2-4uDcPaPLhAqPZkgxhuQRYnWmwUcnEbPbGuk,13895
182
182
  modal_proto/task_command_router_pb2_grpc.pyi,sha256=e1MM10VGUgDkm041v53QeTglGQPzTpA0FUsFtezjp74,4536
183
- modal_version/__init__.py,sha256=0AlO5a1cQL-5pwDpK4XlTfcYD1BbP5voNFZ8DMSnYK0,120
183
+ modal_version/__init__.py,sha256=YDEG4SY8OnJlrF85zvT5ZHhL5Mzsn40Zhd6PjR3IB50,120
184
184
  modal_version/__main__.py,sha256=nLUbubxKx7GXNzJIkTB7M7_u8080LyLM0IS0rzFkC_c,119
185
- modal-1.3.1.dev2.dist-info/METADATA,sha256=z3ClS3lEdrOLP9XxGEtKPgQGakMVOWEp2S1YcG9uCv8,2492
186
- modal-1.3.1.dev2.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
187
- modal-1.3.1.dev2.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
188
- modal-1.3.1.dev2.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
189
- modal-1.3.1.dev2.dist-info/RECORD,,
185
+ modal-1.3.1.dev3.dist-info/METADATA,sha256=rhtEnE9f5Vijjx3bh-HJOcyGGCF5EzxbENSC6AbIjJE,2492
186
+ modal-1.3.1.dev3.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
187
+ modal-1.3.1.dev3.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
188
+ modal-1.3.1.dev3.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
189
+ modal-1.3.1.dev3.dist-info/RECORD,,
modal_version/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # Copyright Modal Labs 2025
2
2
  """Supplies the current version of the modal client library."""
3
3
 
4
- __version__ = "1.3.1.dev2"
4
+ __version__ = "1.3.1.dev3"