modal 0.68.2__py3-none-any.whl → 0.68.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/client.pyi CHANGED
@@ -26,7 +26,7 @@ class _Client:
26
26
  _stub: typing.Optional[modal_proto.api_grpc.ModalClientStub]
27
27
 
28
28
  def __init__(
29
- self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.68.2"
29
+ self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.68.3"
30
30
  ): ...
31
31
  def is_closed(self) -> bool: ...
32
32
  @property
@@ -81,7 +81,7 @@ class Client:
81
81
  _stub: typing.Optional[modal_proto.api_grpc.ModalClientStub]
82
82
 
83
83
  def __init__(
84
- self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.68.2"
84
+ self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.68.3"
85
85
  ): ...
86
86
  def is_closed(self) -> bool: ...
87
87
  @property
modal/functions.pyi CHANGED
@@ -455,11 +455,11 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
455
455
 
456
456
  _call_generator_nowait: ___call_generator_nowait_spec
457
457
 
458
- class __remote_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
458
+ class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
459
459
  def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
460
460
  async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
461
461
 
462
- remote: __remote_spec[P, ReturnType]
462
+ remote: __remote_spec[ReturnType, P]
463
463
 
464
464
  class __remote_gen_spec(typing_extensions.Protocol):
465
465
  def __call__(self, *args, **kwargs) -> typing.Generator[typing.Any, None, None]: ...
@@ -471,17 +471,17 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
471
471
  def _get_obj(self) -> typing.Optional[modal.cls.Obj]: ...
472
472
  def local(self, *args: P.args, **kwargs: P.kwargs) -> OriginalReturnType: ...
473
473
 
474
- class ___experimental_spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
474
+ class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
475
475
  def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
476
476
  async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
477
477
 
478
- _experimental_spawn: ___experimental_spawn_spec[P, ReturnType]
478
+ _experimental_spawn: ___experimental_spawn_spec[ReturnType, P]
479
479
 
480
- class __spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
480
+ class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
481
481
  def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
482
482
  async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
483
483
 
484
- spawn: __spawn_spec[P, ReturnType]
484
+ spawn: __spawn_spec[ReturnType, P]
485
485
 
486
486
  def get_raw_f(self) -> typing.Callable[..., typing.Any]: ...
487
487
 
modal/partial_function.py CHANGED
@@ -49,7 +49,7 @@ class _PartialFunction(typing.Generic[P, ReturnType, OriginalReturnType]):
49
49
  raw_f: Callable[P, ReturnType]
50
50
  flags: _PartialFunctionFlags
51
51
  webhook_config: Optional[api_pb2.WebhookConfig]
52
- is_generator: Optional[bool]
52
+ is_generator: bool
53
53
  keep_warm: Optional[int]
54
54
  batch_max_size: Optional[int]
55
55
  batch_wait_ms: Optional[int]
@@ -73,7 +73,13 @@ class _PartialFunction(typing.Generic[P, ReturnType, OriginalReturnType]):
73
73
  self.raw_f = raw_f
74
74
  self.flags = flags
75
75
  self.webhook_config = webhook_config
76
- self.is_generator = is_generator
76
+ if is_generator is None:
77
+ # auto detect - doesn't work if the function *returns* a generator
78
+ final_is_generator = inspect.isgeneratorfunction(raw_f) or inspect.isasyncgenfunction(raw_f)
79
+ else:
80
+ final_is_generator = is_generator
81
+
82
+ self.is_generator = final_is_generator
77
83
  self.keep_warm = keep_warm
78
84
  self.wrapped = False # Make sure that this was converted into a FunctionHandle
79
85
  self.batch_max_size = batch_max_size
@@ -101,7 +107,7 @@ class _PartialFunction(typing.Generic[P, ReturnType, OriginalReturnType]):
101
107
  # This happens mainly during serialization of the wrapped underlying class of a Cls
102
108
  # since we don't have the instance info here we just return the PartialFunction itself
103
109
  # to let it be bound to a variable and become a Function later on
104
- return self
110
+ return self # type: ignore # this returns a PartialFunction in a special internal case
105
111
 
106
112
  def __del__(self):
107
113
  if (self.flags & _PartialFunctionFlags.FUNCTION) and self.wrapped is False:
@@ -154,14 +160,14 @@ def _find_partial_methods_for_user_cls(user_cls: type[Any], flags: int) -> dict[
154
160
  )
155
161
  deprecation_error((2024, 2, 21), message)
156
162
 
157
- partial_functions: dict[str, PartialFunction] = {}
163
+ partial_functions: dict[str, _PartialFunction] = {}
158
164
  for parent_cls in reversed(user_cls.mro()):
159
165
  if parent_cls is not object:
