modal 1.7.0.dev1__tar.gz → 1.7.0.dev2__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 (258) hide show
  1. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/PKG-INFO +1 -1
  2. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/__init__.py +0 -2
  3. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_environments.py +10 -10
  4. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_functions.py +16 -99
  5. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_image.py +26 -4
  6. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_logs.py +2 -2
  7. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_logs_manager.py +12 -12
  8. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_metrics.py +6 -6
  9. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_object.py +13 -0
  10. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_resolver.py +6 -0
  11. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_runtime/asgi.py +1 -1
  12. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_serialization.py +1 -1
  13. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_server.py +6 -7
  14. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/async_utils.py +5 -5
  15. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/grpc_utils.py +2 -9
  16. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/http_utils.py +2 -1
  17. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/mount_utils.py +2 -18
  18. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/time_utils.py +14 -14
  19. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_workspace.py +100 -22
  20. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/app.py +6 -14
  21. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/app.pyi +0 -17
  22. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/_audit_logs.py +2 -2
  23. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/_download.py +1 -2
  24. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/_logs.py +4 -4
  25. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/_stats.py +7 -7
  26. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/app.py +5 -5
  27. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/container.py +6 -6
  28. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/entry_point.py +0 -2
  29. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/function.py +9 -9
  30. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/server.py +8 -8
  31. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/shell.py +0 -1
  32. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/utils.py +2 -2
  33. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/workspace.py +193 -21
  34. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/client.pyi +2 -2
  35. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/container_process.py +1 -1
  36. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/exception.py +4 -0
  37. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/experimental/__init__.py +9 -18
  38. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/experimental/stream.py +5 -5
  39. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/functions.pyi +0 -4
  40. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/image.py +2 -1
  41. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/image.pyi +39 -5
  42. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/io_streams.py +9 -9
  43. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/io_streams.pyi +11 -4
  44. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/mount.py +5 -1
  45. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/object.pyi +19 -2
  46. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/parallel_map.py +64 -150
  47. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/parallel_map.pyi +5 -22
  48. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/retries.py +1 -0
  49. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/runner.py +6 -7
  50. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/sandbox/_common.py +26 -8
  51. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/sandbox/_impl_persistent.py +277 -138
  52. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/sandbox/_impl_v1.py +69 -47
  53. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/sandbox/_impl_v2.py +69 -43
  54. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/sandbox/_sandbox.py +105 -236
  55. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/sandbox/_sidecar.py +1 -1
  56. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/sandbox/_task_command_router_client.py +28 -7
  57. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/sandbox/sandbox.pyi +41 -306
  58. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/secret.py +2 -2
  59. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/token_flow.py +5 -1
  60. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/types.py +49 -26
  61. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/workspace.pyi +129 -15
  62. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal.egg-info/PKG-INFO +1 -1
  63. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal.egg-info/SOURCES.txt +0 -3
  64. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_docs/gen_reference_docs.py +1 -1
  65. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_proto/api_grpc.py +160 -0
  66. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_proto/api_pb2.py +773 -727
  67. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_proto/api_pb2.pyi +478 -9
  68. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_proto/api_pb2_grpc.py +331 -0
  69. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_proto/api_pb2_grpc.pyi +102 -0
  70. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_proto/modal_api_grpc.py +10 -0
  71. modal-1.7.0.dev2/modal_proto/task_command_router_pb2.py +142 -0
  72. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_proto/task_command_router_pb2.pyi +49 -2
  73. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_version/__init__.py +1 -1
  74. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/pyproject.toml +1 -1
  75. modal-1.7.0.dev1/modal/cli/network_file_system.py +0 -227
  76. modal-1.7.0.dev1/modal/network_file_system.py +0 -369
  77. modal-1.7.0.dev1/modal/network_file_system.pyi +0 -484
  78. modal-1.7.0.dev1/modal_proto/task_command_router_pb2.py +0 -138
  79. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/LICENSE +0 -0
  80. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/README.md +0 -0
  81. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/__main__.py +0 -0
  82. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_audit_logs/__init__.py +0 -0
  83. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_audit_logs/_rpcs.py +0 -0
  84. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_audit_logs/count.py +0 -0
  85. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_audit_logs/list.py +0 -0
  86. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_billing.py +0 -0
  87. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_cluster.py +0 -0
  88. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_cluster.pyi +0 -0
  89. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_container_entrypoint.py +0 -0
  90. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_experimental_outbound_policy.py +0 -0
  91. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_experimental_outbound_policy.pyi +0 -0
  92. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_function_variants.py +0 -0
  93. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_grpc_client.py +0 -0
  94. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_ipython.py +0 -0
  95. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_load_context.py +0 -0
  96. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_location.py +0 -0
  97. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_logs_manager.pyi +0 -0
  98. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_metrics.pyi +0 -0
  99. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_outbound_policy.py +0 -0
  100. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_outbound_policy.pyi +0 -0
  101. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_output/__init__.py +0 -0
  102. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_output/manager.py +0 -0
  103. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_output/pty.py +0 -0
  104. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_output/rich.py +0 -0
  105. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_output/status.py +0 -0
  106. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_partial_function.py +0 -0
  107. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_resources.py +0 -0
  108. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_runtime/__init__.py +0 -0
  109. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_runtime/container_io_manager.py +0 -0
  110. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_runtime/container_io_manager.pyi +0 -0
  111. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_runtime/execution_context.py +0 -0
  112. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_runtime/execution_context.pyi +0 -0
  113. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_runtime/gpu_memory_snapshot.py +0 -0
  114. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_runtime/task_lifecycle_manager.py +0 -0
  115. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_runtime/task_lifecycle_manager.pyi +0 -0
  116. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_runtime/telemetry.py +0 -0
  117. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_runtime/user_code_event_loop.py +0 -0
  118. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_runtime/user_code_imports.py +0 -0
  119. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_server.pyi +0 -0
  120. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_supports_logs.py +0 -0
  121. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_traceback.py +0 -0
  122. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_tunnel.py +0 -0
  123. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_tunnel.pyi +0 -0
  124. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_type_manager.py +0 -0
  125. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/__init__.py +0 -0
  126. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/app_utils.py +0 -0
  127. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/auth_token_manager.py +0 -0
  128. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/blob_utils.py +0 -0
  129. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/browser_utils.py +0 -0
  130. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/bytes_io_segment_payload.py +0 -0
  131. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/curl_utils.py +0 -0
  132. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/deprecation.py +0 -0
  133. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/display_utils.py +0 -0
  134. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/docker_utils.py +0 -0
  135. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/function_utils.py +0 -0
  136. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/git_utils.py +0 -0
  137. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/grpc_testing.py +0 -0
  138. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/hash_utils.py +0 -0
  139. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/idle_countdown.py +0 -0
  140. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/jwt_utils.py +0 -0
  141. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/logger.py +0 -0
  142. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/name_utils.py +0 -0
  143. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/oauth.py +0 -0
  144. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/package_utils.py +0 -0
  145. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/pattern_utils.py +0 -0
  146. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/proxy_support.py +0 -0
  147. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/rand_pb_testing.py +0 -0
  148. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/sandbox_fs_utils.py +0 -0
  149. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_utils/shell_utils.py +0 -0
  150. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_vendor/__init__.py +0 -0
  151. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_vendor/a2wsgi_wsgi.py +0 -0
  152. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_vendor/cloudpickle.py +0 -0
  153. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_vendor/tblib.py +0 -0
  154. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_vendor/version.py +0 -0
  155. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/_watcher.py +0 -0
  156. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/billing.py +0 -0
  157. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/billing.pyi +0 -0
  158. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/builder/2023.12.312.txt +0 -0
  159. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/builder/2023.12.txt +0 -0
  160. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/builder/2024.04.txt +0 -0
  161. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/builder/2024.10.txt +0 -0
  162. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/builder/2025.06.txt +0 -0
  163. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/builder/2026.10.txt +0 -0
  164. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/builder/PREVIEW.txt +0 -0
  165. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/builder/README.md +0 -0
  166. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/builder/base-images.json +0 -0
  167. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/call_graph.py +0 -0
  168. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/__init__.py +0 -0
  169. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/_help.py +0 -0
  170. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/_suggest.py +0 -0
  171. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/_traceback.py +0 -0
  172. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/billing.py +0 -0
  173. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/changelog.py +0 -0
  174. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/config.py +0 -0
  175. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/curl.py +0 -0
  176. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/dashboard.py +0 -0
  177. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/dict.py +0 -0
  178. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/endpoint.py +0 -0
  179. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/environment.py +0 -0
  180. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/image.py +0 -0
  181. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/import_refs.py +0 -0
  182. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/logo.py +0 -0
  183. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/profile.py +0 -0
  184. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/queues.py +0 -0
  185. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/run.py +0 -0
  186. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/secret.py +0 -0
  187. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/selector.py +0 -0
  188. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/skills.py +0 -0
  189. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/token.py +0 -0
  190. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cli/volume.py +0 -0
  191. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/client.py +0 -0
  192. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cloud_bucket_mount.py +0 -0
  193. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cloud_bucket_mount.pyi +0 -0
  194. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cls.py +0 -0
  195. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cls.pyi +0 -0
  196. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cluster.py +0 -0
  197. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/cluster.pyi +0 -0
  198. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/config.py +0 -0
  199. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/container_process.pyi +0 -0
  200. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/dict.py +0 -0
  201. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/dict.pyi +0 -0
  202. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/environments.py +0 -0
  203. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/environments.pyi +0 -0
  204. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/experimental/_flash_container_entry.py +0 -0
  205. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/experimental/flash_server.py +0 -0
  206. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/experimental/flash_server.pyi +0 -0
  207. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/experimental/stream.pyi +0 -0
  208. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/file_pattern_matcher.py +0 -0
  209. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/functions.py +0 -0
  210. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/mount.pyi +0 -0
  211. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/object.py +0 -0
  212. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/output.py +0 -0
  213. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/partial_function.py +0 -0
  214. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/partial_function.pyi +0 -0
  215. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/proxy.py +0 -0
  216. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/proxy.pyi +0 -0
  217. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/py.typed +0 -0
  218. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/queue.py +0 -0
  219. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/queue.pyi +0 -0
  220. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/runner.pyi +0 -0
  221. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/running_app.py +0 -0
  222. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/sandbox/__init__.py +0 -0
  223. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/sandbox/_filesystem.py +0 -0
  224. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/sandbox/_snapshot.py +0 -0
  225. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/sandbox/sandbox.py +0 -0
  226. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/schedule.py +0 -0
  227. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/scheduler_placement.py +0 -0
  228. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/secret.pyi +0 -0
  229. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/server.py +0 -0
  230. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/server.pyi +0 -0
  231. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/serving.py +0 -0
  232. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/serving.pyi +0 -0
  233. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/skills/modal/SKILL.md +0 -0
  234. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/stream_type.py +0 -0
  235. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/token_flow.pyi +0 -0
  236. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/volume.py +0 -0
  237. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/volume.pyi +0 -0
  238. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal/workspace.py +0 -0
  239. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal.egg-info/dependency_links.txt +0 -0
  240. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal.egg-info/entry_points.txt +0 -0
  241. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal.egg-info/requires.txt +0 -0
  242. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal.egg-info/top_level.txt +0 -0
  243. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_docs/__init__.py +0 -0
  244. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_docs/gen_cli_docs.py +0 -0
  245. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_docs/gen_cli_docs_main.py +0 -0
  246. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_docs/gen_reference_docs_main.py +0 -0
  247. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_docs/mdmd/__init__.py +0 -0
  248. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_docs/mdmd/mdmd.py +0 -0
  249. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_docs/mdmd/signatures.py +0 -0
  250. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_docs/mdmd/types.py +0 -0
  251. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_docs/reference_intro.md +0 -0
  252. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_proto/__init__.py +0 -0
  253. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_proto/py.typed +0 -0
  254. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_proto/task_command_router_grpc.py +0 -0
  255. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_proto/task_command_router_pb2_grpc.py +0 -0
  256. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_proto/task_command_router_pb2_grpc.pyi +0 -0
  257. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/modal_version/__main__.py +0 -0
  258. {modal-1.7.0.dev1 → modal-1.7.0.dev2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 1.7.0.dev1
3
+ Version: 1.7.0.dev2
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License-Expression: Apache-2.0
@@ -24,7 +24,6 @@ try:
24
24
  from .file_pattern_matcher import FilePatternMatcher
25
25
  from .functions import Function, FunctionCall
26
26
  from .image import Image
27
- from .network_file_system import NetworkFileSystem
28
27
  from .output import enable_output
29
28
  from .partial_function import (
30
29
  asgi_app,
@@ -74,7 +73,6 @@ __all__ = [
74
73
  "Function",
75
74
  "FunctionCall",
76
75
  "Image",
77
- "NetworkFileSystem",
78
76
  "OutboundPolicy",
79
77
  "OutboundRoute",
80
78
  "Period",
@@ -3,7 +3,7 @@ import asyncio
3
3
  import builtins
4
4
  from collections.abc import Iterable, Mapping
5
5
  from dataclasses import dataclass
6
- from datetime import datetime, timezone
6
+ from datetime import UTC, datetime
7
7
  from typing import TYPE_CHECKING, Any, Literal
8
8
 
9
9
  from google.protobuf.empty_pb2 import Empty
@@ -530,16 +530,16 @@ class _EnvironmentBillingManager:
530
530
  tag_names = []
531
531
 
532
532
  if end is None:
533
- end = datetime.now(timezone.utc)
533
+ end = datetime.now(UTC)
534
534
 
535
535
  if start.tzinfo is None:
536
- start = start.replace(tzinfo=timezone.utc)
537
- elif start.tzinfo != timezone.utc:
536
+ start = start.replace(tzinfo=UTC)
537
+ elif start.tzinfo != UTC:
538
538
  raise InvalidError("Timezone-aware 'start' parameter must be in UTC.")
539
539
 
540
540
  if end.tzinfo is None:
541
- end = end.replace(tzinfo=timezone.utc)
542
- elif end.tzinfo != timezone.utc:
541
+ end = end.replace(tzinfo=UTC)
542
+ elif end.tzinfo != UTC:
543
543
  raise InvalidError("Timezone-aware 'end' parameter must be in UTC.")
544
544
 
545
545
  if not self._environment._is_hydrated:
@@ -592,7 +592,7 @@ class _EnvironmentBillingManager:
592
592
  """
593
593
 
594
594
  if cycle is None:
595
- cycle = datetime.now(timezone.utc).replace(
595
+ cycle = datetime.now(UTC).replace(
596
596
  day=1,
597
597
  hour=0,
598
598
  minute=0,
@@ -603,14 +603,14 @@ class _EnvironmentBillingManager:
603
603
  cycle = parse_billing_cycle(cycle)
604
604
 
605
605
  if cycle.tzinfo is None:
606
- cycle = cycle.replace(tzinfo=timezone.utc)
607
- elif cycle.tzinfo != timezone.utc:
606
+ cycle = cycle.replace(tzinfo=UTC)
607
+ elif cycle.tzinfo != UTC:
608
608
  raise InvalidError("Timezone-aware 'cycle' parameter must be in UTC.")
609
609
 
610
610
  if not is_utc_month_aligned(cycle):
611
611
  raise InvalidError("Provided 'cycle' parameter must be the first of a month.")
612
612
 
613
- if cycle > datetime.now(timezone.utc):
613
+ if cycle > datetime.now(UTC):
614
614
  raise InvalidError("Provided 'cycle' parameter cannot be in the future.")
615
615
 
616
616
  if not self._environment._is_hydrated:
@@ -9,7 +9,7 @@ import warnings
9
9
  from collections import OrderedDict
10
10
  from collections.abc import AsyncGenerator, Callable, Collection, Sequence
11
11
  from dataclasses import dataclass
12
- from datetime import datetime, timedelta, timezone
12
+ from datetime import UTC, datetime, timedelta
13
13
  from pathlib import PurePosixPath
14
14
  from typing import TYPE_CHECKING, Any, Literal
15
15
 
@@ -68,7 +68,7 @@ from ._utils.function_utils import (
68
68
  validate_target_concurrency,
69
69
  )
70
70
  from ._utils.grpc_utils import Retry, RetryWarningMessage, is_class_function_lookup_error
71
- from ._utils.mount_utils import validate_network_file_systems, validate_volumes, validate_volumes_by_object_id
71
+ from ._utils.mount_utils import validate_volumes, validate_volumes_by_object_id
72
72
  from .call_graph import InputInfo, _reconstruct_call_graph
73
73
  from .client import _Client
74
74
  from .cloud_bucket_mount import _CloudBucketMount, cloud_bucket_mounts_to_proto
@@ -80,7 +80,6 @@ from .exception import (
80
80
  OutputExpiredError,
81
81
  )
82
82
  from .mount import _get_client_mount, _Mount
83
- from .network_file_system import _NetworkFileSystem, network_file_system_mount_protos
84
83
  from .output import OutputManager
85
84
  from .parallel_map import (
86
85
  _experimental_spawn_map_async,
@@ -99,7 +98,7 @@ from .parallel_map import (
99
98
  _SynchronizedQueue,
100
99
  )
101
100
  from .proxy import _Proxy
102
- from .retries import Retries, RetryManager
101
+ from .retries import MAX_INTERNAL_FAILURE_COUNT, Retries, RetryManager
103
102
  from .schedule import Schedule
104
103
  from .secret import _Secret
105
104
  from .types import (
@@ -118,7 +117,6 @@ if TYPE_CHECKING:
118
117
  import modal.cls
119
118
  import modal.functions
120
119
 
121
- MAX_INTERNAL_FAILURE_COUNT = 8
122
120
  _OBSERVABILITY_ONLY_APIS = (
123
121
  ".logs",
124
122
  ".metrics",
@@ -135,17 +133,6 @@ TERMINAL_STATUSES = (
135
133
  )
136
134
 
137
135
 
138
- @dataclasses.dataclass
139
- class _RetryContext:
140
- function_call_invocation_type: "api_pb2.FunctionCallInvocationType.ValueType"
141
- retry_policy: api_pb2.FunctionRetryPolicy
142
- function_call_jwt: str
143
- input_jwt: str
144
- input_id: str
145
- item: api_pb2.FunctionPutInputsItem
146
- sync_client_retries_enabled: bool
147
-
148
-
149
136
  class _Invocation:
150
137
  """Internal client representation of a single-input call to a Modal Function or Generator"""
151
138
 
@@ -156,12 +143,10 @@ class _Invocation:
156
143
  stub: ModalClientModal,
157
144
  function_call_id: str,
158
145
  client: _Client,
159
- retry_context: _RetryContext | None = None,
160
146
  ):
161
147
  self.stub = stub
162
148
  self.client = client # Used by the deserializer.
163
149
  self.function_call_id = function_call_id # TODO: remove and use only input_id
164
- self._retry_context = retry_context
165
150
 
166
151
  @staticmethod
167
152
  async def create(
@@ -215,17 +200,7 @@ class _Invocation:
215
200
  function_call_id = response.function_call_id
216
201
  if response.pipelined_inputs:
217
202
  assert len(response.pipelined_inputs) == 1
218
- input = response.pipelined_inputs[0]
219
- retry_context = _RetryContext(
220
- function_call_invocation_type=function_call_invocation_type,
221
- retry_policy=response.retry_policy,
222
- function_call_jwt=response.function_call_jwt,
223
- input_jwt=input.input_jwt,
224
- input_id=input.input_id,
225
- item=item,
226
- sync_client_retries_enabled=response.sync_client_retries_enabled,
227
- )
228
- return _Invocation(stub, function_call_id, client, retry_context)
203
+ return _Invocation(stub, function_call_id, client)
229
204
 
230
205
  request_put = api_pb2.FunctionPutInputsRequest(
231
206
  function_id=function_id, inputs=[item], function_call_id=function_call_id
@@ -234,24 +209,13 @@ class _Invocation:
234
209
  processed_inputs = inputs_response.inputs
235
210
  if not processed_inputs:
236
211
  raise Exception("Could not create function call - the input queue seems to be full")
237
- input = inputs_response.inputs[0]
238
- retry_context = _RetryContext(
239
- function_call_invocation_type=function_call_invocation_type,
240
- retry_policy=response.retry_policy,
241
- function_call_jwt=response.function_call_jwt,
242
- input_jwt=input.input_jwt,
243
- input_id=input.input_id,
244
- item=item,
245
- sync_client_retries_enabled=response.sync_client_retries_enabled,
246
- )
247
- return _Invocation(stub, function_call_id, client, retry_context)
212
+ return _Invocation(stub, function_call_id, client)
248
213
 
249
214
  async def pop_function_call_outputs(
250
215
  self,
251
216
  index: int = 0,
252
217
  timeout: float | None = None,
253
218
  clear_on_success: bool = False,
254
- input_jwts: list[str] | None = None,
255
219
  ) -> api_pb2.FunctionGetOutputsResponse:
256
220
  t0 = time.time()
257
221
  if timeout is None:
@@ -268,7 +232,6 @@ class _Invocation:
268
232
  last_entry_id="0-0",
269
233
  clear_on_success=clear_on_success,
270
234
  requested_at=time.time(),
271
- input_jwts=input_jwts,
272
235
  start_idx=index,
273
236
  end_idx=index,
274
237
  )
@@ -287,58 +250,20 @@ class _Invocation:
287
250
  # return the last response to check for state of num_unfinished_inputs
288
251
  return response
289
252
 
290
- async def _retry_input(self) -> None:
291
- ctx = self._retry_context
292
- if not ctx:
293
- raise ValueError("Cannot retry input when _retry_context is empty.")
294
-
295
- item = api_pb2.FunctionRetryInputsItem(input_jwt=ctx.input_jwt, input=ctx.item.input)
296
- request = api_pb2.FunctionRetryInputsRequest(function_call_jwt=ctx.function_call_jwt, inputs=[item])
297
- await self.stub.FunctionRetryInputs(request)
298
-
299
- async def _get_single_output(self, expected_jwt: str | None = None) -> api_pb2.FunctionGetOutputsItem:
253
+ async def _get_single_output(self) -> api_pb2.FunctionGetOutputsItem:
300
254
  # waits indefinitely for a single result for the function, and clear the outputs buffer after
301
255
  item: api_pb2.FunctionGetOutputsItem = (
302
256
  await self.pop_function_call_outputs(
303
257
  index=0,
304
258
  timeout=None,
305
259
  clear_on_success=True,
306
- input_jwts=[expected_jwt] if expected_jwt else None,
307
260
  )
308
261
  ).outputs[0]
309
262
  return item
310
263
 
311
264
  async def run_function(self) -> Any:
312
- # Use retry logic only if retry policy is specified and
313
- ctx = self._retry_context
314
- if (
315
- not ctx
316
- or not ctx.retry_policy
317
- or ctx.retry_policy.retries == 0
318
- or ctx.function_call_invocation_type != api_pb2.FUNCTION_CALL_INVOCATION_TYPE_SYNC
319
- or not ctx.sync_client_retries_enabled
320
- ):
321
- item = await self._get_single_output()
322
- return await _process_result(item.result, item.data_format, self.stub, self.client)
323
-
324
- # User errors including timeouts are managed by the user specified retry policy.
325
- user_retry_manager = RetryManager(ctx.retry_policy)
326
-
327
- while True:
328
- item = await self._get_single_output(ctx.input_jwt)
329
- if item.result.status in TERMINAL_STATUSES:
330
- return await _process_result(item.result, item.data_format, self.stub, self.client)
331
-
332
- if item.result.status != api_pb2.GenericResult.GENERIC_STATUS_INTERNAL_FAILURE:
333
- # non-internal failures get a delay before retrying
334
- delay_ms = user_retry_manager.get_delay_ms()
335
- if delay_ms is None:
336
- # no more retries, this should raise an error when the non-success status is converted
337
- # to an exception:
338
- return await _process_result(item.result, item.data_format, self.stub, self.client)
339
- await asyncio.sleep(delay_ms / 1000)
340
-
341
- await self._retry_input()
265
+ item = await self._get_single_output()
266
+ return await _process_result(item.result, item.data_format, self.stub, self.client)
342
267
 
343
268
  async def poll_function(self, timeout: float | None = None, *, index: int = 0):
344
269
  """Waits up to timeout for a result from a function.
@@ -585,7 +510,6 @@ class _FunctionSpec:
585
510
  image: _Image | None
586
511
  mounts: Sequence[_Mount]
587
512
  secrets: Collection[_Secret]
588
- network_file_systems: dict[str | PurePosixPath, _NetworkFileSystem]
589
513
  volumes: dict[str | PurePosixPath, _Volume | _CloudBucketMount]
590
514
  # TODO(colin, was irfansharif): Somehow assert that it's the first kind, in sandboxes
591
515
  gpus: str | list[str] | None
@@ -704,8 +628,6 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
704
628
  schedule: Schedule | None = None,
705
629
  is_generator: bool = False,
706
630
  gpu: str | list[str] | None = None,
707
- # TODO: maybe break this out into a separate decorator for notebooks.
708
- network_file_systems: dict[str | PurePosixPath, _NetworkFileSystem] = {},
709
631
  volumes: dict[str | PurePosixPath, _Volume | _CloudBucketMount] = {},
710
632
  webhook_config: api_pb2.WebhookConfig | None = None,
711
633
  cpu: float | tuple[float, float] | None = None,
@@ -827,7 +749,6 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
827
749
  mounts=all_mounts,
828
750
  secrets=secrets,
829
751
  gpus=gpu,
830
- network_file_systems=network_file_systems,
831
752
  volumes=volumes,
832
753
  image=image,
833
754
  cloud=cloud,
@@ -905,9 +826,6 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
905
826
  cloud_bucket_mounts = [(k, v) for k, v in validated_volumes if isinstance(v, _CloudBucketMount)]
906
827
  validated_volumes_no_cloud_buckets = [(k, v) for k, v in validated_volumes if isinstance(v, _Volume)]
907
828
 
908
- # Validate NFS
909
- validated_network_file_systems = validate_network_file_systems(network_file_systems)
910
-
911
829
  # Validate image
912
830
  if image is not None and not isinstance(image, _Image): # type: ignore[unreachable]
913
831
  raise InvalidError(f"Expected modal.Image object. Got {type(image)}.")
@@ -952,8 +870,6 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
952
870
  deps.append(proxy)
953
871
  if image:
954
872
  deps.append(image)
955
- for _, nfs in validated_network_file_systems:
956
- deps.append(nfs)
957
873
  for _, vol in validated_volumes_no_cloud_buckets:
958
874
  deps.append(vol)
959
875
  for _, cloud_bucket_mount in cloud_bucket_mounts:
@@ -1083,7 +999,6 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
1083
999
  autoscaler_settings=autoscaler_settings,
1084
1000
  method_definitions=method_definitions,
1085
1001
  method_definitions_set=True,
1086
- shared_volume_mounts=network_file_system_mount_protos(validated_network_file_systems),
1087
1002
  volume_mounts=volume_mounts,
1088
1003
  proxy_id=(proxy.object_id if proxy else None),
1089
1004
  retry_policy=retry_policy,
@@ -1254,7 +1169,9 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
1254
1169
  obj._build_args = dict(
1255
1170
  secrets=repr(secrets),
1256
1171
  gpu_config=repr([parse_gpu_config(_gpu) for _gpu in gpus]),
1257
- network_file_systems=repr(network_file_systems),
1172
+ # network_file_systems is part of the Image hash of `Image.run_function` layers. If we remove it,
1173
+ # every `run_function` Image would be rebuilt after upgrading.
1174
+ network_file_systems="{}",
1258
1175
  )
1259
1176
  # these key are excluded if empty to avoid rebuilds on client upgrade
1260
1177
  if volumes:
@@ -2198,10 +2115,10 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
2198
2115
  # TODO: check if we end up here in a container for a serialized function?
2199
2116
  raise ExecutionError("Can't call .local on service function")
2200
2117
 
2201
- if is_local() and self._spec_.volumes or self._spec_.network_file_systems:
2118
+ if is_local() and self._spec_.volumes:
2202
2119
  warnings.warn(
2203
2120
  f"The {info.function_name} function is executing locally "
2204
- + "and will not have access to the mounted Volume or NetworkFileSystem data"
2121
+ + "and will not have access to the mounted Volume data"
2205
2122
  )
2206
2123
 
2207
2124
  obj: "modal.cls._Obj | None" = self._get_obj()
@@ -2343,15 +2260,15 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
2343
2260
  Returns:
2344
2261
  A `FunctionStats` object
2345
2262
  """
2346
- until = until or datetime.now(timezone.utc)
2263
+ until = until or datetime.now(UTC)
2347
2264
  if until.tzinfo is None:
2348
2265
  until = until.astimezone()
2349
- until = until.astimezone(timezone.utc)
2266
+ until = until.astimezone(UTC)
2350
2267
 
2351
2268
  since = since or until - timedelta(hours=1)
2352
2269
  if since.tzinfo is None:
2353
2270
  since = since.astimezone()
2354
- since = since.astimezone(timezone.utc)
2271
+ since = since.astimezone(UTC)
2355
2272
  if since >= until:
2356
2273
  raise InvalidError("`since` must be before `until`.")
2357
2274
 
@@ -23,6 +23,7 @@ from typing import (
23
23
  import typing_extensions
24
24
  from google.protobuf.message import Message
25
25
  from grpclib.exceptions import StreamTerminatedError
26
+ from synchronicity import classproperty
26
27
  from typing_extensions import Self
27
28
 
28
29
  from modal._serialization import serialize_data_format
@@ -60,7 +61,6 @@ from .exception import (
60
61
  )
61
62
  from .file_pattern_matcher import NON_PYTHON_FILES, FilePatternMatcher, _ignore_fn
62
63
  from .mount import PYTHON_STANDALONE_VERSIONS, _Mount, python_standalone_mount_name
63
- from .network_file_system import _NetworkFileSystem
64
64
  from .output import OutputManager
65
65
  from .secret import _Secret
66
66
  from .volume import _Volume, _volume_to_mount_proto
@@ -574,6 +574,26 @@ class _FailedBuildAttempt:
574
574
  client: _Client
575
575
 
576
576
 
577
+ class _ImageManager:
578
+ """Namespace with methods for managing Image objects."""
579
+
580
+ async def delete(self, image_id: str, *, client: _Client | None = None) -> None:
581
+ """Delete an Image by its ID.
582
+
583
+ Deletion is irreversible and prevents Functions and Sandboxes from using
584
+ this Image. Only the specified Image is deleted; intermediate layers
585
+ created by chained Image methods are not deleted.
586
+
587
+ Args:
588
+ image_id: Image object ID to delete.
589
+ client: Modal client to use; defaults to `Client.from_env()` when omitted.
590
+ """
591
+ if client is None:
592
+ client = await _Client.from_env()
593
+
594
+ await client._stub.ImageDelete(api_pb2.ImageDeleteRequest(image_id=image_id))
595
+
596
+
577
597
  class _Image(_Object, type_prefixes=("im",)):
578
598
  """Base class for container images to run functions in.
579
599
 
@@ -595,6 +615,11 @@ class _Image(_Object, type_prefixes=("im",)):
595
615
  # A failed image ID is only queryable through the client that performed the build.
596
616
  _failed_build_attempt: _FailedBuildAttempt | None = None
597
617
 
618
+ @classproperty
619
+ @classmethod
620
+ def objects(cls) -> _ImageManager:
621
+ return _ImageManager()
622
+
598
623
  def _initialize_from_empty(self):
599
624
  self.inside_exceptions = []
600
625
  self._serve_mounts = frozenset()
@@ -2915,7 +2940,6 @@ class _Image(_Object, type_prefixes=("im",)):
2915
2940
  env: dict[str, str | None] | None = None,
2916
2941
  secrets: Collection[_Secret] | None = None,
2917
2942
  volumes: dict[str | PurePosixPath, _Volume | _CloudBucketMount] = {},
2918
- network_file_systems: dict[str | PurePosixPath, _NetworkFileSystem] = {},
2919
2943
  gpu: str | list[str] | None = None,
2920
2944
  cpu: float | None = None,
2921
2945
  memory: int | None = None,
@@ -2943,7 +2967,6 @@ class _Image(_Object, type_prefixes=("im",)):
2943
2967
  env: Environment variables set in the builder container.
2944
2968
  secrets: Secrets available to the builder function.
2945
2969
  volumes: Volume and bucket mounts attached for the build.
2946
- network_file_systems: Network file systems attached for the build.
2947
2970
  gpu: GPU type or list of types for the builder container.
2948
2971
  cpu: CPU cores to request.
2949
2972
  memory: Memory to request in MiB.
@@ -2994,7 +3017,6 @@ class _Image(_Object, type_prefixes=("im",)):
2994
3017
  secrets=secrets,
2995
3018
  gpu=gpu,
2996
3019
  volumes=volumes,
2997
- network_file_systems=network_file_systems,
2998
3020
  cloud=cloud,
2999
3021
  region=region,
3000
3022
  memory=memory,
@@ -4,7 +4,7 @@ from __future__ import annotations
4
4
  import asyncio
5
5
  import dataclasses
6
6
  from collections.abc import AsyncGenerator, Awaitable, Callable
7
- from datetime import datetime, timedelta, timezone
7
+ from datetime import UTC, datetime, timedelta
8
8
  from typing import TYPE_CHECKING, Sequence, TypeVar
9
9
 
10
10
  from google.protobuf.timestamp_pb2 import Timestamp
@@ -366,7 +366,7 @@ async def tail_logs(
366
366
  if n > _FETCH_LIMIT:
367
367
  raise LogsFetchError(f"--tail value must not exceed {_FETCH_LIMIT}.")
368
368
 
369
- now = datetime.now(timezone.utc)
369
+ now = datetime.now(UTC)
370
370
 
371
371
  if since is not None and since.tzinfo is None:
372
372
  raise ValueError("since must be timezone-aware")
@@ -7,7 +7,7 @@ import enum
7
7
  import socket
8
8
  import time
9
9
  from collections.abc import AsyncGenerator, Awaitable, Callable
10
- from datetime import datetime, timezone
10
+ from datetime import UTC, datetime
11
11
 
12
12
  from grpclib.exceptions import StreamTerminatedError
13
13
 
@@ -42,8 +42,8 @@ def _normalize_utc_datetime(value: datetime, name: str) -> datetime:
42
42
  if not isinstance(value, datetime):
43
43
  raise TypeError(f"{name} must be a datetime")
44
44
  if value.tzinfo is None:
45
- return value.replace(tzinfo=locale_tz()).astimezone(timezone.utc)
46
- return value.astimezone(timezone.utc)
45
+ return value.replace(tzinfo=locale_tz()).astimezone(UTC)
46
+ return value.astimezone(UTC)
47
47
 
48
48
 
49
49
  def _entry_source(file_descriptor: api_pb2.FileDescriptor.ValueType) -> LogSource:
@@ -58,8 +58,8 @@ def _entry_source(file_descriptor: api_pb2.FileDescriptor.ValueType) -> LogSourc
58
58
 
59
59
  def _entry_timestamp(item: api_pb2.TaskLogs) -> datetime:
60
60
  if item.timestamp_ns:
61
- return datetime.fromtimestamp(item.timestamp_ns / 1_000_000_000, timezone.utc)
62
- return datetime.fromtimestamp(item.timestamp, timezone.utc)
61
+ return datetime.fromtimestamp(item.timestamp_ns / 1_000_000_000, UTC)
62
+ return datetime.fromtimestamp(item.timestamp, UTC)
63
63
 
64
64
 
65
65
  def _resolve_source(source: LogSource | None) -> api_pb2.FileDescriptor.ValueType:
@@ -147,7 +147,7 @@ class _LogsManager:
147
147
  ) -> AsyncGenerator[LogEntry, None]:
148
148
  """Fetch all associated logs corresponding to the date range and filters."""
149
149
  since = _normalize_utc_datetime(since, "since")
150
- until = _normalize_utc_datetime(until or datetime.now(timezone.utc), "until")
150
+ until = _normalize_utc_datetime(until or datetime.now(UTC), "until")
151
151
  target = await self._params()
152
152
  filters = dataclasses.replace(
153
153
  target.filters,
@@ -670,10 +670,10 @@ class _FunctionCallLogsManager:
670
670
 
671
671
  if since_was_defaulted:
672
672
  function_call_info = await self._get_function_call_info()
673
- since = datetime.fromtimestamp(function_call_info.created_at, timezone.utc)
673
+ since = datetime.fromtimestamp(function_call_info.created_at, UTC)
674
674
 
675
675
  if until_was_defaulted:
676
- until = datetime.now(timezone.utc)
676
+ until = datetime.now(UTC)
677
677
 
678
678
  if since_was_defaulted and until_was_defaulted and since > until:
679
679
  until = since
@@ -729,8 +729,8 @@ class _ImageLogsManager:
729
729
  params.client,
730
730
  step.builder_app_id,
731
731
  # Protobuf timestamps represent UTC time.
732
- since=step.started_at.ToDatetime(tzinfo=timezone.utc),
733
- until=step.finished_at.ToDatetime(tzinfo=timezone.utc),
732
+ since=step.started_at.ToDatetime(tzinfo=UTC),
733
+ until=step.finished_at.ToDatetime(tzinfo=UTC),
734
734
  filters=LogsFilters(
735
735
  task_id=step.builder_task_id,
736
736
  ),
@@ -781,8 +781,8 @@ class _ImageLogsManager:
781
781
  params.client,
782
782
  step.builder_app_id,
783
783
  remaining_entries,
784
- since=step.started_at.ToDatetime(tzinfo=timezone.utc),
785
- until=step.finished_at.ToDatetime(tzinfo=timezone.utc),
784
+ since=step.started_at.ToDatetime(tzinfo=UTC),
785
+ until=step.finished_at.ToDatetime(tzinfo=UTC),
786
786
  filters=LogsFilters(task_id=step.builder_task_id),
787
787
  ):
788
788
  for item in batch.items:
@@ -1,7 +1,7 @@
1
1
  # Copyright Modal Labs 2026
2
2
  from __future__ import annotations
3
3
 
4
- from datetime import datetime, timedelta, timezone
4
+ from datetime import UTC, datetime, timedelta
5
5
 
6
6
  from modal_proto import api_pb2
7
7
 
@@ -14,8 +14,8 @@ from .types import MetricDefinition, MetricSeries, MetricsSchema, ObjectMetrics,
14
14
  def _metrics_request(
15
15
  since: datetime | None, until: datetime | None, bucket_size: timedelta | None, groups: list[str] | None
16
16
  ) -> api_pb2.FunctionGetMetricsRequest:
17
- until = (until or datetime.now(timezone.utc)).astimezone(timezone.utc)
18
- since = (since or until - timedelta(hours=1)).astimezone(timezone.utc)
17
+ until = (until or datetime.now(UTC)).astimezone(UTC)
18
+ since = (since or until - timedelta(hours=1)).astimezone(UTC)
19
19
  if since >= until:
20
20
  raise InvalidError("`since` must be before `until`.")
21
21
  if since.timestamp() < 0:
@@ -50,7 +50,7 @@ def _object_metrics(
50
50
  description=item.description,
51
51
  points=[
52
52
  TimeSeriesPoint(
53
- time=point.timestamp.ToDatetime(tzinfo=timezone.utc),
53
+ time=point.timestamp.ToDatetime(tzinfo=UTC),
54
54
  value=point.value if point.HasField("value") else None,
55
55
  )
56
56
  for point in item.points
@@ -60,8 +60,8 @@ def _object_metrics(
60
60
  }
61
61
  return ObjectMetrics(
62
62
  object_id=object_id,
63
- since=response.since.ToDatetime(tzinfo=timezone.utc),
64
- until=response.until.ToDatetime(tzinfo=timezone.utc),
63
+ since=response.since.ToDatetime(tzinfo=UTC),
64
+ until=response.until.ToDatetime(tzinfo=UTC),
65
65
  bucket_size=timedelta(seconds=response.bucket_secs),
66
66
  point_count=sum(len(item.points) for item in series.values()),
67
67
  series=series,
@@ -108,12 +108,22 @@ class _Object:
108
108
 
109
109
  @property
110
110
  def _is_hydrated(self) -> bool:
111
+ """Whether the object has a client, identity, and any static metadata needed for interaction."""
111
112
  return self.__is_hydrated
112
113
 
113
114
  @_is_hydrated.setter
114
115
  def _is_hydrated(self, value: bool):
115
116
  self.__is_hydrated = value
116
117
 
118
+ def _is_serializable(self) -> bool:
119
+ """Whether the object can be serialized
120
+
121
+ Serializability can be more relaxed than hydration: clients are not serialized,
122
+ and many types need only an object_id, allowing handles created with from_id()
123
+ to be serialized before hydration.
124
+ """
125
+ return self._is_hydrated
126
+
117
127
  @classmethod
118
128
  def __init_subclass__(cls, type_prefixes: Sequence[str] = ()):
119
129
  super().__init_subclass__()
@@ -180,6 +190,9 @@ class _Object:
180
190
  self._client = other._client
181
191
 
182
192
  def _hydrate(self, object_id: str, client: _Client, metadata: Message | None):
193
+ """Hydration makes an object usable: it has a valid Client and object_id, and for some
194
+ types static metadata required or recommended for interaction.
195
+ """
183
196
  assert isinstance(object_id, str) and self._type_prefixes
184
197
  if not self._has_type_prefix(object_id):
185
198
  raise ExecutionError(
@@ -4,11 +4,13 @@ import os
4
4
  import tempfile
5
5
  from asyncio import Future
6
6
  from collections.abc import Hashable
7
+ from functools import cached_property
7
8
 
8
9
  import modal._object
9
10
  from modal._traceback import suppress_tb_frame
10
11
 
11
12
  from ._load_context import LoadContext
13
+ from ._utils.blob_utils import _ByteBudget
12
14
 
13
15
 
14
16
  class Resolver:
@@ -29,6 +31,10 @@ class Resolver:
29
31
  def build_start(self) -> float:
30
32
  return self._build_start
31
33
 
34
+ @cached_property
35
+ def mount_upload_byte_budget(self) -> _ByteBudget:
36
+ return _ByteBudget.from_system_memory()
37
+
32
38
  async def preload(
33
39
  self, obj: "modal._object._Object", parent_load_context: "LoadContext", existing_object_id: str | None
34
40
  ):
@@ -158,7 +158,7 @@ def asgi_app_wrapper(asgi_app, container_io_manager) -> tuple[Callable[..., Asyn
158
158
  # see comment above about manual cancellation
159
159
  first_message_task.cancel()
160
160
  raise
161
- except (asyncio.TimeoutError, StopAsyncIteration):
161
+ except (TimeoutError, StopAsyncIteration):
162
162
  # About `StopAsyncIteration` above: The generator shouldn't typically exit,
163
163
  # but if it does, we handle it like a timeout in that case.
164
164
  await handle_first_input_timeout()
@@ -67,7 +67,7 @@ class Pickler(cloudpickle.Pickler):
67
67
  else:
68
68
  return
69
69
 
70
- if not obj._is_hydrated:
70
+ if not obj._is_serializable():
71
71
  raise InvalidError(f"Can't serialize object {obj} which hasn't been hydrated.")
72
72
 
73
73
  return (obj.object_id, flag, obj._get_metadata())