modal 1.1.2.dev44__tar.gz → 1.1.3.dev0__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 (190) hide show
  1. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/PKG-INFO +1 -1
  2. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_functions.py +68 -1
  3. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/app.py +2 -2
  4. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/client.pyi +2 -2
  5. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/dict.py +7 -0
  6. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/dict.pyi +18 -0
  7. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/functions.pyi +55 -6
  8. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/queue.py +7 -0
  9. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/queue.pyi +18 -0
  10. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/secret.py +7 -0
  11. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/secret.pyi +18 -0
  12. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/volume.py +10 -0
  13. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/volume.pyi +21 -0
  14. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal.egg-info/PKG-INFO +1 -1
  15. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_version/__init__.py +1 -1
  16. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/LICENSE +0 -0
  17. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/README.md +0 -0
  18. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/__init__.py +0 -0
  19. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/__main__.py +0 -0
  20. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_clustered_functions.py +0 -0
  21. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_clustered_functions.pyi +0 -0
  22. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_container_entrypoint.py +0 -0
  23. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_ipython.py +0 -0
  24. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_location.py +0 -0
  25. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_object.py +0 -0
  26. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_output.py +0 -0
  27. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_partial_function.py +0 -0
  28. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_pty.py +0 -0
  29. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_resolver.py +0 -0
  30. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_resources.py +0 -0
  31. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_runtime/__init__.py +0 -0
  32. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_runtime/asgi.py +0 -0
  33. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_runtime/container_io_manager.py +0 -0
  34. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_runtime/container_io_manager.pyi +0 -0
  35. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_runtime/execution_context.py +0 -0
  36. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_runtime/execution_context.pyi +0 -0
  37. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_runtime/gpu_memory_snapshot.py +0 -0
  38. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_runtime/telemetry.py +0 -0
  39. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_runtime/user_code_imports.py +0 -0
  40. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_serialization.py +0 -0
  41. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_traceback.py +0 -0
  42. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_tunnel.py +0 -0
  43. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_tunnel.pyi +0 -0
  44. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_type_manager.py +0 -0
  45. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/__init__.py +0 -0
  46. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/app_utils.py +0 -0
  47. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/async_utils.py +0 -0
  48. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/auth_token_manager.py +0 -0
  49. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/blob_utils.py +0 -0
  50. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/bytes_io_segment_payload.py +0 -0
  51. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/deprecation.py +0 -0
  52. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/docker_utils.py +0 -0
  53. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/function_utils.py +0 -0
  54. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/git_utils.py +0 -0
  55. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/grpc_testing.py +0 -0
  56. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/grpc_utils.py +0 -0
  57. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/hash_utils.py +0 -0
  58. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/http_utils.py +0 -0
  59. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/jwt_utils.py +0 -0
  60. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/logger.py +0 -0
  61. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/mount_utils.py +0 -0
  62. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/name_utils.py +0 -0
  63. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/package_utils.py +0 -0
  64. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/pattern_utils.py +0 -0
  65. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/rand_pb_testing.py +0 -0
  66. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/shell_utils.py +0 -0
  67. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_utils/time_utils.py +0 -0
  68. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_vendor/__init__.py +0 -0
  69. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_vendor/a2wsgi_wsgi.py +0 -0
  70. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_vendor/cloudpickle.py +0 -0
  71. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_vendor/tblib.py +0 -0
  72. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/_watcher.py +0 -0
  73. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/app.pyi +0 -0
  74. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/builder/2023.12.312.txt +0 -0
  75. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/builder/2023.12.txt +0 -0
  76. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/builder/2024.04.txt +0 -0
  77. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/builder/2024.10.txt +0 -0
  78. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/builder/2025.06.txt +0 -0
  79. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/builder/PREVIEW.txt +0 -0
  80. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/builder/README.md +0 -0
  81. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/builder/base-images.json +0 -0
  82. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/call_graph.py +0 -0
  83. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/__init__.py +0 -0
  84. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/_download.py +0 -0
  85. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/_traceback.py +0 -0
  86. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/app.py +0 -0
  87. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/cluster.py +0 -0
  88. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/config.py +0 -0
  89. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/container.py +0 -0
  90. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/dict.py +0 -0
  91. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/entry_point.py +0 -0
  92. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/environment.py +0 -0
  93. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/import_refs.py +0 -0
  94. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/launch.py +0 -0
  95. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/network_file_system.py +0 -0
  96. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/profile.py +0 -0
  97. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/programs/__init__.py +0 -0
  98. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/programs/launch_instance_ssh.py +0 -0
  99. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/programs/run_jupyter.py +0 -0
  100. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/programs/run_marimo.py +0 -0
  101. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/programs/vscode.py +0 -0
  102. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/queues.py +0 -0
  103. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/run.py +0 -0
  104. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/secret.py +0 -0
  105. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/token.py +0 -0
  106. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/utils.py +0 -0
  107. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cli/volume.py +0 -0
  108. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/client.py +0 -0
  109. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cloud_bucket_mount.py +0 -0
  110. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cloud_bucket_mount.pyi +0 -0
  111. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cls.py +0 -0
  112. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/cls.pyi +0 -0
  113. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/config.py +0 -0
  114. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/container_process.py +0 -0
  115. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/container_process.pyi +0 -0
  116. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/environments.py +0 -0
  117. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/environments.pyi +0 -0
  118. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/exception.py +0 -0
  119. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/experimental/__init__.py +0 -0
  120. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/experimental/flash.py +0 -0
  121. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/experimental/flash.pyi +0 -0
  122. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/experimental/ipython.py +0 -0
  123. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/file_io.py +0 -0
  124. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/file_io.pyi +0 -0
  125. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/file_pattern_matcher.py +0 -0
  126. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/functions.py +0 -0
  127. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/gpu.py +0 -0
  128. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/image.py +0 -0
  129. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/image.pyi +0 -0
  130. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/io_streams.py +0 -0
  131. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/io_streams.pyi +0 -0
  132. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/mount.py +0 -0
  133. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/mount.pyi +0 -0
  134. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/network_file_system.py +0 -0
  135. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/network_file_system.pyi +0 -0
  136. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/object.py +0 -0
  137. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/object.pyi +0 -0
  138. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/output.py +0 -0
  139. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/parallel_map.py +0 -0
  140. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/parallel_map.pyi +0 -0
  141. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/partial_function.py +0 -0
  142. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/partial_function.pyi +0 -0
  143. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/proxy.py +0 -0
  144. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/proxy.pyi +0 -0
  145. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/py.typed +0 -0
  146. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/retries.py +0 -0
  147. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/runner.py +0 -0
  148. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/runner.pyi +0 -0
  149. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/running_app.py +0 -0
  150. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/sandbox.py +0 -0
  151. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/sandbox.pyi +0 -0
  152. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/schedule.py +0 -0
  153. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/scheduler_placement.py +0 -0
  154. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/serving.py +0 -0
  155. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/serving.pyi +0 -0
  156. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/snapshot.py +0 -0
  157. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/snapshot.pyi +0 -0
  158. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/stream_type.py +0 -0
  159. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/token_flow.py +0 -0
  160. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal/token_flow.pyi +0 -0
  161. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal.egg-info/SOURCES.txt +0 -0
  162. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal.egg-info/dependency_links.txt +0 -0
  163. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal.egg-info/entry_points.txt +0 -0
  164. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal.egg-info/requires.txt +0 -0
  165. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal.egg-info/top_level.txt +0 -0
  166. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_docs/__init__.py +0 -0
  167. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_docs/gen_cli_docs.py +0 -0
  168. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_docs/gen_reference_docs.py +0 -0
  169. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_docs/mdmd/__init__.py +0 -0
  170. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_docs/mdmd/mdmd.py +0 -0
  171. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_docs/mdmd/signatures.py +0 -0
  172. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_proto/__init__.py +0 -0
  173. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_proto/api.proto +0 -0
  174. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_proto/api_grpc.py +0 -0
  175. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_proto/api_pb2.py +0 -0
  176. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_proto/api_pb2.pyi +0 -0
  177. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_proto/api_pb2_grpc.py +0 -0
  178. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_proto/api_pb2_grpc.pyi +0 -0
  179. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_proto/modal_api_grpc.py +0 -0
  180. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_proto/modal_options_grpc.py +0 -0
  181. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_proto/options.proto +0 -0
  182. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_proto/options_grpc.py +0 -0
  183. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_proto/options_pb2.py +0 -0
  184. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_proto/options_pb2.pyi +0 -0
  185. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_proto/options_pb2_grpc.py +0 -0
  186. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_proto/options_pb2_grpc.pyi +0 -0
  187. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_proto/py.typed +0 -0
  188. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/modal_version/__main__.py +0 -0
  189. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/pyproject.toml +0 -0
  190. {modal-1.1.2.dev44 → modal-1.1.3.dev0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 1.1.2.dev44
3
+ Version: 1.1.3.dev0
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License: Apache-2.0
@@ -9,7 +9,7 @@ import warnings
9
9
  from collections.abc import AsyncGenerator, Sequence, Sized
10
10
  from dataclasses import dataclass
11
11
  from pathlib import PurePosixPath
12
- from typing import TYPE_CHECKING, Any, Callable, Optional, Union
12
+ from typing import TYPE_CHECKING, Any, AsyncIterator, Callable, Optional, Union
13
13
 
14
14
  import typing_extensions
15
15
  from google.protobuf.message import Message
@@ -360,6 +360,43 @@ class _Invocation:
360
360
  if items_total is not None and items_received >= items_total:
361
361
  break
362
362
 
363
+ async def enumerate(self, start_index: int, end_index: int):
364
+ """Iterate over the results of the function call in the range [start_index, end_index)."""
365
+ limit = 49
366
+ current_index = start_index
367
+ while current_index < end_index:
368
+ # batch_end_indx is inclusive, so we subtract 1 to get the last index in the batch.
369
+ batch_end_index = min(current_index + limit, end_index) - 1
370
+ request = api_pb2.FunctionGetOutputsRequest(
371
+ function_call_id=self.function_call_id,
372
+ timeout=0,
373
+ last_entry_id="0-0",
374
+ clear_on_success=False,
375
+ requested_at=time.time(),
376
+ start_idx=current_index,
377
+ end_idx=batch_end_index,
378
+ )
379
+ response: api_pb2.FunctionGetOutputsResponse = await retry_transient_errors(
380
+ self.stub.FunctionGetOutputs,
381
+ request,
382
+ attempt_timeout=ATTEMPT_TIMEOUT_GRACE_PERIOD,
383
+ )
384
+
385
+ outputs = list(response.outputs)
386
+ outputs.sort(key=lambda x: x.idx)
387
+ for output in outputs:
388
+ if output.idx != current_index:
389
+ break
390
+ result = await _process_result(output.result, output.data_format, self.stub, self.client)
391
+ yield output.idx, result
392
+ current_index += 1
393
+
394
+ # We're missing current_index, so we need to poll the function for the next result
395
+ if len(outputs) < (batch_end_index - current_index + 1):
396
+ result = await self.poll_function(index=current_index)
397
+ yield current_index, result
398
+ current_index += 1
399
+
363
400
 
364
401
  class _InputPlaneInvocation:
365
402
  """Internal client representation of a single-input call to a Modal Function using the input
@@ -1865,6 +1902,36 @@ class _FunctionCall(typing.Generic[ReturnType], _Object, type_prefix="fc"):
1865
1902
  """
1866
1903
  return await self._invocation().poll_function(timeout=timeout, index=index)
1867
1904
 
1905
+ @live_method_gen
1906
+ async def iter(self, *, start: int = 0, end: Optional[int] = None) -> AsyncIterator[ReturnType]:
1907
+ """Iterate in-order over the results of the function call.
1908
+
1909
+ Optionally, specify a range [start, end) to iterate over.
1910
+
1911
+ Example:
1912
+ ```python
1913
+ @app.function()
1914
+ def my_func(a):
1915
+ return a ** 2
1916
+
1917
+
1918
+ @app.local_entrypoint()
1919
+ def main():
1920
+ fc = my_func.spawn_map([1, 2, 3, 4])
1921
+ assert list(fc.iter()) == [1, 4, 9, 16]
1922
+ assert list(fc.iter(start=1, end=3)) == [4, 9]
1923
+ ```
1924
+
1925
+ If `end` is not provided, it will iterate over all results.
1926
+ """
1927
+ num_inputs = await self.num_inputs()
1928
+ if end is None:
1929
+ end = num_inputs
1930
+ if start < 0 or end > num_inputs:
1931
+ raise ValueError(f"Invalid index range: {start} to {end} for {num_inputs} inputs")
1932
+ async for _, item in self._invocation().enumerate(start_index=start, end_index=end):
1933
+ yield item
1934
+
1868
1935
  async def get_call_graph(self) -> list[InputInfo]:
1869
1936
  """Returns a structure representing the call graph from a given root
1870
1937
  call ID, along with the status of execution for each node.
@@ -641,7 +641,7 @@ class _App:
641
641
  scaledown_window: Optional[int] = None, # Max time (in seconds) a container can remain idle while scaling down.
642
642
  proxy: Optional[_Proxy] = None, # Reference to a Modal Proxy to use in front of this function.
643
643
  retries: Optional[Union[int, Retries]] = None, # Number of times to retry each input in case of failure.
644
- timeout: int = 300, # Maximum execution time of the function in seconds.
644
+ timeout: int = 300, # Maximum execution time in seconds.
645
645
  name: Optional[str] = None, # Sets the Modal name of the function within the app
646
646
  is_generator: Optional[
647
647
  bool
@@ -869,7 +869,7 @@ class _App:
869
869
  scaledown_window: Optional[int] = None, # Max time (in seconds) a container can remain idle while scaling down.
870
870
  proxy: Optional[_Proxy] = None, # Reference to a Modal Proxy to use in front of this function.
871
871
  retries: Optional[Union[int, Retries]] = None, # Number of times to retry each input in case of failure.
872
- timeout: int = 300, # Maximum execution time of the function in seconds.
872
+ timeout: int = 300, # Maximum execution time in seconds; applies independently to startup and each input.
873
873
  cloud: Optional[str] = None, # Cloud provider to run the function on. Possible values are aws, gcp, oci, auto.
874
874
  region: Optional[Union[str, Sequence[str]]] = None, # Region or regions to run the function on.
875
875
  enable_memory_snapshot: bool = False, # Enable memory checkpointing for faster cold starts.
@@ -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.1.2.dev44",
36
+ version: str = "1.1.3.dev0",
37
37
  ):
38
38
  """mdmd:hidden
39
39
  The Modal client object is not intended to be instantiated directly by users.
@@ -164,7 +164,7 @@ class Client:
164
164
  server_url: str,
165
165
  client_type: int,
166
166
  credentials: typing.Optional[tuple[str, str]],
167
- version: str = "1.1.2.dev44",
167
+ version: str = "1.1.3.dev0",
168
168
  ):
