modal 1.0.5.dev2__tar.gz → 1.0.5.dev3__tar.gz

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.
Files changed (202) hide show
  1. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/PKG-INFO +1 -1
  2. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_clustered_functions.pyi +13 -3
  3. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_runtime/container_io_manager.pyi +222 -40
  4. modal-1.0.5.dev3/modal/_runtime/execution_context.pyi +78 -0
  5. modal-1.0.5.dev3/modal/_tunnel.pyi +405 -0
  6. modal-1.0.5.dev3/modal/app.pyi +1120 -0
  7. modal-1.0.5.dev3/modal/client.pyi +419 -0
  8. modal-1.0.5.dev3/modal/cloud_bucket_mount.pyi +239 -0
  9. modal-1.0.5.dev3/modal/cls.pyi +715 -0
  10. modal-1.0.5.dev3/modal/container_process.pyi +175 -0
  11. modal-1.0.5.dev3/modal/dict.pyi +611 -0
  12. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/environments.pyi +41 -9
  13. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/file_io.pyi +236 -45
  14. modal-1.0.5.dev3/modal/functions.pyi +888 -0
  15. modal-1.0.5.dev3/modal/image.pyi +1792 -0
  16. modal-1.0.5.dev3/modal/io_streams.pyi +427 -0
  17. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/mount.pyi +261 -31
  18. modal-1.0.5.dev3/modal/network_file_system.pyi +503 -0
  19. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/object.pyi +48 -9
  20. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/parallel_map.pyi +144 -14
  21. modal-1.0.5.dev3/modal/partial_function.pyi +413 -0
  22. modal-1.0.5.dev3/modal/proxy.pyi +37 -0
  23. modal-1.0.5.dev3/modal/queue.pyi +717 -0
  24. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/runner.pyi +160 -22
  25. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/sandbox.pyi +310 -50
  26. modal-1.0.5.dev3/modal/secret.pyi +242 -0
  27. modal-1.0.5.dev3/modal/snapshot.pyi +39 -0
  28. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/token_flow.pyi +28 -8
  29. modal-1.0.5.dev3/modal/volume.pyi +1127 -0
  30. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal.egg-info/PKG-INFO +1 -1
  31. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_version/__init__.py +1 -1
  32. modal-1.0.5.dev2/modal/_runtime/execution_context.pyi +0 -24
  33. modal-1.0.5.dev2/modal/_tunnel.pyi +0 -37
  34. modal-1.0.5.dev2/modal/app.pyi +0 -510
  35. modal-1.0.5.dev2/modal/client.pyi +0 -223
  36. modal-1.0.5.dev2/modal/cloud_bucket_mount.pyi +0 -51
  37. modal-1.0.5.dev2/modal/cls.pyi +0 -308
  38. modal-1.0.5.dev2/modal/container_process.pyi +0 -86
  39. modal-1.0.5.dev2/modal/dict.pyi +0 -209
  40. modal-1.0.5.dev2/modal/functions.pyi +0 -401
  41. modal-1.0.5.dev2/modal/image.pyi +0 -610
  42. modal-1.0.5.dev2/modal/io_streams.pyi +0 -124
  43. modal-1.0.5.dev2/modal/network_file_system.pyi +0 -222
  44. modal-1.0.5.dev2/modal/partial_function.pyi +0 -172
  45. modal-1.0.5.dev2/modal/proxy.pyi +0 -12
  46. modal-1.0.5.dev2/modal/queue.pyi +0 -300
  47. modal-1.0.5.dev2/modal/secret.pyi +0 -93
  48. modal-1.0.5.dev2/modal/snapshot.pyi +0 -18
  49. modal-1.0.5.dev2/modal/volume.pyi +0 -537
  50. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/LICENSE +0 -0
  51. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/README.md +0 -0
  52. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/__init__.py +0 -0
  53. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/__main__.py +0 -0
  54. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_clustered_functions.py +0 -0
  55. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_container_entrypoint.py +0 -0
  56. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_functions.py +0 -0
  57. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_ipython.py +0 -0
  58. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_location.py +0 -0
  59. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_object.py +0 -0
  60. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_output.py +0 -0
  61. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_partial_function.py +0 -0
  62. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_pty.py +0 -0
  63. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_resolver.py +0 -0
  64. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_resources.py +0 -0
  65. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_runtime/__init__.py +0 -0
  66. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_runtime/asgi.py +0 -0
  67. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_runtime/container_io_manager.py +0 -0
  68. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_runtime/execution_context.py +0 -0
  69. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_runtime/gpu_memory_snapshot.py +0 -0
  70. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_runtime/telemetry.py +0 -0
  71. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_runtime/user_code_imports.py +0 -0
  72. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_serialization.py +0 -0
  73. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_traceback.py +0 -0
  74. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_tunnel.py +0 -0
  75. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_type_manager.py +0 -0
  76. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/__init__.py +0 -0
  77. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/app_utils.py +0 -0
  78. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/async_utils.py +0 -0
  79. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/blob_utils.py +0 -0
  80. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/bytes_io_segment_payload.py +0 -0
  81. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/deprecation.py +0 -0
  82. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/docker_utils.py +0 -0
  83. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/function_utils.py +0 -0
  84. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/git_utils.py +0 -0
  85. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/grpc_testing.py +0 -0
  86. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/grpc_utils.py +0 -0
  87. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/hash_utils.py +0 -0
  88. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/http_utils.py +0 -0
  89. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/jwt_utils.py +0 -0
  90. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/logger.py +0 -0
  91. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/mount_utils.py +0 -0
  92. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/name_utils.py +0 -0
  93. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/package_utils.py +0 -0
  94. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/pattern_utils.py +0 -0
  95. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/rand_pb_testing.py +0 -0
  96. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/shell_utils.py +0 -0
  97. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_utils/time_utils.py +0 -0
  98. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_vendor/__init__.py +0 -0
  99. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_vendor/a2wsgi_wsgi.py +0 -0
  100. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_vendor/cloudpickle.py +0 -0
  101. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_vendor/tblib.py +0 -0
  102. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/_watcher.py +0 -0
  103. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/app.py +0 -0
  104. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/call_graph.py +0 -0
  105. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/__init__.py +0 -0
  106. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/_download.py +0 -0
  107. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/_traceback.py +0 -0
  108. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/app.py +0 -0
  109. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/cluster.py +0 -0
  110. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/config.py +0 -0
  111. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/container.py +0 -0
  112. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/dict.py +0 -0
  113. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/entry_point.py +0 -0
  114. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/environment.py +0 -0
  115. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/import_refs.py +0 -0
  116. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/launch.py +0 -0
  117. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/network_file_system.py +0 -0
  118. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/profile.py +0 -0
  119. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/programs/__init__.py +0 -0
  120. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/programs/run_jupyter.py +0 -0
  121. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/programs/vscode.py +0 -0
  122. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/queues.py +0 -0
  123. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/run.py +0 -0
  124. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/secret.py +0 -0
  125. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/token.py +0 -0
  126. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/utils.py +0 -0
  127. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cli/volume.py +0 -0
  128. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/client.py +0 -0
  129. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cloud_bucket_mount.py +0 -0
  130. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/cls.py +0 -0
  131. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/config.py +0 -0
  132. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/container_process.py +0 -0
  133. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/dict.py +0 -0
  134. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/environments.py +0 -0
  135. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/exception.py +0 -0
  136. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/experimental/__init__.py +0 -0
  137. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/experimental/ipython.py +0 -0
  138. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/file_io.py +0 -0
  139. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/file_pattern_matcher.py +0 -0
  140. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/functions.py +0 -0
  141. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/gpu.py +0 -0
  142. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/image.py +0 -0
  143. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/io_streams.py +0 -0
  144. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/mount.py +0 -0
  145. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/network_file_system.py +0 -0
  146. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/object.py +0 -0
  147. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/output.py +0 -0
  148. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/parallel_map.py +0 -0
  149. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/partial_function.py +0 -0
  150. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/proxy.py +0 -0
  151. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/py.typed +0 -0
  152. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/queue.py +0 -0
  153. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/requirements/2023.12.312.txt +0 -0
  154. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/requirements/2023.12.txt +0 -0
  155. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/requirements/2024.04.txt +0 -0
  156. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/requirements/2024.10.txt +0 -0
  157. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/requirements/PREVIEW.txt +0 -0
  158. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/requirements/README.md +0 -0
  159. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/requirements/base-images.json +0 -0
  160. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/retries.py +0 -0
  161. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/runner.py +0 -0
  162. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/running_app.py +0 -0
  163. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/sandbox.py +0 -0
  164. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/schedule.py +0 -0
  165. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/scheduler_placement.py +0 -0
  166. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/secret.py +0 -0
  167. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/serving.py +0 -0
  168. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/serving.pyi +0 -0
  169. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/snapshot.py +0 -0
  170. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/stream_type.py +0 -0
  171. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/token_flow.py +0 -0
  172. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal/volume.py +0 -0
  173. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal.egg-info/SOURCES.txt +0 -0
  174. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal.egg-info/dependency_links.txt +0 -0
  175. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal.egg-info/entry_points.txt +0 -0
  176. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal.egg-info/requires.txt +0 -0
  177. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal.egg-info/top_level.txt +0 -0
  178. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_docs/__init__.py +0 -0
  179. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_docs/gen_cli_docs.py +0 -0
  180. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_docs/gen_reference_docs.py +0 -0
  181. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_docs/mdmd/__init__.py +0 -0
  182. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_docs/mdmd/mdmd.py +0 -0
  183. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_docs/mdmd/signatures.py +0 -0
  184. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_proto/__init__.py +0 -0
  185. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_proto/api.proto +0 -0
  186. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_proto/api_grpc.py +0 -0
  187. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_proto/api_pb2.py +0 -0
  188. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_proto/api_pb2.pyi +0 -0
  189. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_proto/api_pb2_grpc.py +0 -0
  190. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_proto/api_pb2_grpc.pyi +0 -0
  191. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_proto/modal_api_grpc.py +0 -0
  192. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_proto/modal_options_grpc.py +0 -0
  193. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_proto/options.proto +0 -0
  194. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_proto/options_grpc.py +0 -0
  195. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_proto/options_pb2.py +0 -0
  196. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_proto/options_pb2.pyi +0 -0
  197. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_proto/options_pb2_grpc.py +0 -0
  198. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_proto/options_pb2_grpc.pyi +0 -0
  199. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_proto/py.typed +0 -0
  200. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/modal_version/__main__.py +0 -0
  201. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/pyproject.toml +0 -0
  202. {modal-1.0.5.dev2 → modal-1.0.5.dev3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 1.0.5.dev2
3
+ Version: 1.0.5.dev3
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License: Apache-2.0
@@ -3,12 +3,22 @@ import typing
3
3
  import typing_extensions
4
4
 
5
5
  class ClusterInfo:
6
+ """ClusterInfo(rank: int, container_ips: list[str])"""
7
+
6
8
  rank: int
7
9
  container_ips: list[str]
8
10
 
9
- def __init__(self, rank: int, container_ips: list[str]) -> None: ...
10
- def __repr__(self): ...
11
- def __eq__(self, other): ...
11
+ def __init__(self, rank: int, container_ips: list[str]) -> None:
12
+ """Initialize self. See help(type(self)) for accurate signature."""
13
+ ...
14
+
15
+ def __repr__(self):
16
+ """Return repr(self)."""
17
+ ...
18
+
19
+ def __eq__(self, other):
20
+ """Return self==value."""
21
+ ...
12
22
 
13
23
  def get_cluster_info() -> ClusterInfo: ...
14
24
  async def _initialize_clustered_function(client: modal.client._Client, task_id: str, world_size: int): ...
@@ -9,10 +9,21 @@ import synchronicity.combined_types
9
9
  import typing
10
10
  import typing_extensions
11
11
 
12
- class UserException(Exception): ...
13
- class Sentinel: ...
12
+ class UserException(Exception):
13
+ """Used to shut down the task gracefully."""
14
+
15
+ ...
16
+
17
+ class Sentinel:
18
+ """Used to get type-stubs to work with this object."""
19
+
20
+ ...
14
21
 
15
22
  class IOContext:
23
+ """Context object for managing input, function calls, and function executions
24
+ in a batched or single input context.
25
+ """
26
+
16
27
  input_ids: list[str]
17
28
  retry_counts: list[int]
18
29
  function_call_ids: list[str]
@@ -30,7 +41,10 @@ class IOContext:
30
41
  function_inputs: list[modal_proto.api_pb2.FunctionInput],
31
42
  is_batched: bool,
32
43
  client: modal.client._Client,
33
- ): ...
44
+ ):
45
+ """Initialize self. See help(type(self)) for accurate signature."""
46
+ ...
47
+
34
48
  @classmethod
