modal 1.0.3.dev10__py3-none-any.whl → 1.2.3.dev7__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.

Files changed (160) hide show
  1. modal/__init__.py +0 -2
  2. modal/__main__.py +3 -4
  3. modal/_billing.py +80 -0
  4. modal/_clustered_functions.py +7 -3
  5. modal/_clustered_functions.pyi +15 -3
  6. modal/_container_entrypoint.py +51 -69
  7. modal/_functions.py +508 -240
  8. modal/_grpc_client.py +171 -0
  9. modal/_load_context.py +105 -0
  10. modal/_object.py +81 -21
  11. modal/_output.py +58 -45
  12. modal/_partial_function.py +48 -73
  13. modal/_pty.py +7 -3
  14. modal/_resolver.py +26 -46
  15. modal/_runtime/asgi.py +4 -3
  16. modal/_runtime/container_io_manager.py +358 -220
  17. modal/_runtime/container_io_manager.pyi +296 -101
  18. modal/_runtime/execution_context.py +18 -2
  19. modal/_runtime/execution_context.pyi +64 -7
  20. modal/_runtime/gpu_memory_snapshot.py +262 -57
  21. modal/_runtime/user_code_imports.py +28 -58
  22. modal/_serialization.py +90 -6
  23. modal/_traceback.py +42 -1
  24. modal/_tunnel.pyi +380 -12
  25. modal/_utils/async_utils.py +84 -29
  26. modal/_utils/auth_token_manager.py +111 -0
  27. modal/_utils/blob_utils.py +181 -58
  28. modal/_utils/deprecation.py +19 -0
  29. modal/_utils/function_utils.py +91 -47
  30. modal/_utils/grpc_utils.py +89 -66
  31. modal/_utils/mount_utils.py +26 -1
  32. modal/_utils/name_utils.py +17 -3
  33. modal/_utils/task_command_router_client.py +536 -0
  34. modal/_utils/time_utils.py +34 -6
  35. modal/app.py +256 -88
  36. modal/app.pyi +909 -92
  37. modal/billing.py +5 -0
  38. modal/builder/2025.06.txt +18 -0
  39. modal/builder/PREVIEW.txt +18 -0
  40. modal/builder/base-images.json +58 -0
  41. modal/cli/_download.py +19 -3
  42. modal/cli/_traceback.py +3 -2
  43. modal/cli/app.py +4 -4
  44. modal/cli/cluster.py +15 -7
  45. modal/cli/config.py +5 -3
  46. modal/cli/container.py +7 -6
  47. modal/cli/dict.py +22 -16
  48. modal/cli/entry_point.py +12 -5
  49. modal/cli/environment.py +5 -4
  50. modal/cli/import_refs.py +3 -3
  51. modal/cli/launch.py +102 -5
  52. modal/cli/network_file_system.py +11 -12
  53. modal/cli/profile.py +3 -2
  54. modal/cli/programs/launch_instance_ssh.py +94 -0
  55. modal/cli/programs/run_jupyter.py +1 -1
  56. modal/cli/programs/run_marimo.py +95 -0
  57. modal/cli/programs/vscode.py +1 -1
  58. modal/cli/queues.py +57 -26
  59. modal/cli/run.py +91 -23
  60. modal/cli/secret.py +48 -22
  61. modal/cli/token.py +7 -8
  62. modal/cli/utils.py +4 -7
  63. modal/cli/volume.py +31 -25
  64. modal/client.py +15 -85
  65. modal/client.pyi +183 -62
  66. modal/cloud_bucket_mount.py +5 -3
  67. modal/cloud_bucket_mount.pyi +197 -5
  68. modal/cls.py +200 -126
  69. modal/cls.pyi +446 -68
  70. modal/config.py +29 -11
  71. modal/container_process.py +319 -19
  72. modal/container_process.pyi +190 -20
  73. modal/dict.py +290 -71
  74. modal/dict.pyi +835 -83
  75. modal/environments.py +15 -27
  76. modal/environments.pyi +46 -24
  77. modal/exception.py +14 -2
  78. modal/experimental/__init__.py +194 -40
  79. modal/experimental/flash.py +618 -0
  80. modal/experimental/flash.pyi +380 -0
  81. modal/experimental/ipython.py +11 -7
  82. modal/file_io.py +29 -36
  83. modal/file_io.pyi +251 -53
  84. modal/file_pattern_matcher.py +56 -16
  85. modal/functions.pyi +673 -92
  86. modal/gpu.py +1 -1
  87. modal/image.py +528 -176
  88. modal/image.pyi +1572 -145
  89. modal/io_streams.py +458 -128
  90. modal/io_streams.pyi +433 -52
  91. modal/mount.py +216 -151
  92. modal/mount.pyi +225 -78
  93. modal/network_file_system.py +45 -62
  94. modal/network_file_system.pyi +277 -56
  95. modal/object.pyi +93 -17
  96. modal/parallel_map.py +942 -129
  97. modal/parallel_map.pyi +294 -15
  98. modal/partial_function.py +0 -2
  99. modal/partial_function.pyi +234 -19
  100. modal/proxy.py +17 -8
  101. modal/proxy.pyi +36 -3
  102. modal/queue.py +270 -65
  103. modal/queue.pyi +817 -57
  104. modal/runner.py +115 -101
  105. modal/runner.pyi +205 -49
  106. modal/sandbox.py +512 -136
  107. modal/sandbox.pyi +845 -111
  108. modal/schedule.py +1 -1
  109. modal/secret.py +300 -70
  110. modal/secret.pyi +589 -34
  111. modal/serving.py +7 -11
  112. modal/serving.pyi +7 -8
  113. modal/snapshot.py +11 -8
  114. modal/snapshot.pyi +25 -4
  115. modal/token_flow.py +4 -4
  116. modal/token_flow.pyi +28 -8
  117. modal/volume.py +416 -158
  118. modal/volume.pyi +1117 -121
  119. {modal-1.0.3.dev10.dist-info → modal-1.2.3.dev7.dist-info}/METADATA +10 -9
  120. modal-1.2.3.dev7.dist-info/RECORD +195 -0
  121. modal_docs/mdmd/mdmd.py +17 -4
  122. modal_proto/api.proto +534 -79
  123. modal_proto/api_grpc.py +337 -1
  124. modal_proto/api_pb2.py +1522 -968
  125. modal_proto/api_pb2.pyi +1619 -134
  126. modal_proto/api_pb2_grpc.py +699 -4
  127. modal_proto/api_pb2_grpc.pyi +226 -14
  128. modal_proto/modal_api_grpc.py +175 -154
  129. modal_proto/sandbox_router.proto +145 -0
  130. modal_proto/sandbox_router_grpc.py +105 -0
  131. modal_proto/sandbox_router_pb2.py +149 -0
  132. modal_proto/sandbox_router_pb2.pyi +333 -0
  133. modal_proto/sandbox_router_pb2_grpc.py +203 -0
  134. modal_proto/sandbox_router_pb2_grpc.pyi +75 -0
  135. modal_proto/task_command_router.proto +144 -0
  136. modal_proto/task_command_router_grpc.py +105 -0
  137. modal_proto/task_command_router_pb2.py +149 -0
  138. modal_proto/task_command_router_pb2.pyi +333 -0
  139. modal_proto/task_command_router_pb2_grpc.py +203 -0
  140. modal_proto/task_command_router_pb2_grpc.pyi +75 -0
  141. modal_version/__init__.py +1 -1
  142. modal/requirements/PREVIEW.txt +0 -16
  143. modal/requirements/base-images.json +0 -26
  144. modal-1.0.3.dev10.dist-info/RECORD +0 -179
  145. modal_proto/modal_options_grpc.py +0 -3
  146. modal_proto/options.proto +0 -19
  147. modal_proto/options_grpc.py +0 -3
  148. modal_proto/options_pb2.py +0 -35
  149. modal_proto/options_pb2.pyi +0 -20
  150. modal_proto/options_pb2_grpc.py +0 -4
  151. modal_proto/options_pb2_grpc.pyi +0 -7
  152. /modal/{requirements → builder}/2023.12.312.txt +0 -0
  153. /modal/{requirements → builder}/2023.12.txt +0 -0
  154. /modal/{requirements → builder}/2024.04.txt +0 -0
  155. /modal/{requirements → builder}/2024.10.txt +0 -0
  156. /modal/{requirements → builder}/README.md +0 -0
  157. {modal-1.0.3.dev10.dist-info → modal-1.2.3.dev7.dist-info}/WHEEL +0 -0
  158. {modal-1.0.3.dev10.dist-info → modal-1.2.3.dev7.dist-info}/entry_points.txt +0 -0
  159. {modal-1.0.3.dev10.dist-info → modal-1.2.3.dev7.dist-info}/licenses/LICENSE +0 -0
  160. {modal-1.0.3.dev10.dist-info → modal-1.2.3.dev7.dist-info}/top_level.txt +0 -0