169
169
  """mdmd:hidden
170
170
  The Modal client object is not intended to be instantiated directly by users.
@@ -81,6 +81,8 @@ class _DictManager:
81
81
  Note that this method does not return a local instance of the Dict. You can use
82
82
  `modal.Dict.from_name` to perform a lookup after creation.
83
83
 
84
+ Added in v1.1.2.
85
+
84
86
  """
85
87
  check_object_name(name, "Dict")
86
88
  client = await _Client.from_env() if client is None else client
@@ -132,6 +134,8 @@ class _DictManager:
132
134
  dicts = modal.Dict.objects.list(max_objects=10, created_before="2025-01-01")
133
135
  ```
134
136
 
137
+ Added in v1.1.2.
138
+
135
139
  """
136
140
  client = await _Client.from_env() if client is None else client
137
141
  if max_objects is not None and max_objects < 0:
@@ -192,6 +196,9 @@ class _DictManager:
192
196
  ```python notest
193
197
  await modal.Dict.objects.delete("my-dict", environment_name="dev")
194
198
  ```
199
+
200
+ Added in v1.1.2.
201
+
195
202
  """
196
203
  try:
197
204
  obj = await _Dict.from_name(name, environment_name=environment_name).hydrate(client)
@@ -66,6 +66,8 @@ class _DictManager:
66
66
 
67
67
  Note that this method does not return a local instance of the Dict. You can use
68
68
  `modal.Dict.from_name` to perform a lookup after creation.
69
+
70
+ Added in v1.1.2.
69
71
  """
70
72
  ...
71
73
 
@@ -98,6 +100,8 @@ class _DictManager:
98
100
  ```python
