modal 0.68.45__py3-none-any.whl → 0.68.46__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/_utils/function_utils.py +20 -12
- modal/client.pyi +2 -2
- modal/functions.py +1 -1
- {modal-0.68.45.dist-info → modal-0.68.46.dist-info}/METADATA +1 -1
- {modal-0.68.45.dist-info → modal-0.68.46.dist-info}/RECORD +10 -10
- modal_version/_version_generated.py +1 -1
- {modal-0.68.45.dist-info → modal-0.68.46.dist-info}/LICENSE +0 -0
- {modal-0.68.45.dist-info → modal-0.68.46.dist-info}/WHEEL +0 -0
- {modal-0.68.45.dist-info → modal-0.68.46.dist-info}/entry_points.txt +0 -0
- {modal-0.68.45.dist-info → modal-0.68.46.dist-info}/top_level.txt +0 -0
modal/_utils/function_utils.py
CHANGED
@@ -99,16 +99,18 @@ def get_function_type(is_generator: Optional[bool]) -> "api_pb2.Function.Functio
|
|
99
99
|
|
100
100
|
|
101
101
|
class FunctionInfo:
|
102
|
-
"""
|
102
|
+
"""Utility that determines serialization/deserialization mechanisms for functions
|
103
103
|
|
104
|
-
|
105
|
-
|
104
|
+
* Stored as file vs serialized
|
105
|
+
* If serialized: how to serialize the function
|
106
|
+
* If file: which module/function name should be used to retrieve
|
107
|
+
|
108
|
+
Used for populating the definition of a remote function
|
106
109
|
"""
|
107
110
|
|
108
111
|
raw_f: Optional[Callable[..., Any]] # if None - this is a "class service function"
|
109
112
|
function_name: str
|
110
113
|
user_cls: Optional[type[Any]]
|
111
|
-
definition_type: "modal_proto.api_pb2.Function.DefinitionType.ValueType"
|
112
114
|
module_name: Optional[str]
|
113
115
|
|
114
116
|
_type: FunctionInfoType
|
@@ -116,6 +118,12 @@ class FunctionInfo:
|
|
116
118
|
_base_dir: str
|
117
119
|
_remote_dir: Optional[PurePosixPath] = None
|
118
120
|
|
121
|
+
def get_definition_type(self) -> "modal_proto.api_pb2.Function.DefinitionType.ValueType":
|
122
|
+
if self.is_serialized():
|
123
|
+
return modal_proto.api_pb2.Function.DEFINITION_TYPE_SERIALIZED
|
124
|
+
else:
|
125
|
+
return modal_proto.api_pb2.Function.DEFINITION_TYPE_FILE
|
126
|
+
|
119
127
|
def is_service_class(self):
|
120
128
|
if self.raw_f is None:
|
121
129
|
assert self.user_cls
|
@@ -172,7 +180,7 @@ class FunctionInfo:
|
|
172
180
|
self._base_dir = base_dirs[0]
|
173
181
|
self.module_name = module.__spec__.name
|
174
182
|
self._remote_dir = ROOT_DIR / PurePosixPath(module.__package__.split(".")[0])
|
175
|
-
self.
|
183
|
+
self._is_serialized = False
|
176
184
|
self._type = FunctionInfoType.PACKAGE
|
177
185
|
elif hasattr(module, "__file__") and not serialized:
|
178
186
|
# This generally covers the case where it's invoked with
|
@@ -182,18 +190,18 @@ class FunctionInfo:
|
|
182
190
|
self._file = os.path.abspath(inspect.getfile(module))
|
183
191
|
self.module_name = inspect.getmodulename(self._file)
|
184
192
|
self._base_dir = os.path.dirname(self._file)
|
185
|
-
self.
|
193
|
+
self._is_serialized = False
|
186
194
|
self._type = FunctionInfoType.FILE
|
187
195
|
else:
|
188
196
|
self.module_name = None
|
189
197
|
self._base_dir = os.path.abspath("") # get current dir
|
190
|
-
self.
|
191
|
-
if serialized:
|
198
|
+
self._is_serialized = True # either explicitly, or by being in a notebook
|
199
|
+
if serialized: # if explicit
|
192
200
|
self._type = FunctionInfoType.SERIALIZED
|
193
201
|
else:
|
194
202
|
self._type = FunctionInfoType.NOTEBOOK
|
195
203
|
|
196
|
-
if self.
|
204
|
+
if not self.is_serialized():
|
197
205
|
# Sanity check that this function is defined in global scope
|
198
206
|
# Unfortunately, there's no "clean" way to do this in Python
|
199
207
|
qualname = f.__qualname__ if f else user_cls.__qualname__
|
@@ -203,7 +211,7 @@ class FunctionInfo:
|
|
203
211
|
)
|
204
212
|
|
205
213
|
def is_serialized(self) -> bool:
|
206
|
-
return self.
|
214
|
+
return self._is_serialized
|
207
215
|
|
208
216
|
def serialized_function(self) -> bytes:
|
209
217
|
# Note: this should only be called from .load() and not at function decoration time
|
@@ -312,7 +320,7 @@ class FunctionInfo:
|
|
312
320
|
if self._type == FunctionInfoType.PACKAGE:
|
313
321
|
if config.get("automount"):
|
314
322
|
return [_Mount.from_local_python_packages(self.module_name)]
|
315
|
-
elif self.
|
323
|
+
elif not self.is_serialized():
|
316
324
|
# mount only relevant file and __init__.py:s
|
317
325
|
return [
|
318
326
|
_Mount.from_local_dir(
|
@@ -322,7 +330,7 @@ class FunctionInfo:
|
|
322
330
|
condition=entrypoint_only_package_mount_condition(self._file),
|
323
331
|
)
|
324
332
|
]
|
325
|
-
elif self.
|
333
|
+
elif not self.is_serialized():
|
326
334
|
remote_path = ROOT_DIR / Path(self._file).name
|
327
335
|
if not _is_modal_path(remote_path):
|
328
336
|
return [
|
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.
|
29
|
+
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.68.46"
|
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.
|
84
|
+
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.68.46"
|
85
85
|
): ...
|
86
86
|
def is_closed(self) -> bool: ...
|
87
87
|
@property
|
modal/functions.py
CHANGED
@@ -753,7 +753,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
753
753
|
mount_ids=loaded_mount_ids,
|
754
754
|
secret_ids=[secret.object_id for secret in secrets],
|
755
755
|
image_id=(image.object_id if image else ""),
|
756
|
-
definition_type=info.
|
756
|
+
definition_type=info.get_definition_type(),
|
757
757
|
function_serialized=function_serialized or b"",
|
758
758
|
class_serialized=class_serialized or b"",
|
759
759
|
function_type=function_type,
|
@@ -19,7 +19,7 @@ modal/app.py,sha256=JWefPs4yB70BKQwSZejB_4_muhxn63cC9UmnNvpQ9XY,45526
|
|
19
19
|
modal/app.pyi,sha256=FYPCEJNhof4YF6HIuNP_2yG6s2PgZnKW9tO1hFE6sfA,25194
|
20
20
|
modal/call_graph.py,sha256=1g2DGcMIJvRy-xKicuf63IVE98gJSnQsr8R_NVMptNc,2581
|
21
21
|
modal/client.py,sha256=JAnd4-GCN093BwkvOFAK5a6iy5ycxofjpUncMxlrIMw,15253
|
22
|
-
modal/client.pyi,sha256=
|
22
|
+
modal/client.pyi,sha256=R2fVT8CQF9vWHtRLbpqLUwY6vtAP7u3aSDKOGaoGST4,7280
|
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=3hjb0JcoPjxKZNeK22f5rR43bZRBjoRI7_EMZXY7YrE,31172
|
@@ -36,7 +36,7 @@ modal/experimental.py,sha256=jFuNbwrNHos47viMB9q-cHJSvf2RDxDdoEcss9plaZE,2302
|
|
36
36
|
modal/file_io.py,sha256=pDOFNQU5m-x-k3oJauck4fOp3bZ55Vc-_LvSaN5_Bow,16465
|
37
37
|
modal/file_io.pyi,sha256=GMhCCRyMftXYI3HqI9EdGPOx70CbCNi-VC5Sfy5TYnc,7631
|
38
38
|
modal/file_pattern_matcher.py,sha256=V6P74Vc7LAuBFe_uepIaZmoDJiuAvqjFibe0GcMJwxo,5119
|
39
|
-
modal/functions.py,sha256
|
39
|
+
modal/functions.py,sha256=aXXXr3rk7BCeh5OWMvxGksGm8FQoYCyrBDGV74FPoPE,67827
|
40
40
|
modal/functions.pyi,sha256=snttn47K81lKhmrCLWNVZelZTDhNsbxtw4l1DlLDR74,25317
|
41
41
|
modal/gpu.py,sha256=MTxj6ql8EpgfBg8YmZ5a1cLznyuZFssX1qXbEX4LKVM,7503
|
42
42
|
modal/image.py,sha256=sv45bYaF5Jlmk8mQE3EDADYyXLi14hOe2CUM0Zb8Xao,82243
|
@@ -88,7 +88,7 @@ modal/_utils/async_utils.py,sha256=9ubwMkwiDB4gzOYG2jL9j7Fs-5dxHjcifZe3r7JRg-k,2
|
|
88
88
|
modal/_utils/blob_utils.py,sha256=N66LtZI8PpCkZ7maA7GLW5CAmYUoNJdG-GjaAUR4_NQ,14509
|
89
89
|
modal/_utils/bytes_io_segment_payload.py,sha256=uunxVJS4PE1LojF_UpURMzVK9GuvmYWRqQo_bxEj5TU,3385
|
90
90
|
modal/_utils/deprecation.py,sha256=dycySRBxyZf3ITzEqPNM6MxXTk9-0VVLA8oCPQ5j_Os,3426
|
91
|
-
modal/_utils/function_utils.py,sha256=
|
91
|
+
modal/_utils/function_utils.py,sha256=7vIYYezYcKA-19wBJFaoquVMLfD4LKCTlZlo92an-nY,25141
|
92
92
|
modal/_utils/grpc_testing.py,sha256=H1zHqthv19eGPJz2HKXDyWXWGSqO4BRsxah3L5Xaa8A,8619
|
93
93
|
modal/_utils/grpc_utils.py,sha256=PPB5ay-vXencXNIWPVw5modr3EH7gfq2QPcO5YJ1lMU,7737
|
94
94
|
modal/_utils/hash_utils.py,sha256=zg3J6OGxTFGSFri1qQ12giDz90lWk8bzaxCTUCRtiX4,3034
|
@@ -164,10 +164,10 @@ modal_proto/options_pb2_grpc.pyi,sha256=CImmhxHsYnF09iENPoe8S4J-n93jtgUYD2JPAc0y
|
|
164
164
|
modal_proto/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
165
165
|
modal_version/__init__.py,sha256=RT6zPoOdFO99u5Wcxxaoir4ZCuPTbQ22cvzFAXl3vUY,470
|
166
166
|
modal_version/__main__.py,sha256=2FO0yYQQwDTh6udt1h-cBnGd1c4ZyHnHSI4BksxzVac,105
|
167
|
-
modal_version/_version_generated.py,sha256=
|
168
|
-
modal-0.68.
|
169
|
-
modal-0.68.
|
170
|
-
modal-0.68.
|
171
|
-
modal-0.68.
|
172
|
-
modal-0.68.
|
173
|
-
modal-0.68.
|
167
|
+
modal_version/_version_generated.py,sha256=psg_H9j7MwYoOpw0zA9YEU0Z6fanVM3VE_8pv-ngDZQ,149
|
168
|
+
modal-0.68.46.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
|
169
|
+
modal-0.68.46.dist-info/METADATA,sha256=lMPgA_xcmoACf-rUI_cPmjDHM6eLeSzTVt6L6frT3Lc,2329
|
170
|
+
modal-0.68.46.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
171
|
+
modal-0.68.46.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
|
172
|
+
modal-0.68.46.dist-info/top_level.txt,sha256=1nvYbOSIKcmU50fNrpnQnrrOpj269ei3LzgB6j9xGqg,64
|
173
|
+
modal-0.68.46.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|