35
49
  async def create(
36
50
  cls,
@@ -46,12 +60,17 @@ class IOContext:
46
60
  def validate_output_data(self, data: typing.Any) -> list[typing.Any]: ...
47
61
 
48
62
  class InputSlots:
63
+ """A semaphore that allows dynamically adjusting the concurrency."""
64
+
49
65
  active: int
50
66
  value: int
51
67
  waiter: typing.Optional[asyncio.Future]
52
68
  closed: bool
53
69
 
54
- def __init__(self, value: int) -> None: ...
70
+ def __init__(self, value: int) -> None:
71
+ """Initialize self. See help(type(self)) for accurate signature."""
72
+ ...
73
+
55
74
  async def acquire(self) -> None: ...
56
75
  def _wake_waiter(self) -> None: ...
57
76
  def release(self) -> None: ...
@@ -59,6 +78,12 @@ class InputSlots:
59
78
  async def close(self) -> None: ...
60
79
 
61
80
  class _ContainerIOManager:
81
+ """Synchronizes all RPC calls and network operations for a running container.
82
+
83
+ TODO: maybe we shouldn't synchronize the whole class.
84
+ Then we could potentially move a bunch of the global functions onto it.
85
+ """
86
+
62
87
  task_id: str
63
88
  function_id: str
64
89
  app_id: str
@@ -90,9 +115,15 @@ class _ContainerIOManager:
90
115
  @staticmethod
91
116
  def __new__(
92
117
  cls, container_args: modal_proto.api_pb2.ContainerArguments, client: modal.client._Client
93
- ) -> _ContainerIOManager: ...
118
+ ) -> _ContainerIOManager:
119
+ """Create and return a new object. See help(type) for accurate signature."""
120
+ ...
121
+
94
122
  @classmethod