modal/object.pyi CHANGED
@@ -1,5 +1,6 @@
1
1
  import collections.abc
2
2
  import google.protobuf.message
3
+ import modal._load_context
3
4
  import modal._resolver
4
5
  import modal.client
5
6
  import typing
@@ -12,12 +13,14 @@ class Object:
12
13
  _prefix_to_type: typing.ClassVar[dict[str, type]]
13
14
  _load: typing.Optional[
14
15
  collections.abc.Callable[
15
- [typing_extensions.Self, modal._resolver.Resolver, typing.Optional[str]], collections.abc.Awaitable[None]
16
+ [typing_extensions.Self, modal._resolver.Resolver, modal._load_context.LoadContext, typing.Optional[str]],
17
+ collections.abc.Awaitable[None],
16
18
  ]
17
19
  ]
18
20
  _preload: typing.Optional[
19
21
  collections.abc.Callable[
20
- [typing_extensions.Self, modal._resolver.Resolver, typing.Optional[str]], collections.abc.Awaitable[None]
22
+ [typing_extensions.Self, modal._resolver.Resolver, modal._load_context.LoadContext, typing.Optional[str]],
23
+ collections.abc.Awaitable[None],
21
24
  ]
22
25
  ]
23
26
  _rep: str
@@ -27,12 +30,17 @@ class Object:
27
30
  _deduplication_key: typing.Optional[
28
31
  collections.abc.Callable[[], collections.abc.Awaitable[collections.abc.Hashable]]
29
32
  ]