160
166
  for k, v in parent_cls.__dict__.items():
161
- if isinstance(v, PartialFunction):
162
- partial_function = synchronizer._translate_in(v) # TODO: remove need for?
163
- if partial_function.flags & flags:
164
- partial_functions[k] = partial_function
167
+ if isinstance(v, PartialFunction): # type: ignore[reportArgumentType] # synchronicity wrapper types
168
+ _partial_function: _PartialFunction = typing.cast(_PartialFunction, synchronizer._translate_in(v))
169
+ if _partial_function.flags & flags:
170
+ partial_functions[k] = _partial_function
165
171
 
166
172
  return partial_functions
167
173
 
@@ -245,8 +251,6 @@ def _method(
245
251
  "Batched function on classes should not be wrapped by `@method`. "
246
252
  "Suggestion: remove the `@method` decorator."
247
253
  )
248
- if is_generator is None:
249
- is_generator = inspect.isgeneratorfunction(raw_f) or inspect.isasyncgenfunction(raw_f)
250
254
  return _PartialFunction(raw_f, _PartialFunctionFlags.FUNCTION, is_generator=is_generator, keep_warm=keep_warm)
251
255
 
252
256
  return wrapper
@@ -28,7 +28,7 @@ class _PartialFunction(typing.Generic[P, ReturnType, OriginalReturnType]):
28
28
  raw_f: typing.Callable[P, ReturnType]
29
29
  flags: _PartialFunctionFlags
30
30
  webhook_config: typing.Optional[modal_proto.api_pb2.WebhookConfig]
31
- is_generator: typing.Optional[bool]
31
+ is_generator: bool
32
32
  keep_warm: typing.Optional[int]
33
33
  batch_max_size: typing.Optional[int]
34
34
  batch_wait_ms: typing.Optional[int]
@@ -57,7 +57,7 @@ class PartialFunction(typing.Generic[P, ReturnType, OriginalReturnType]):
57
57
  raw_f: typing.Callable[P, ReturnType]
58
58
  flags: _PartialFunctionFlags
59
59
  webhook_config: typing.Optional[modal_proto.api_pb2.WebhookConfig]
60
- is_generator: typing.Optional[bool]
60
+ is_generator: bool
61
61
  keep_warm: typing.Optional[int]
62
62
  batch_max_size: typing.Optional[int]
63
63
  batch_wait_ms: typing.Optional[int]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: modal
3
- Version: 0.68.2
3
+ Version: 0.68.3
4
4
  Summary: Python client library for Modal
5
5
  Author: Modal Labs
6
6
  Author-email: support@modal.com
@@ -19,7 +19,7 @@ modal/app.py,sha256=EJ7FUN6rWnSwLJoYJh8nmKg_t-8hdN8_rt0OrkP7JvQ,46084
19
19
  modal/app.pyi,sha256=BE5SlR5tRECuc6-e2lUuOknDdov3zxgZ4N0AsLb5ZVQ,25270
20
20
  modal/call_graph.py,sha256=1g2DGcMIJvRy-xKicuf63IVE98gJSnQsr8R_NVMptNc,2581
21
21
  modal/client.py,sha256=uy1Lw3hipt9ILv19VdmBBGYIW7VHmr4rzXi7pO7Kg7s,15791
22
- modal/client.pyi,sha256=HARg2kCIdOYmjEulbyyZJAN3F01iJPF8IiBZbqlcEFk,7352
22
+ modal/client.pyi,sha256=ROXooXOqqKCIBeZZ56okkeWrTgJ7SowtkKQzGqb4Vaw,7352
23
23
  modal/cloud_bucket_mount.py,sha256=G7T7jWLD0QkmrfKR75mSTwdUZ2xNfj7pkVqb4ipmxmI,5735
24
24
  modal/cloud_bucket_mount.pyi,sha256=CEi7vrH3kDUF4LAy4qP6tfImy2UJuFRcRbsgRNM1wo8,1403
25
25
  modal/cls.py,sha256=pMirIOmb59YzaIK2rn7Vd756E1QKDDweYT90GYIHiMk,27472
@@ -36,7 +36,7 @@ modal/experimental.py,sha256=jFuNbwrNHos47viMB9q-cHJSvf2RDxDdoEcss9plaZE,2302
36
36
  modal/file_io.py,sha256=q8s872qf6Ntdw7dPogDlpYbixxGkwCA0BlQn2UUoVhY,14637
37
37
  modal/file_io.pyi,sha256=pfkmJiaBpMCZReE6-KCjYOzB1dVtyYDYokJoYX8ARK4,6932
38
38
  modal/functions.py,sha256=Z2g1CuDTz_491ReOJKs66qGlodPDpKAiKHVwARL2zYA,66792