95
- def _reset_singleton(cls): ...
123
+ def _reset_singleton(cls):
124
+ """Only used for tests."""
125
+ ...
126
+
96
127
  async def hello(self): ...
97
128
  async def _run_heartbeat_loop(self): ...
98
129
  async def _heartbeat_handle_cancellations(self) -> bool: ...
@@ -102,15 +133,35 @@ class _ContainerIOManager:
102
133
  async def _dynamic_concurrency_loop(self): ...
103
134
  def serialize_data_format(self, obj: typing.Any, data_format: int) -> bytes: ...
104
135
  async def format_blob_data(self, data: bytes) -> dict[str, typing.Any]: ...
105
- def get_data_in(self, function_call_id: str) -> collections.abc.AsyncIterator[typing.Any]: ...
136
+ def get_data_in(self, function_call_id: str) -> collections.abc.AsyncIterator[typing.Any]:
137
+ """Read from the `data_in` stream of a function call."""
138
+ ...
139
+
106
140
  async def put_data_out(
107
141
  self, function_call_id: str, start_index: int, data_format: int, serialized_messages: list[typing.Any]
108
- ) -> None: ...
142
+ ) -> None:
143
+ """Put data onto the `data_out` stream of a function call.
144
+
145
+ This is used for generator outputs, which includes web endpoint responses. Note that this
146
+ was introduced as a performance optimization in client version 0.57, so older clients will
147
+ still use the previous Postgres-backed system based on `FunctionPutOutputs()`.
148
+ """
149
+ ...
150
+
109
151
  async def generator_output_task(
110
152
  self, function_call_id: str, data_format: int, message_rx: asyncio.queues.Queue
111
- ) -> None: ...
112
- async def _queue_create(self, size: int) -> asyncio.queues.Queue: ...
113
- async def _queue_put(self, queue: asyncio.queues.Queue, value: typing.Any) -> None: ...
153
+ ) -> None:
154
+ """Task that feeds generator outputs into a function call's `data_out` stream."""
155
+ ...
156
+
157
+ async def _queue_create(self, size: int) -> asyncio.queues.Queue:
158
+ """Create a queue, on the synchronicity event loop (needed on Python 3.8 and 3.9)."""
159
+ ...
160
+
161
+ async def _queue_put(self, queue: asyncio.queues.Queue, value: typing.Any) -> None:
162
+ """Put a value onto a queue, using the synchronicity event loop."""
163
+ ...
164
+
114
165
  def get_average_call_time(self) -> float: ...