33
+ _load_context_overrides: modal._load_context.LoadContext
30
34
  _object_id: typing.Optional[str]
31
35
  _client: typing.Optional[modal.client.Client]
32
36
  _is_hydrated: bool
33
37
  _is_rehydrated: bool
38
+ _name: typing.Optional[str]
39
+
40
+ def __init__(self, *args, **kwargs):
41
+ """mdmd:hidden"""
42
+ ...
34
43
 
35
- def __init__(self, *args, **kwargs): ...
36
44
  @classmethod
37
45
  def __init_subclass__(cls, type_prefix: typing.Optional[str] = None): ...
38
46
 
@@ -42,15 +50,22 @@ class Object:
42
50
  /,
43
51
  rep: str,
44
52
  load: typing.Optional[
45
- collections.abc.Callable[[SUPERSELF, modal._resolver.Resolver, typing.Optional[str]], None]
53
+ collections.abc.Callable[
54
+ [SUPERSELF, modal._resolver.Resolver, modal._load_context.LoadContext, typing.Optional[str]], None
55
+ ]
46
56
  ] = None,
47
57
  is_another_app: bool = False,
48
58
  preload: typing.Optional[
49
- collections.abc.Callable[[SUPERSELF, modal._resolver.Resolver, typing.Optional[str]], None]
59
+ collections.abc.Callable[
60
+ [SUPERSELF, modal._resolver.Resolver, modal._load_context.LoadContext, typing.Optional[str]], None
61
+ ]
50
62
  ] = None,