39
- modal/functions.pyi,sha256=IyuM9TV79JfrtfTaJ4yq3EcWp3yHuxLavpxTOwSWEDw,24988
39
+ modal/functions.pyi,sha256=4k5CaJ9iTuEyHQ2rC5OysNHBLv1CZrD7zBMU1zXIU4w,24988
40
40
  modal/gpu.py,sha256=r4rL6uH3UJIQthzYvfWauXNyh01WqCPtKZCmmSX1fd4,6881
41
41
  modal/image.py,sha256=cQ6WP1xHXZT_nY8z3aEFiGwKzrTV0yxi3Ab8JzF91eo,79653
42
42
  modal/image.pyi,sha256=PIKH6JBA4L5TfdJrQu3pm2ykyIITmiP920TpP8cdyQA,24585
@@ -51,8 +51,8 @@ modal/object.pyi,sha256=MO78H9yFSE5i1gExPEwyyQzLdlshkcGHN1aQ0ylyvq0,8802
51
51
  modal/output.py,sha256=N0xf4qeudEaYrslzdAl35VKV8rapstgIM2e9wO8_iy0,1967
52
52
  modal/parallel_map.py,sha256=4aoMXIrlG3wl5Ifk2YDNOQkXsGRsm6Xbfm6WtJ2t3WY,16002
53
53
  modal/parallel_map.pyi,sha256=pOhT0P3DDYlwLx0fR3PTsecA7DI8uOdXC1N8i-ZkyOY,2328
54
- modal/partial_function.py,sha256=938kcVJHcdGXKWsO7NE_FBxPldZ304a_GyhjxD79wHE,28215
55
- modal/partial_function.pyi,sha256=EafGOzZdEq-yE5bYRoMfnMqw-o8Hk_So8MRPDSB99_0,8982
54
+ modal/partial_function.py,sha256=rirVfihV6kp1SMTacrsfE5rNXV5JnTLpU_Zd4xukNg0,28529
55
+ modal/partial_function.pyi,sha256=mt9kUeeMSVTo5qJ6JF6qeQzr41zykYBi2Yt6R8dxtWk,8948
56
56
  modal/proxy.py,sha256=ZrOsuQP7dSZFq1OrIxalNnt0Zvsnp1h86Th679sSL40,1417
57
57
  modal/proxy.pyi,sha256=UvygdOYneLTuoDY6hVaMNCyZ947Tmx93IdLjErUqkvM,368
58
58
  modal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -161,10 +161,10 @@ modal_proto/options_pb2_grpc.pyi,sha256=CImmhxHsYnF09iENPoe8S4J-n93jtgUYD2JPAc0y
161
161
  modal_proto/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
162
162
  modal_version/__init__.py,sha256=RT6zPoOdFO99u5Wcxxaoir4ZCuPTbQ22cvzFAXl3vUY,470
163
163
  modal_version/__main__.py,sha256=2FO0yYQQwDTh6udt1h-cBnGd1c4ZyHnHSI4BksxzVac,105
164
- modal_version/_version_generated.py,sha256=6Pvpcc5MvVX_YgJS7zOEdJe-DbGK8uv3kqiGt-OVVXE,148
165
- modal-0.68.2.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
166
- modal-0.68.2.dist-info/METADATA,sha256=5nS06eizxvISwpNNTho3610CO0mCCjpisIfo5STyfYY,2328
167
- modal-0.68.2.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
168
- modal-0.68.2.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
169
- modal-0.68.2.dist-info/top_level.txt,sha256=1nvYbOSIKcmU50fNrpnQnrrOpj269ei3LzgB6j9xGqg,64
170
- modal-0.68.2.dist-info/RECORD,,
164
+ modal_version/_version_generated.py,sha256=RnkeD9Xami8-rqtaTQHQQ32LYRFZ6tdxHTiLTJ0S2C0,148
165
+ modal-0.68.3.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
166
+ modal-0.68.3.dist-info/METADATA,sha256=tbQhkc_XnzWc5Resnou7_qVNyayunPj8wcZHDQYnLCo,2328
167
+ modal-0.68.3.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
168
+ modal-0.68.3.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
169
+ modal-0.68.3.dist-info/top_level.txt,sha256=1nvYbOSIKcmU50fNrpnQnrrOpj269ei3LzgB6j9xGqg,64
170
+ modal-0.68.3.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  # Copyright Modal Labs 2024
2
2
 
3
3
  # Note: Reset this value to -1 whenever you make a minor `0.X` release of the client.
4
- build_number = 2 # git: bf9e3ce
4
+ build_number = 3 # git: 32eb4cc
File without changes