115
166
  def get_max_inputs_to_fetch(self): ...
116
167
  def _generate_inputs(
@@ -131,15 +182,33 @@ class _ContainerIOManager:
131
182
  ) -> None: ...
132
183
  def serialize_exception(self, exc: BaseException) -> bytes: ...
133
184
  def serialize_traceback(self, exc: BaseException) -> tuple[typing.Optional[bytes], typing.Optional[bytes]]: ...
134
- def handle_user_exception(self) -> typing.AsyncContextManager[None]: ...
135
- def handle_input_exception(self, io_context: IOContext, started_at: float) -> typing.AsyncContextManager[None]: ...
185
+ def handle_user_exception(self) -> typing.AsyncContextManager[None]:
186
+ """Sets the task as failed in a way where it's not retried.
187
+
188
+ Used for handling exceptions from container lifecycle methods at the moment, which should
189
+ trigger a task failure state.
190
+ """
191
+ ...
192
+
193
+ def handle_input_exception(self, io_context: IOContext, started_at: float) -> typing.AsyncContextManager[None]:
194
+ """Handle an exception while processing a function input."""
195
+ ...
196
+
136
197
  def exit_context(self, started_at, input_ids: list[str]): ...
137
198
  async def push_outputs(
138
199
  self, io_context: IOContext, started_at: float, data: typing.Any, data_format: int
139
200
  ) -> None: ...