99
101
  dicts = modal.Dict.objects.list(max_objects=10, created_before="2025-01-01")
100
102
  ```
103
+
104
+ Added in v1.1.2.
101
105
  """
102
106
  ...
103
107
 
@@ -125,6 +129,8 @@ class _DictManager:
125
129
  ```python notest
126
130
  await modal.Dict.objects.delete("my-dict", environment_name="dev")
127
131
  ```
132
+
133
+ Added in v1.1.2.
128
134
  """
129
135
  ...
130
136
 
@@ -167,6 +173,8 @@ class DictManager:
167
173
 
168
174
  Note that this method does not return a local instance of the Dict. You can use
169
175
  `modal.Dict.from_name` to perform a lookup after creation.
176
+
177
+ Added in v1.1.2.
170
178
  """
171
179
  ...
172
180
 
@@ -202,6 +210,8 @@ class DictManager:
202
210
 
203
211
  Note that this method does not return a local instance of the Dict. You can use
204
212
  `modal.Dict.from_name` to perform a lookup after creation.
213
+
214
+ Added in v1.1.2.
205
215
  """
206
216
  ...
207
217
 
@@ -238,6 +248,8 @@ class DictManager:
238
248
  ```python
239
249
  dicts = modal.Dict.objects.list(max_objects=10, created_before="2025-01-01")