51
63
  hydrate_lazily: bool = False,
52
64
  deps: typing.Optional[collections.abc.Callable[..., collections.abc.Sequence[Object]]] = None,
53
65
  deduplication_key: typing.Optional[collections.abc.Callable[[], collections.abc.Hashable]] = None,
66
+ name: typing.Optional[str] = None,
67
+ *,
68
+ load_context_overrides: typing.Optional[modal._load_context.LoadContext] = None,
54
69
  ): ...
55
70
  def aio(
56
71
  self,
@@ -58,13 +73,15 @@ class Object:
58
73
  rep: str,
59
74
  load: typing.Optional[
60
75
  collections.abc.Callable[
61
- [SUPERSELF, modal._resolver.Resolver, typing.Optional[str]], collections.abc.Awaitable[None]
76
+ [SUPERSELF, modal._resolver.Resolver, modal._load_context.LoadContext, typing.Optional[str]],
77
+ collections.abc.Awaitable[None],
62
78
  ]
63
79
  ] = None,
64
80
  is_another_app: bool = False,
65
81
  preload: typing.Optional[
66
82
  collections.abc.Callable[
67
- [SUPERSELF, modal._resolver.Resolver, typing.Optional[str]], collections.abc.Awaitable[None]
83
+ [SUPERSELF, modal._resolver.Resolver, modal._load_context.LoadContext, typing.Optional[str]],
84
+ collections.abc.Awaitable[None],
68
85
  ]
69
86
  ] = None,
70
87
  hydrate_lazily: bool = False,
@@ -72,6 +89,9 @@ class Object:
72
89
  deduplication_key: typing.Optional[
73
90
  collections.abc.Callable[[], collections.abc.Awaitable[collections.abc.Hashable]]
74
91
  ] = None,
92
+ name: typing.Optional[str] = None,
93
+ *,
94
+ load_context_overrides: typing.Optional[modal._load_context.LoadContext] = None,
75
95
  ): ...
76
96
 
77
97
  _init: ___init_spec[typing_extensions.Self]
@@ -85,47 +105,103 @@ class Object:
85
105
  def _hydrate_metadata(self, metadata: typing.Optional[google.protobuf.message.Message]): ...
86
106
  def _get_metadata(self) -> typing.Optional[google.protobuf.message.Message]: ...
87
107
  def _validate_is_hydrated(self): ...
88
- def clone(self) -> typing_extensions.Self: ...
108
+ def clone(self) -> typing_extensions.Self:
109
+ """mdmd:hidden Clone a given hydrated object.
110
+
111
+ Note: This is not intended to be public API and has no public use. It will be removed in a future release.
112
+ """
113
+ ...
114
+
89
115
  @classmethod
90
116
  def _from_loader(
91
117
  cls,
92
- load: collections.abc.Callable[[typing_extensions.Self, modal._resolver.Resolver, typing.Optional[str]], None],
118
+ load: collections.abc.Callable[
119
+ [typing_extensions.Self, modal._resolver.Resolver, modal._load_context.LoadContext, typing.Optional[str]],
120
+ None,
121
+ ],
93
122
  rep: str,
94
123
  is_another_app: bool = False,
95
124
  preload: typing.Optional[
96
- collections.abc.Callable[[typing_extensions.Self, modal._resolver.Resolver, typing.Optional[str]], None]
125
+ collections.abc.Callable[
126
+ [
127
+ typing_extensions.Self,
128
+ modal._resolver.Resolver,
129
+ modal._load_context.LoadContext,
130
+ typing.Optional[str],
131
+ ],
132
+ None,
133
+ ]
97
134
  ] = None,
98
135
  hydrate_lazily: bool = False,
99
136
  deps: typing.Optional[collections.abc.Callable[..., collections.abc.Sequence[Object]]] = None,
100
137
  deduplication_key: typing.Optional[collections.abc.Callable[[], collections.abc.Hashable]] = None,
138
+ name: typing.Optional[str] = None,
139
+ *,
140
+ load_context_overrides: modal._load_context.LoadContext,
101
141
  ): ...