140
201
  async def memory_restore(self) -> None: ...
141
- async def memory_snapshot(self) -> None: ...
142
- async def volume_commit(self, volume_ids: list[str]) -> None: ...
202
+ async def memory_snapshot(self) -> None:
203
+ """Message server indicating that function is ready to be checkpointed."""
204
+ ...
205
+
206
+ async def volume_commit(self, volume_ids: list[str]) -> None:
207
+ """Perform volume commit for given `volume_ids`.
208
+ Only used on container exit to persist uncommitted changes on behalf of user.
209
+ """
210
+ ...
211
+
143
212
  async def interact(self, from_breakpoint: bool = False): ...
144
213
  @property
145
214
  def target_concurrency(self) -> int: ...
@@ -148,15 +217,35 @@ class _ContainerIOManager:
148
217
  @property
149
218
  def input_concurrency_enabled(self) -> int: ...
150
219
  @classmethod
151
- def get_input_concurrency(cls) -> int: ...
220
+ def get_input_concurrency(cls) -> int:
221
+ """Returns the number of usable input slots.
222
+
223
+ If concurrency is reduced, active slots can exceed allotted slots. Returns the larger value
224
+ in this case.
225
+ """
226
+ ...
227
+
152
228
  @classmethod
153
- def set_input_concurrency(cls, concurrency: int): ...
229
+ def set_input_concurrency(cls, concurrency: int):
230
+ """Edit the number of input slots.
231
+
232
+ This disables the background loop which automatically adjusts concurrency
233
+ within [target_concurrency, max_concurrency].
234
+ """
235
+ ...
236
+
154
237
  @classmethod
155
238
  def stop_fetching_inputs(cls): ...
156
239
 
157
240
  SUPERSELF = typing.TypeVar("SUPERSELF", covariant=True)
158
241
 
159
242
  class ContainerIOManager:
243
+ """Synchronizes all RPC calls and network operations for a running container.
244
+
245
+ TODO: maybe we shouldn't synchronize the whole class.
246
+ Then we could potentially move a bunch of the global functions onto it.
247
+ """
248
+
160
249
  task_id: str
161
250
  function_id: str
162
251
  app_id: str
@@ -182,12 +271,17 @@ class ContainerIOManager:
182
271
  _GENERATOR_STOP_SENTINEL: typing.ClassVar[Sentinel]
183
272
  _singleton: typing.ClassVar[typing.Optional[ContainerIOManager]]
184
273
 
185
- def __init__(self, /, *args, **kwargs): ...
274
+ def __init__(self, /, *args, **kwargs):
275
+ """Initialize self. See help(type(self)) for accurate signature."""
276
+ ...
277
+
186
278
  def _init(self, container_args: modal_proto.api_pb2.ContainerArguments, client: modal.client.Client): ...
187
279
  @property
188
280
  def heartbeat_condition(self) -> asyncio.locks.Condition: ...
189
281
  @classmethod
190
- def _reset_singleton(cls): ...
282
+ def _reset_singleton(cls):
283
+ """Only used for tests."""
284
+ ...
191
285
 