240
250
  ```
251
+
252
+ Added in v1.1.2.
241
253
  """
242
254
  ...
243
255
 
@@ -271,6 +283,8 @@ class DictManager:
271
283
  ```python
272
284
  dicts = modal.Dict.objects.list(max_objects=10, created_before="2025-01-01")
273
285
  ```
286
+
287
+ Added in v1.1.2.
274
288
  """
275
289
  ...
276
290
 
@@ -302,6 +316,8 @@ class DictManager:
302
316
  ```python notest
303
317
  await modal.Dict.objects.delete("my-dict", environment_name="dev")
304
318
  ```
319
+
320
+ Added in v1.1.2.
305
321
  """
306
322
  ...
307
323
 
@@ -330,6 +346,8 @@ class DictManager:
330
346
  ```python notest
331
347
  await modal.Dict.objects.delete("my-dict", environment_name="dev")
332
348
  ```
349
+
350
+ Added in v1.1.2.
333
351
  """
334
352
  ...
335
353
 
@@ -433,7 +433,7 @@ class Function(
433
433
 
434
434
  _call_generator: ___call_generator_spec[typing_extensions.Self]
435
435
 
436
- class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
436
+ class __remote_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
437
437
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER:
438
438
  """Calls the function remotely, executing it with the given arguments and returning the execution's result."""
439
439
  ...
@@ -442,7 +442,7 @@ class Function(
442
442
  """Calls the function remotely, executing it with the given arguments and returning the execution's result."""
443
443
  ...
444
444
 
445
- remote: __remote_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
445
+ remote: __remote_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
446
446
 
447
447
  class __remote_gen_spec(typing_extensions.Protocol[SUPERSELF]):
448
448
  def __call__(self, /, *args, **kwargs) -> typing.Generator[typing.Any, None, None]:
@@ -469,7 +469,7 @@ class Function(
469
469
  """
470
470
  ...
471
471
 
472
- class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
472
+ class ___experimental_spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
473
473
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
474
474
  """[Experimental] Calls the function with the given arguments, without waiting for the results.
475
475
 
@@ -493,7 +493,7 @@ class Function(
493
493
  ...
494
494
 
495
495
  _experimental_spawn: ___experimental_spawn_spec[
496
- modal._functions.ReturnType, modal._functions.P, typing_extensions.Self
496
+ modal._functions.P, modal._functions.ReturnType, typing_extensions.Self
497
497
  ]
498
498
 
499
499
  class ___spawn_map_inner_spec(typing_extensions.Protocol[P_INNER, SUPERSELF]):
@@ -502,7 +502,7 @@ class Function(
502
502
 
503
503
  _spawn_map_inner: ___spawn_map_inner_spec[modal._functions.P, typing_extensions.Self]
504
504
 
505
- class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
505
+ class __spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
506
506
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
507
507
  """Calls the function with the given arguments, without waiting for the results.
508
508
 
@@ -523,7 +523,7 @@ class Function(
523
523
  """
524
524
  ...
525
525
 
526
- spawn: __spawn_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
526
+ spawn: __spawn_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
527
527
 
528
528
  def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]:
529
529
  """Return the inner Python object wrapped by this Modal Function."""
@@ -788,6 +788,55 @@ class FunctionCall(typing.Generic[modal._functions.ReturnType], modal.object.Obj
788
788
 
789
789
  get: __get_spec[modal._functions.ReturnType, typing_extensions.Self]
790
790
 
791
+ class __iter_spec(typing_extensions.Protocol[ReturnType_INNER, SUPERSELF]):
792
+ def __call__(self, /, *, start: int = 0, end: typing.Optional[int] = None) -> typing.Iterator[ReturnType_INNER]:
793
+ """Iterate in-order over the results of the function call.
794
+
795
+ Optionally, specify a range [start, end) to iterate over.
796
+
797
+ Example:
798
+ ```python
799
+ @app.function()
800
+ def my_func(a):
801
+ return a ** 2
802
+
803
+
804
+ @app.local_entrypoint()
805
+ def main():
806
+ fc = my_func.spawn_map([1, 2, 3, 4])
807
+ assert list(fc.iter()) == [1, 4, 9, 16]
808
+ assert list(fc.iter(start=1, end=3)) == [4, 9]
809
+ ```
810
+
811
+ If `end` is not provided, it will iterate over all results.
812
+ """
813
+ ...
814
+
815
+ def aio(self, /, *, start: int = 0, end: typing.Optional[int] = None) -> typing.AsyncIterator[ReturnType_INNER]:
816
+ """Iterate in-order over the results of the function call.
817
+
818
+ Optionally, specify a range [start, end) to iterate over.
819
+
820
+ Example:
821
+ ```python
822
+ @app.function()
823
+ def my_func(a):
824
+ return a ** 2
825
+
826
+
827
+ @app.local_entrypoint()
828
+ def main():
829
+ fc = my_func.spawn_map([1, 2, 3, 4])
830
+ assert list(fc.iter()) == [1, 4, 9, 16]
831
+ assert list(fc.iter(start=1, end=3)) == [4, 9]
832
+ ```
833
+
834
+ If `end` is not provided, it will iterate over all results.
835
+ """
836
+ ...
837
+
838
+ iter: __iter_spec[modal._functions.ReturnType, typing_extensions.Self]
839
+
791
840
  class __get_call_graph_spec(typing_extensions.Protocol[SUPERSELF]):
792
841
  def __call__(self, /) -> list[modal.call_graph.InputInfo]:
793
842
  """Returns a structure representing the call graph from a given root
@@ -79,6 +79,8 @@ class _QueueManager:
79
79
  Note that this method does not return a local instance of the Queue. You can use
80
80
  `modal.Queue.from_name` to perform a lookup after creation.
81
81
 
82
+ Added in v1.1.2.
83
+
82
84
  """
83
85
  check_object_name(name, "Queue")
84
86
  client = await _Client.from_env() if client is None else client
@@ -130,6 +132,8 @@ class _QueueManager:
130
132
  queues = modal.Queue.objects.list(max_objects=10, created_before="2025-01-01")
131
133
  ```