102
142
  @staticmethod
103
143
  def _get_type_from_id(object_id: str) -> type[Object]: ...
104
144
  @classmethod
105
145
  def _is_id_type(cls, object_id) -> bool: ...
106
146
  @classmethod
147
+ def _repr(cls, name: str, environment_name: typing.Optional[str] = None) -> str: ...
148
+ @classmethod
107
149
  def _new_hydrated(
108
150
  cls,
109
151
  object_id: str,
110
152
  client: modal.client.Client,
111
153
  handle_metadata: typing.Optional[google.protobuf.message.Message],
112
154
  is_another_app: bool = False,
155
+ rep: typing.Optional[str] = None,
113
156
  ) -> typing_extensions.Self: ...
114
157
  def _hydrate_from_other(self, other: typing_extensions.Self): ...
115
158
  def __repr__(self): ...
116
159
  @property
117
- def local_uuid(self): ...
160
+ def local_uuid(self):
161
+ """mdmd:hidden"""
162
+ ...
163
+
118
164
  @property
119
- def object_id(self) -> str: ...
165
+ def object_id(self) -> str:
166
+ """mdmd:hidden"""
167
+ ...
168
+
120
169
  @property
121
- def client(self) -> modal.client.Client: ...
170
+ def client(self) -> modal.client.Client:
171
+ """mdmd:hidden"""
172
+ ...
173
+
122
174
  @property
123
- def is_hydrated(self) -> bool: ...
175
+ def is_hydrated(self) -> bool:
176
+ """mdmd:hidden"""
177
+ ...
178
+
124
179
  @property
125
- def deps(self) -> collections.abc.Callable[..., collections.abc.Sequence[Object]]: ...
180
+ def deps(self) -> collections.abc.Callable[..., collections.abc.Sequence[Object]]:
181
+ """mdmd:hidden"""
182
+ ...
126
183
 
127
184
  class __hydrate_spec(typing_extensions.Protocol[SUPERSELF]):
128
- def __call__(self, /, client: typing.Optional[modal.client.Client] = None) -> SUPERSELF: ...
129
- async def aio(self, /, client: typing.Optional[modal.client.Client] = None) -> SUPERSELF: ...
185
+ def __call__(self, /, client: typing.Optional[modal.client.Client] = None) -> SUPERSELF:
186
+ """Synchronize the local object with its identity on the Modal server.
187
+
188
+ It is rarely necessary to call this method explicitly, as most operations
189
+ will lazily hydrate when needed. The main use case is when you need to
190
+ access object metadata, such as its ID.
191
+
192
+ *Added in v0.72.39*: This method replaces the deprecated `.resolve()` method.
193
+ """
194
+ ...
195
+
196
+ async def aio(self, /, client: typing.Optional[modal.client.Client] = None) -> SUPERSELF:
197
+ """Synchronize the local object with its identity on the Modal server.
198
+
199
+ It is rarely necessary to call this method explicitly, as most operations
200
+ will lazily hydrate when needed. The main use case is when you need to
201
+ access object metadata, such as its ID.
202
+
203
+ *Added in v0.72.39*: This method replaces the deprecated `.resolve()` method.
204
+ """
205
+ ...
130
206
 
131
207
  hydrate: __hydrate_spec[typing_extensions.Self]