192
286
  class __hello_spec(typing_extensions.Protocol[SUPERSELF]):
193
287
  def __call__(self, /): ...
@@ -238,36 +332,71 @@ class ContainerIOManager:
238
332
  format_blob_data: __format_blob_data_spec[typing_extensions.Self]
239
333
 
240
334
  class __get_data_in_spec(typing_extensions.Protocol[SUPERSELF]):
241
- def __call__(self, /, function_call_id: str) -> typing.Iterator[typing.Any]: ...
242
- def aio(self, /, function_call_id: str) -> collections.abc.AsyncIterator[typing.Any]: ...
335
+ def __call__(self, /, function_call_id: str) -> typing.Iterator[typing.Any]:
336
+ """Read from the `data_in` stream of a function call."""
337
+ ...
338
+
339
+ def aio(self, /, function_call_id: str) -> collections.abc.AsyncIterator[typing.Any]:
340
+ """Read from the `data_in` stream of a function call."""
341
+ ...
243
342
 
244
343
  get_data_in: __get_data_in_spec[typing_extensions.Self]
245
344
 
246
345
  class __put_data_out_spec(typing_extensions.Protocol[SUPERSELF]):
247
346
  def __call__(
248
347
  self, /, function_call_id: str, start_index: int, data_format: int, serialized_messages: list[typing.Any]
249
- ) -> None: ...
348
+ ) -> None:
349
+ """Put data onto the `data_out` stream of a function call.
350
+
351
+ This is used for generator outputs, which includes web endpoint responses. Note that this
352
+ was introduced as a performance optimization in client version 0.57, so older clients will
353
+ still use the previous Postgres-backed system based on `FunctionPutOutputs()`.
354
+ """
355
+ ...
356
+
250
357
  async def aio(
251
358
  self, /, function_call_id: str, start_index: int, data_format: int, serialized_messages: list[typing.Any]
252
- ) -> None: ...
359
+ ) -> None:
360
+ """Put data onto the `data_out` stream of a function call.
361
+
362
+ This is used for generator outputs, which includes web endpoint responses. Note that this
363
+ was introduced as a performance optimization in client version 0.57, so older clients will
364
+ still use the previous Postgres-backed system based on `FunctionPutOutputs()`.
365
+ """
366
+ ...
253
367
 
254
368
  put_data_out: __put_data_out_spec[typing_extensions.Self]
255
369
 
256
370
  class __generator_output_task_spec(typing_extensions.Protocol[SUPERSELF]):
257
- def __call__(self, /, function_call_id: str, data_format: int, message_rx: asyncio.queues.Queue) -> None: ...
258
- async def aio(self, /, function_call_id: str, data_format: int, message_rx: asyncio.queues.Queue) -> None: ...
371
+ def __call__(self, /, function_call_id: str, data_format: int, message_rx: asyncio.queues.Queue) -> None:
372
+ """Task that feeds generator outputs into a function call's `data_out` stream."""
373
+ ...
374
+
375
+ async def aio(self, /, function_call_id: str, data_format: int, message_rx: asyncio.queues.Queue) -> None:
376
+ """Task that feeds generator outputs into a function call's `data_out` stream."""
377
+ ...
259
378
 
260
379
  generator_output_task: __generator_output_task_spec[typing_extensions.Self]
261
380
 
262
381
  class ___queue_create_spec(typing_extensions.Protocol[SUPERSELF]):
263
- def __call__(self, /, size: int) -> asyncio.queues.Queue: ...
264
- async def aio(self, /, size: int) -> asyncio.queues.Queue: ...
382
+ def __call__(self, /, size: int) -> asyncio.queues.Queue:
383
+ """Create a queue, on the synchronicity event loop (needed on Python 3.8 and 3.9)."""
384
+ ...
385
+
386
+ async def aio(self, /, size: int) -> asyncio.queues.Queue:
387
+ """Create a queue, on the synchronicity event loop (needed on Python 3.8 and 3.9)."""
388
+ ...
265
389
 
266
390
  _queue_create: ___queue_create_spec[typing_extensions.Self]
267
391
 
268
392
  class ___queue_put_spec(typing_extensions.Protocol[SUPERSELF]):