132
134
 
135
+ Added in v1.1.2.
136
+
133
137
  """
134
138
  client = await _Client.from_env() if client is None else client
135
139
  if max_objects is not None and max_objects < 0:
@@ -190,6 +194,9 @@ class _QueueManager:
190
194
  ```python notest
191
195
  await modal.Queue.objects.delete("my-queue", environment_name="dev")
192
196
  ```
197
+
198
+ Added in v1.1.2.
199
+
193
200
  """
194
201
  try:
195
202
  obj = await _Queue.from_name(name, environment_name=environment_name).hydrate(client)
@@ -64,6 +64,8 @@ class _QueueManager:
64
64
 
65
65
  Note that this method does not return a local instance of the Queue. You can use
66
66
  `modal.Queue.from_name` to perform a lookup after creation.
67
+
68
+ Added in v1.1.2.
67
69
  """
68
70
  ...
69
71
 
@@ -96,6 +98,8 @@ class _QueueManager:
96
98
  ```python
97
99
  queues = modal.Queue.objects.list(max_objects=10, created_before="2025-01-01")
98
100
  ```
101
+
102
+ Added in v1.1.2.
99
103
  """
100
104
  ...
101
105
 
@@ -123,6 +127,8 @@ class _QueueManager:
123
127
  ```python notest
124
128
  await modal.Queue.objects.delete("my-queue", environment_name="dev")
125
129
  ```
130
+
131
+ Added in v1.1.2.
126
132
  """
127
133
  ...
128
134
 
@@ -165,6 +171,8 @@ class QueueManager:
165
171
 
166
172
  Note that this method does not return a local instance of the Queue. You can use
167
173
  `modal.Queue.from_name` to perform a lookup after creation.
174
+
175
+ Added in v1.1.2.
168
176
  """
169
177
  ...
170
178
 
@@ -200,6 +208,8 @@ class QueueManager:
200
208
 
201
209
  Note that this method does not return a local instance of the Queue. You can use
202
210
  `modal.Queue.from_name` to perform a lookup after creation.
211
+
212
+ Added in v1.1.2.
203
213
  """
204
214
  ...
205
215
 
@@ -236,6 +246,8 @@ class QueueManager:
236
246
  ```python
237
247
  queues = modal.Queue.objects.list(max_objects=10, created_before="2025-01-01")
238
248
  ```
249
+
250
+ Added in v1.1.2.
239
251
  """
240
252
  ...
241
253
 
@@ -269,6 +281,8 @@ class QueueManager:
269
281
  ```python
270
282
  queues = modal.Queue.objects.list(max_objects=10, created_before="2025-01-01")
271
283
  ```
284
+
285
+ Added in v1.1.2.
272
286
  """
273
287
  ...
274
288
 
@@ -300,6 +314,8 @@ class QueueManager:
300
314
  ```python notest
301
315
  await modal.Queue.objects.delete("my-queue", environment_name="dev")
302
316
  ```
317
+
318
+ Added in v1.1.2.
303
319
  """