269
- def __call__(self, /, queue: asyncio.queues.Queue, value: typing.Any) -> None: ...
270
- async def aio(self, /, queue: asyncio.queues.Queue, value: typing.Any) -> None: ...
393
+ def __call__(self, /, queue: asyncio.queues.Queue, value: typing.Any) -> None:
394
+ """Put a value onto a queue, using the synchronicity event loop."""
395
+ ...
396
+
397
+ async def aio(self, /, queue: asyncio.queues.Queue, value: typing.Any) -> None:
398
+ """Put a value onto a queue, using the synchronicity event loop."""
399
+ ...
271
400
 
272
401
  _queue_put: ___queue_put_spec[typing_extensions.Self]
273
402
 
@@ -326,16 +455,34 @@ class ContainerIOManager:
326
455
  def serialize_traceback(self, exc: BaseException) -> tuple[typing.Optional[bytes], typing.Optional[bytes]]: ...
327
456
 
328
457
  class __handle_user_exception_spec(typing_extensions.Protocol[SUPERSELF]):
329
- def __call__(self, /) -> synchronicity.combined_types.AsyncAndBlockingContextManager[None]: ...
330
- def aio(self, /) -> typing.AsyncContextManager[None]: ...
458
+ def __call__(self, /) -> synchronicity.combined_types.AsyncAndBlockingContextManager[None]:
459
+ """Sets the task as failed in a way where it's not retried.
460
+
461
+ Used for handling exceptions from container lifecycle methods at the moment, which should
462
+ trigger a task failure state.
463
+ """
464
+ ...
465
+
466
+ def aio(self, /) -> typing.AsyncContextManager[None]:
467
+ """Sets the task as failed in a way where it's not retried.
468
+
469
+ Used for handling exceptions from container lifecycle methods at the moment, which should
470
+ trigger a task failure state.
471
+ """
472
+ ...
331
473
 
332
474
  handle_user_exception: __handle_user_exception_spec[typing_extensions.Self]
333
475
 
334
476
  class __handle_input_exception_spec(typing_extensions.Protocol[SUPERSELF]):
335
477
  def __call__(
336
478
  self, /, io_context: IOContext, started_at: float
337
- ) -> synchronicity.combined_types.AsyncAndBlockingContextManager[None]: ...
338
- def aio(self, /, io_context: IOContext, started_at: float) -> typing.AsyncContextManager[None]: ...
479
+ ) -> synchronicity.combined_types.AsyncAndBlockingContextManager[None]:
480
+ """Handle an exception while processing a function input."""
481
+ ...
482
+
483
+ def aio(self, /, io_context: IOContext, started_at: float) -> typing.AsyncContextManager[None]:
484
+ """Handle an exception while processing a function input."""
485
+ ...
339
486
 
340
487
  handle_input_exception: __handle_input_exception_spec[typing_extensions.Self]
341
488
 
@@ -356,14 +503,28 @@ class ContainerIOManager:
356
503
  memory_restore: __memory_restore_spec[typing_extensions.Self]
357
504
 
358
505
  class __memory_snapshot_spec(typing_extensions.Protocol[SUPERSELF]):
359
- def __call__(self, /) -> None: ...
360
- async def aio(self, /) -> None: ...
506
+ def __call__(self, /) -> None:
507
+ """Message server indicating that function is ready to be checkpointed."""
508
+ ...
509
+
510
+ async def aio(self, /) -> None:
511
+ """Message server indicating that function is ready to be checkpointed."""
512
+ ...
361
513
 
362
514
  memory_snapshot: __memory_snapshot_spec[typing_extensions.Self]
363
515
 
364
516
  class __volume_commit_spec(typing_extensions.Protocol[SUPERSELF]):
365
- def __call__(self, /, volume_ids: list[str]) -> None: ...
366
- async def aio(self, /, volume_ids: list[str]) -> None: ...
517
+ def __call__(self, /, volume_ids: list[str]) -> None:
518
+ """Perform volume commit for given `volume_ids`.
519
+ Only used on container exit to persist uncommitted changes on behalf of user.
520
+ """
521
+ ...
522
+
523
+ async def aio(self, /, volume_ids: list[str]) -> None:
524
+ """Perform volume commit for given `volume_ids`.
525
+ Only used on container exit to persist uncommitted changes on behalf of user.
526
+ """
527
+ ...
367
528
 
368
529
  volume_commit: __volume_commit_spec[typing_extensions.Self]