304
320
  ...
305
321
 
@@ -328,6 +344,8 @@ class QueueManager:
328
344
  ```python notest
329
345
  await modal.Queue.objects.delete("my-queue", environment_name="dev")
330
346
  ```
347
+
348
+ Added in v1.1.2.
331
349
  """
332
350
  ...
333
351
 
@@ -74,6 +74,8 @@ class _SecretManager:
74
74
  Note that this method does not return a local instance of the Secret. You can use
75
75
  `modal.Secret.from_name` to perform a lookup after creation.
76
76
 
77
+ Added in v1.1.2.
78
+
77
79
  """
78
80
  check_object_name(name, "Secret")
79
81
  client = await _Client.from_env() if client is None else client
@@ -126,6 +128,8 @@ class _SecretManager:
126
128
  secrets = modal.Secret.objects.list(max_objects=10, created_before="2025-01-01")
127
129
  ```
128
130
 
131
+ Added in v1.1.2.
132
+
129
133
  """
130
134
  client = await _Client.from_env() if client is None else client
131
135
  if max_objects is not None and max_objects < 0:
@@ -185,6 +189,9 @@ class _SecretManager:
185
189
  ```python notest
186
190
  await modal.Secret.objects.delete("my-secret", environment_name="dev")
187
191
  ```
192
+
193
+ Added in v1.1.2.
194
+
188
195
  """
189
196
  try:
190
197
  obj = await _Secret.from_name(name, environment_name=environment_name).hydrate(client)
@@ -65,6 +65,8 @@ class _SecretManager:
65
65
 
66
66
  Note that this method does not return a local instance of the Secret. You can use
67
67
  `modal.Secret.from_name` to perform a lookup after creation.
68
+
69
+ Added in v1.1.2.
68
70
  """
69
71
  ...
70
72
 
@@ -97,6 +99,8 @@ class _SecretManager:
97
99
  ```python
98
100
  secrets = modal.Secret.objects.list(max_objects=10, created_before="2025-01-01")
99
101
  ```
102
+
103
+ Added in v1.1.2.
100
104
  """
101
105
  ...
102
106
 
@@ -123,6 +127,8 @@ class _SecretManager:
123
127
  ```python notest
124
128
  await modal.Secret.objects.delete("my-secret", environment_name="dev")
125
129
  ```
130
+
131
+ Added in v1.1.2.
126
132
  """
127
133
  ...
128
134
 
@@ -168,6 +174,8 @@ class SecretManager:
168
174
 
169
175
  Note that this method does not return a local instance of the Secret. You can use
170
176
  `modal.Secret.from_name` to perform a lookup after creation.
177
+
178
+ Added in v1.1.2.
171
179
  """
172
180
  ...
173
181
 
@@ -206,6 +214,8 @@ class SecretManager:
206
214
 
207
215
  Note that this method does not return a local instance of the Secret. You can use
208
216
  `modal.Secret.from_name` to perform a lookup after creation.
217
+
218
+ Added in v1.1.2.
209
219
  """
210
220
  ...
211
221
 
@@ -242,6 +252,8 @@ class SecretManager:
242
252
  ```python
243
253
  secrets = modal.Secret.objects.list(max_objects=10, created_before="2025-01-01")
244
254
  ```
255
+
256
+ Added in v1.1.2.
245
257
  """
246
258
  ...
247
259
 
@@ -275,6 +287,8 @@ class SecretManager:
275
287
  ```python
276
288
  secrets = modal.Secret.objects.list(max_objects=10, created_before="2025-01-01")
277
289
  ```
290
+
291
+ Added in v1.1.2.
278
292
  """
279
293
  ...
280
294
 
@@ -305,6 +319,8 @@ class SecretManager:
305
319
  ```python notest
306
320
  await modal.Secret.objects.delete("my-secret", environment_name="dev")
307
321
  ```
322
+
323
+ Added in v1.1.2.
308
324
  """
309
325
  ...
310
326
 
@@ -332,6 +348,8 @@ class SecretManager:
332
348
  ```python notest
333
349
  await modal.Secret.objects.delete("my-secret", environment_name="dev")
334
350
  ```
351
+
352
+ Added in v1.1.2.
335
353
  """
336
354
  ...
337
355
 
@@ -139,6 +139,7 @@ class _VolumeManager:
139
139
  modal.Volume.objects.create("my-volume", environment_name="dev")
140
140
  ```
141
141
 
142
+ By default, an error will be raised if the Volume already exists, but passing
142
143
  `allow_existing=True` will make the creation attempt a no-op in this case.
143
144
 
144
145
  ```python notest
@@ -148,6 +149,8 @@ class _VolumeManager:
148
149
  Note that this method does not return a local instance of the Volume. You can use
149
150
  `modal.Volume.from_name` to perform a lookup after creation.
150
151
 
152
+ Added in v1.1.2.
153
+
151
154
  """
152
155
  check_object_name(name, "Volume")
153
156
  client = await _Client.from_env() if client is None else client
@@ -204,6 +207,8 @@ class _VolumeManager:
204
207
  volumes = modal.Volume.objects.list(max_objects=10, created_before="2025-01-01")
205
208
  ```
206
209
 
210
+ Added in v1.1.2.
211
+
207
212
  """
208
213
  client = await _Client.from_env() if client is None else client
209
214
  if max_objects is not None and max_objects < 0:
@@ -264,6 +269,9 @@ class _VolumeManager:
264
269
  ```python notest
265
270
  await modal.Volume.objects.delete("my-volume", environment_name="dev")
266
271
  ```
272
+
273
+ Added in v1.1.2.
274
+
267
275
  """
268
276
  try:
269
277
  obj = await _Volume.from_name(name, environment_name=environment_name).hydrate(client)
@@ -685,6 +693,7 @@ class _Volume(_Object, type_prefix="vo"):
685
693
  except modal.exception.NotFoundError as exc:
686
694
  raise FileNotFoundError(exc.args[0])
687
695
 
696
+ @retry(n_attempts=5, base_delay=0.1, timeout=None)
688
697
  async def read_block(block_url: str) -> bytes:
689
698
  async with ClientSessionRegistry.get_session().get(block_url) as get_response:
690
699
  return await get_response.content.read()
@@ -724,6 +733,7 @@ class _Volume(_Object, type_prefix="vo"):
724
733
  write_lock = asyncio.Lock()
725
734
  start_pos = fileobj.tell()
726
735
 
736
+ @retry(n_attempts=5, base_delay=0.1, timeout=None)
727
737
  async def download_block(idx, url) -> int:
728
738
  block_start_pos = start_pos + idx * BLOCK_SIZE
729
739
  num_bytes_written = 0