369
530
 
@@ -380,13 +541,34 @@ class ContainerIOManager:
380
541
  @property
381
542
  def input_concurrency_enabled(self) -> int: ...
382
543
  @classmethod
383
- def get_input_concurrency(cls) -> int: ...
544
+ def get_input_concurrency(cls) -> int:
545
+ """Returns the number of usable input slots.
546
+
547
+ If concurrency is reduced, active slots can exceed allotted slots. Returns the larger value
548
+ in this case.
549
+ """
550
+ ...
551
+
384
552
  @classmethod
385
- def set_input_concurrency(cls, concurrency: int): ...
553
+ def set_input_concurrency(cls, concurrency: int):
554
+ """Edit the number of input slots.
555
+
556
+ This disables the background loop which automatically adjusts concurrency
557
+ within [target_concurrency, max_concurrency].
558
+ """
559
+ ...
560
+
386
561
  @classmethod
387
562
  def stop_fetching_inputs(cls): ...
388
563
 
389
- def check_fastapi_pydantic_compatibility(exc: ImportError) -> None: ...
564
+ def check_fastapi_pydantic_compatibility(exc: ImportError) -> None:
565
+ """Add a helpful note to an exception that is likely caused by a pydantic<>fastapi version incompatibility.
566
+
567
+ We need this becasue the legacy set of container requirements (image_builder_version=2023.12) contains a
568
+ version of fastapi that is not forwards-compatible with pydantic 2.0+, and users commonly run into issues
569
+ building an image that specifies a more recent version only for pydantic.
570
+ """
571
+ ...
390
572
 
391
573
  MAX_OUTPUT_BATCH_SIZE: int
392
574
 
@@ -0,0 +1,78 @@
1
+ import collections.abc
2
+ import contextvars
3
+ import typing
4
+ import typing_extensions
5
+
6
+ def is_local() -> bool:
7
+ """Returns if we are currently on the machine launching/deploying a Modal app
8
+
9
+ Returns `True` when executed locally on the user's machine.
10
+ Returns `False` when executed from a Modal container in the cloud.
11
+ """
12
+ ...
13
+
14
+ async def _interact() -> None:
15
+ """Enable interactivity with user input inside a Modal container.
16
+
17
+ See the [interactivity guide](https://modal.com/docs/guide/developing-debugging#interactivity)
18
+ for more information on how to use this function.
19
+ """
20
+ ...
21
+
22
+ class __interact_spec(typing_extensions.Protocol):
23
+ def __call__(self, /) -> None:
24
+ """Enable interactivity with user input inside a Modal container.
25
+
26
+ See the [interactivity guide](https://modal.com/docs/guide/developing-debugging#interactivity)
27
+ for more information on how to use this function.
28
+ """
29
+ ...
30
+
31
+ async def aio(self, /) -> None:
32
+ """Enable interactivity with user input inside a Modal container.
33
+
34
+ See the [interactivity guide](https://modal.com/docs/guide/developing-debugging#interactivity)
35
+ for more information on how to use this function.
36
+ """
37
+ ...
38
+
39
+ interact: __interact_spec
40
+
41
+ def current_input_id() -> typing.Optional[str]:
42
+ """Returns the input ID for the current input.
43
+
44
+ Can only be called from Modal function (i.e. in a container context).
45
+
46
+ ```python
47
+ from modal import current_input_id
48
+
49
+ @app.function()
50
+ def process_stuff():
51
+ print(f"Starting to process {current_input_id()}")
52
+ ```
53
+ """
54
+ ...
55
+
56
+ def current_function_call_id() -> typing.Optional[str]:
57
+ """Returns the function call ID for the current input.
58
+
59
+ Can only be called from Modal function (i.e. in a container context).
60
+
61
+ ```python
62
+ from modal import current_function_call_id
63
+
64
+ @app.function()
65
+ def process_stuff():
66
+ print(f"Starting to process input from {current_function_call_id()}")
67
+ ```
68
+ """
69
+ ...
70
+
71
+ def _set_current_context_ids(
72
+ input_ids: list[str], function_call_ids: list[str]
73
+ ) -> collections.abc.Callable[[], None]: ...
74
+ def _import_context(): ...
75
+
76
+ _current_input_id: contextvars.ContextVar
77
+
78
+ _current_function_call_id: contextvars.ContextVar