modal 1.6.5.dev3__tar.gz → 1.6.5.dev5__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 (257) hide show
  1. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/PKG-INFO +1 -1
  2. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_audit_logs/list.py +41 -0
  3. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_serialization.py +3 -7
  4. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_workspace.py +211 -40
  5. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/image.py +17 -35
  6. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/shell.py +12 -2
  7. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/volume.py +0 -2
  8. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/workspace.py +17 -10
  9. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/client.pyi +2 -2
  10. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/sandbox/_sandbox.py +10 -5
  11. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/sandbox/_task_command_router_client.py +4 -1
  12. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/sandbox/sandbox.pyi +20 -10
  13. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/types.py +70 -0
  14. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/workspace.py +5 -0
  15. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/workspace.pyi +337 -57
  16. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal.egg-info/PKG-INFO +1 -1
  17. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal.egg-info/SOURCES.txt +0 -1
  18. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_proto/api_grpc.py +3 -3
  19. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_proto/api_pb2.py +1486 -1476
  20. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_proto/api_pb2.pyi +42 -4
  21. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_proto/api_pb2_grpc.py +3 -3
  22. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_proto/api_pb2_grpc.pyi +2 -2
  23. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_version/__init__.py +1 -1
  24. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/pyproject.toml +3 -9
  25. modal-1.6.5.dev3/modal/experimental/ipython.py +0 -84
  26. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/LICENSE +0 -0
  27. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/README.md +0 -0
  28. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/__init__.py +0 -0
  29. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/__main__.py +0 -0
  30. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_audit_logs/__init__.py +0 -0
  31. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_audit_logs/_rpcs.py +0 -0
  32. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_audit_logs/count.py +0 -0
  33. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_billing.py +0 -0
  34. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_cluster.py +0 -0
  35. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_cluster.pyi +0 -0
  36. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_container_entrypoint.py +0 -0
  37. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_environments.py +0 -0
  38. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_function_variants.py +0 -0
  39. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_functions.py +0 -0
  40. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_grpc_client.py +0 -0
  41. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_image.py +0 -0
  42. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_ipython.py +0 -0
  43. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_load_context.py +0 -0
  44. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_location.py +0 -0
  45. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_logs.py +0 -0
  46. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_logs_manager.py +0 -0
  47. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_logs_manager.pyi +0 -0
  48. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_metrics.py +0 -0
  49. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_metrics.pyi +0 -0
  50. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_object.py +0 -0
  51. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_outbound_policy.py +0 -0
  52. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_outbound_policy.pyi +0 -0
  53. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_output/__init__.py +0 -0
  54. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_output/manager.py +0 -0
  55. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_output/pty.py +0 -0
  56. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_output/rich.py +0 -0
  57. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_output/status.py +0 -0
  58. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_partial_function.py +0 -0
  59. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_resolver.py +0 -0
  60. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_resources.py +0 -0
  61. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_runtime/__init__.py +0 -0
  62. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_runtime/asgi.py +0 -0
  63. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_runtime/container_io_manager.py +0 -0
  64. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_runtime/container_io_manager.pyi +0 -0
  65. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_runtime/execution_context.py +0 -0
  66. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_runtime/execution_context.pyi +0 -0
  67. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_runtime/gpu_memory_snapshot.py +0 -0
  68. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_runtime/task_lifecycle_manager.py +0 -0
  69. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_runtime/task_lifecycle_manager.pyi +0 -0
  70. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_runtime/telemetry.py +0 -0
  71. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_runtime/user_code_event_loop.py +0 -0
  72. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_runtime/user_code_imports.py +0 -0
  73. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_server.py +0 -0
  74. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_server.pyi +0 -0
  75. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_supports_logs.py +0 -0
  76. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_traceback.py +0 -0
  77. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_tunnel.py +0 -0
  78. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_tunnel.pyi +0 -0
  79. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_type_manager.py +0 -0
  80. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/__init__.py +0 -0
  81. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/app_utils.py +0 -0
  82. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/async_utils.py +0 -0
  83. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/auth_token_manager.py +0 -0
  84. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/blob_utils.py +0 -0
  85. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/browser_utils.py +0 -0
  86. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/bytes_io_segment_payload.py +0 -0
  87. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/curl_utils.py +0 -0
  88. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/deprecation.py +0 -0
  89. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/display_utils.py +0 -0
  90. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/docker_utils.py +0 -0
  91. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/function_utils.py +0 -0
  92. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/git_utils.py +0 -0
  93. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/grpc_testing.py +0 -0
  94. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/grpc_utils.py +0 -0
  95. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/hash_utils.py +0 -0
  96. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/http_utils.py +0 -0
  97. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/idle_countdown.py +0 -0
  98. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/jwt_utils.py +0 -0
  99. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/logger.py +0 -0
  100. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/mount_utils.py +0 -0
  101. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/name_utils.py +0 -0
  102. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/oauth.py +0 -0
  103. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/package_utils.py +0 -0
  104. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/pattern_utils.py +0 -0
  105. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/proxy_support.py +0 -0
  106. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/rand_pb_testing.py +0 -0
  107. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/sandbox_fs_utils.py +0 -0
  108. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/shell_utils.py +0 -0
  109. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_utils/time_utils.py +0 -0
  110. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_vendor/__init__.py +0 -0
  111. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_vendor/a2wsgi_wsgi.py +0 -0
  112. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_vendor/cloudpickle.py +0 -0
  113. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_vendor/tblib.py +0 -0
  114. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_vendor/version.py +0 -0
  115. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/_watcher.py +0 -0
  116. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/app.py +0 -0
  117. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/app.pyi +0 -0
  118. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/billing.py +0 -0
  119. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/billing.pyi +0 -0
  120. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/builder/2023.12.312.txt +0 -0
  121. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/builder/2023.12.txt +0 -0
  122. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/builder/2024.04.txt +0 -0
  123. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/builder/2024.10.txt +0 -0
  124. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/builder/2025.06.txt +0 -0
  125. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/builder/2026.10.txt +0 -0
  126. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/builder/PREVIEW.txt +0 -0
  127. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/builder/README.md +0 -0
  128. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/builder/base-images.json +0 -0
  129. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/call_graph.py +0 -0
  130. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/__init__.py +0 -0
  131. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/_download.py +0 -0
  132. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/_help.py +0 -0
  133. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/_logs.py +0 -0
  134. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/_stats.py +0 -0
  135. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/_suggest.py +0 -0
  136. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/_traceback.py +0 -0
  137. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/app.py +0 -0
  138. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/billing.py +0 -0
  139. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/changelog.py +0 -0
  140. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/config.py +0 -0
  141. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/container.py +0 -0
  142. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/curl.py +0 -0
  143. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/dashboard.py +0 -0
  144. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/dict.py +0 -0
  145. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/endpoint.py +0 -0
  146. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/entry_point.py +0 -0
  147. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/environment.py +0 -0
  148. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/function.py +0 -0
  149. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/import_refs.py +0 -0
  150. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/logo.py +0 -0
  151. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/network_file_system.py +0 -0
  152. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/profile.py +0 -0
  153. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/queues.py +0 -0
  154. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/run.py +0 -0
  155. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/secret.py +0 -0
  156. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/selector.py +0 -0
  157. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/server.py +0 -0
  158. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/skills.py +0 -0
  159. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/token.py +0 -0
  160. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cli/utils.py +0 -0
  161. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/client.py +0 -0
  162. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cloud_bucket_mount.py +0 -0
  163. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cloud_bucket_mount.pyi +0 -0
  164. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cls.py +0 -0
  165. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cls.pyi +0 -0
  166. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cluster.py +0 -0
  167. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/cluster.pyi +0 -0
  168. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/config.py +0 -0
  169. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/container_process.py +0 -0
  170. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/container_process.pyi +0 -0
  171. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/dict.py +0 -0
  172. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/dict.pyi +0 -0
  173. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/environments.py +0 -0
  174. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/environments.pyi +0 -0
  175. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/exception.py +0 -0
  176. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/experimental/__init__.py +0 -0
  177. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/experimental/_flash_container_entry.py +0 -0
  178. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/experimental/flash.py +0 -0
  179. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/experimental/flash.pyi +0 -0
  180. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/experimental/flash_server.py +0 -0
  181. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/experimental/flash_server.pyi +0 -0
  182. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/experimental/stream.py +0 -0
  183. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/experimental/stream.pyi +0 -0
  184. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/file_pattern_matcher.py +0 -0
  185. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/functions.py +0 -0
  186. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/functions.pyi +0 -0
  187. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/image.py +0 -0
  188. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/image.pyi +0 -0
  189. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/io_streams.py +0 -0
  190. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/io_streams.pyi +0 -0
  191. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/mount.py +0 -0
  192. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/mount.pyi +0 -0
  193. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/network_file_system.py +0 -0
  194. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/network_file_system.pyi +0 -0
  195. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/object.py +0 -0
  196. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/object.pyi +0 -0
  197. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/output.py +0 -0
  198. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/parallel_map.py +0 -0
  199. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/parallel_map.pyi +0 -0
  200. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/partial_function.py +0 -0
  201. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/partial_function.pyi +0 -0
  202. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/proxy.py +0 -0
  203. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/proxy.pyi +0 -0
  204. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/py.typed +0 -0
  205. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/queue.py +0 -0
  206. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/queue.pyi +0 -0
  207. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/retries.py +0 -0
  208. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/runner.py +0 -0
  209. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/runner.pyi +0 -0
  210. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/running_app.py +0 -0
  211. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/sandbox/__init__.py +0 -0
  212. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/sandbox/_common.py +0 -0
  213. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/sandbox/_filesystem.py +0 -0
  214. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/sandbox/_impl_persistent.py +0 -0
  215. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/sandbox/_impl_v1.py +0 -0
  216. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/sandbox/_impl_v2.py +0 -0
  217. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/sandbox/_sidecar.py +0 -0
  218. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/sandbox/_snapshot.py +0 -0
  219. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/sandbox/sandbox.py +0 -0
  220. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/schedule.py +0 -0
  221. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/scheduler_placement.py +0 -0
  222. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/secret.py +0 -0
  223. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/secret.pyi +0 -0
  224. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/server.py +0 -0
  225. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/server.pyi +0 -0
  226. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/serving.py +0 -0
  227. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/serving.pyi +0 -0
  228. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/skills/modal/SKILL.md +0 -0
  229. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/stream_type.py +0 -0
  230. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/token_flow.py +0 -0
  231. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/token_flow.pyi +0 -0
  232. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/volume.py +0 -0
  233. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal/volume.pyi +0 -0
  234. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal.egg-info/dependency_links.txt +0 -0
  235. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal.egg-info/entry_points.txt +0 -0
  236. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal.egg-info/requires.txt +0 -0
  237. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal.egg-info/top_level.txt +0 -0
  238. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_docs/__init__.py +0 -0
  239. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_docs/gen_cli_docs.py +0 -0
  240. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_docs/gen_cli_docs_main.py +0 -0
  241. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_docs/gen_reference_docs.py +0 -0
  242. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_docs/gen_reference_docs_main.py +0 -0
  243. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_docs/mdmd/__init__.py +0 -0
  244. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_docs/mdmd/mdmd.py +0 -0
  245. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_docs/mdmd/signatures.py +0 -0
  246. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_docs/mdmd/types.py +0 -0
  247. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_docs/reference_intro.md +0 -0
  248. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_proto/__init__.py +0 -0
  249. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_proto/modal_api_grpc.py +0 -0
  250. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_proto/py.typed +0 -0
  251. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_proto/task_command_router_grpc.py +0 -0
  252. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_proto/task_command_router_pb2.py +0 -0
  253. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_proto/task_command_router_pb2.pyi +0 -0
  254. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_proto/task_command_router_pb2_grpc.py +0 -0
  255. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_proto/task_command_router_pb2_grpc.pyi +0 -0
  256. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/modal_version/__main__.py +0 -0
  257. {modal-1.6.5.dev3 → modal-1.6.5.dev5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 1.6.5.dev3
3
+ Version: 1.6.5.dev5
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License-Expression: Apache-2.0
@@ -1,6 +1,7 @@
1
1
  # Copyright Modal Labs 2026
2
2
  from __future__ import annotations
3
3
 
4
+ import math
4
5
  from collections.abc import AsyncGenerator
5
6
  from contextlib import aclosing
6
7
 
@@ -50,6 +51,34 @@ async def _fetch_bucket(
50
51
  return entries
51
52
 
52
53
 
54
+ async def fetch_newest_audit_logs(
55
+ q: str,
56
+ oldest_ms: int,
57
+ newest_ms: int,
58
+ count: int,
59
+ *,
60
+ client: _Client | None = None,
61
+ config: api_pb2.AuditLogSettingsGetResponse,
62
+ ) -> list[api_pb2.AuditLogEntry]:
63
+ """Read the newest `count` entries in the range, oldest to newest.
64
+
65
+ A count larger than one page fetches only the newest buckets that cover it, concurrently.
66
+ """
67
+ if client is None:
68
+ client = await _Client.from_env()
69
+ if count <= config.page_size:
70
+ resp = await _rpcs.list_page(client, q, oldest_ms, newest_ms, count, config)
71
+ return list(reversed(resp.items))
72
+ buckets = await get_bucket_cursors(client, q, oldest_ms, newest_ms, config)
73
+ # Buckets are cut from the newest entry, so all but the oldest hold exactly `bucket_size` entries.
74
+ newest_buckets = buckets[-math.ceil(count / config.bucket_size) :]
75
+ entries: list[api_pb2.AuditLogEntry] = []
76
+ async with aclosing(_stream_buckets(client, q, oldest_ms, newest_ms, config, newest_buckets)) as stream:
77
+ async for entry in stream:
78
+ entries.append(entry)
79
+ return entries[-count:]
80
+
81
+
53
82
  async def fetch_audit_logs(
54
83
  q: str,
55
84
  oldest_ms: int,
@@ -68,7 +97,19 @@ async def fetch_audit_logs(
68
97
  if client is None:
69
98
  client = await _Client.from_env()
70
99
  buckets = await get_bucket_cursors(client, q, oldest_ms, newest_ms, config)
100
+ async with aclosing(_stream_buckets(client, q, oldest_ms, newest_ms, config, buckets)) as stream:
101
+ async for entry in stream:
102
+ yield entry
103
+
71
104
 
105
+ async def _stream_buckets(
106
+ client: _Client,
107
+ q: str,
108
+ oldest_ms: int,
109
+ newest_ms: int,
110
+ config: api_pb2.AuditLogSettingsGetResponse,
111
+ buckets: list[Bucket],
112
+ ) -> AsyncGenerator[api_pb2.AuditLogEntry]:
72
113
  async def bucket_stream() -> AsyncGenerator[Bucket]:
73
114
  for bucket in buckets:
74
115
  yield bucket
@@ -378,16 +378,12 @@ def serialize_data_format(obj: Any, data_format: int) -> bytes:
378
378
  raise InvalidError("CBOR support requires the 'cbor2' package to be installed.")
379
379
  try:
380
380
  return cbor2.dumps(obj)
381
- except cbor2.CBOREncodeError:
382
- try:
383
- typename = f"{type(obj).__module__}.{type(obj).__name__}"
384
- except Exception:
385
- typename = str(type(obj))
381
+ except cbor2.CBOREncodeError as exc:
386
382
  raise SerializationError(
387
383
  # TODO (elias): add documentation link for more information on this
388
- f"Can not serialize type {typename} as cbor. If you need to use a custom data type, "
384
+ f"CBOR payload serialization failed: {exc}. If you need to use a custom data type, "
389
385
  "try to serialize it yourself e.g. by using pickle.dumps(my_data)"
390
- )
386
+ ) from exc
391
387
  else:
392
388
  raise InvalidError(f"Unknown data format {data_format!r}")
393
389
 
@@ -1,8 +1,9 @@
1
1
  # Copyright Modal Labs 2025
2
2
  import builtins
3
3
  import warnings
4
- from collections.abc import Mapping
5
- from datetime import datetime, timezone
4
+ from collections.abc import AsyncGenerator, Mapping
5
+ from contextlib import aclosing
6
+ from datetime import datetime, timedelta, timezone
6
7
  from decimal import Decimal
7
8
  from typing import Optional
8
9
 
@@ -12,12 +13,16 @@ from modal.exception import DeprecationError, InvalidError, NotFoundError
12
13
  from modal.types import MemberTokenInfo, ServiceUserInfo
13
14
  from modal_proto import api_pb2
14
15
 
16
+ from ._audit_logs import _rpcs
17
+ from ._audit_logs.count import count_audit_logs
18
+ from ._audit_logs.list import fetch_audit_logs, fetch_newest_audit_logs
15
19
  from ._load_context import LoadContext
16
20
  from ._object import _Object
17
21
  from ._resolver import Resolver
18
- from ._utils.time_utils import is_utc_month_aligned, parse_billing_cycle, timestamp_to_localized_dt
22
+ from ._utils.time_utils import is_utc_month_aligned, locale_tz, parse_billing_cycle, timestamp_to_localized_dt
19
23
  from .client import _Client
20
24
  from .types import (
25
+ AuditEvent,
21
26
  BillingReportItem,
22
27
  ProxyTokenInfo,
23
28
  TokenData,
@@ -26,6 +31,9 @@ from .types import (
26
31
  WorkspaceSettings,
27
32
  )
28
33
 
34
+ _AUDIT_LOG_DEFAULT_LIMIT = 100
35
+ _AUDIT_LOG_DEFAULT_WINDOW = timedelta(days=7)
36
+
29
37
 
30
38
  def _member_role_from_proto(proto_value: int) -> str:
31
39
  match proto_value:
@@ -87,6 +95,11 @@ class _Workspace(_Object, type_prefixes=("ac",)):
87
95
  """Namespace with methods for managing the membership of a Workspace."""
88
96
  return _WorkspaceMembersManager(self)
89
97
 
98
+ @property
99
+ def audit_logs(self) -> "_WorkspaceAuditLogsManager":
100
+ """Namespace for reading [Workspace audit logs](https://modal.com/docs/guide/audit-logs)."""
101
+ return _WorkspaceAuditLogsManager(self)
102
+
90
103
  @staticmethod
91
104
  def from_context(*, client: Optional[_Client] = None) -> "_Workspace":
92
105
  """Look up the Workspace associated with the current context.
@@ -145,6 +158,157 @@ class _Workspace(_Object, type_prefixes=("ac",)):
145
158
  return _WorkspaceMemberTokenManager(self)
146
159
 
147
160
 
161
+ class _WorkspaceAuditLogsManager:
162
+ """mdmd:namespace"""
163
+
164
+ def __init__(self, workspace: _Workspace):
165
+ """mdmd:hidden"""
166
+ self._workspace = workspace
167
+
168
+ @staticmethod
169
+ def _range(since: datetime | None, until: datetime | None) -> tuple[int, int]:
170
+ until = until or datetime.now(timezone.utc)
171
+ if until.tzinfo is None:
172
+ until = until.replace(tzinfo=locale_tz())
173
+ until = until.astimezone(timezone.utc)
174
+ if since is None:
175
+ since = until - _AUDIT_LOG_DEFAULT_WINDOW
176
+ elif since.tzinfo is None:
177
+ since = since.replace(tzinfo=locale_tz())
178
+ since = since.astimezone(timezone.utc)
179
+ return int(since.timestamp() * 1000), int(until.timestamp() * 1000)
180
+
181
+ async def fetch(
182
+ self,
183
+ query: str = "",
184
+ *,
185
+ since: datetime | None = None,
186
+ until: datetime | None = None,
187
+ limit: int | None = None,
188
+ ) -> AsyncGenerator[AuditEvent, None]:
189
+ """Fetch the Workspace's audit events, oldest-first.
190
+
191
+ Audit events record the sensitive actions that change a Workspace's state: who did
192
+ what, when, to which resource, and from where. Reading them requires the Enterprise
193
+ plan and either a Workspace Owner or Manager role, or a role that grants audit log
194
+ read access. See [the guide](https://modal.com/docs/guide/audit-logs) for more
195
+ information.
196
+
197
+ With no arguments, return the latest 100 events in the past seven days,
198
+ ordered oldest-first. Workspaces with fewer than 100 events in that window
199
+ return only those events.
200
+
201
+ A `since` or `until` datetime without a timezone is treated as local time. The range
202
+ between them is limited by the server, currently to seven days.
203
+
204
+ Args:
205
+ query: Query selecting which events to return, e.g.
206
+ `action:environment.create -status:failure`. Defaults to an empty string,
207
+ which matches all events.
208
+ See the query guide [here](https://modal.com/docs/guide/audit-logs#filtering).
209
+ since: Inclusive start time. Defaults to seven days before `until`.
210
+ until: Exclusive end time. Defaults to now.
211
+ limit: Return the newest `limit` matching events in the interval; must be
212
+ positive if provided. Defaults to 100 when `since` is omitted, or no
213
+ limit (every event in the interval) when `since` is provided.
214
+
215
+ Examples:
216
+ ```python notest
217
+ from datetime import datetime, timezone
218
+
219
+ ws = modal.Workspace.from_context()
220
+ latest_events = list(ws.audit_logs.fetch()) # defaults to latest 100 from past week
221
+ latest_500_events = list(ws.audit_logs.fetch(limit=500)) # latest 500 from past week
222
+
223
+ # latest 100 environment creations from past week, excluding failed attempts
224
+ environment_creation_events = list(ws.audit_logs.fetch("action:environment.create -status:failure"))
225
+
226
+ # latest 100 environment creations or deletions from past week
227
+ environment_change_events = list(ws.audit_logs.fetch("action:(environment.create OR environment.delete)"))
228
+
229
+ # return every event in range
230
+ start = datetime(2026, 10, 1, tzinfo=timezone.utc)
231
+ end = datetime(2026, 10, 8, tzinfo=timezone.utc)
232
+ first_week_of_october_events = list(ws.audit_logs.fetch(since=start, until=end))
233
+ ```
234
+ """
235
+ oldest_ms, newest_ms = self._range(since, until)
236
+ if limit is not None and limit < 1:
237
+ raise InvalidError("limit must be positive.")
238
+ await self._workspace.hydrate()
239
+ client = self._workspace.client
240
+ config = await _rpcs.get_settings(client)
241
+ if since is None or limit is not None:
242
+ entries = await fetch_newest_audit_logs(
243
+ query, oldest_ms, newest_ms, limit or _AUDIT_LOG_DEFAULT_LIMIT, client=client, config=config
244
+ )
245
+ for entry in entries:
246
+ yield AuditEvent._from_proto(entry)
247
+ return
248
+ stream = fetch_audit_logs(
249
+ query,
250
+ oldest_ms,
251
+ newest_ms,
252
+ client=client,
253
+ config=config,
254
+ )
255
+ async with aclosing(stream):
256
+ async for entry in stream:
257
+ yield AuditEvent._from_proto(entry)
258
+
259
+ async def count(
260
+ self,
261
+ query: str = "",
262
+ *,
263
+ since: datetime,
264
+ until: datetime | None = None,
265
+ ) -> int:
266
+ """Count the Workspace's audit events.
267
+
268
+ Audit events record the sensitive actions that change a Workspace's state: who did
269
+ what, when, to which resource, and from where. Reading them requires the Enterprise
270
+ plan and either a Workspace Owner or Manager role, or a role that grants audit log
271
+ read access. See [the guide](https://modal.com/docs/guide/audit-logs) for more
272
+ information.
273
+
274
+ An explicit `since` is required to select the start of the time range.
275
+
276
+ A `since` or `until` datetime without a timezone is treated as local time. The range
277
+ between them is limited by the server, currently to seven days.
278
+
279
+ Args:
280
+ query: Query selecting which events to return, e.g.
281
+ `action:environment.create -status:failure`. Defaults to an empty string,
282
+ which matches all events.
283
+ See the query guide [here](https://modal.com/docs/guide/audit-logs#filtering).
284
+ since: Inclusive start time (required).
285
+ until: Exclusive end time. Defaults to now.
286
+
287
+ Examples:
288
+ ```python notest
289
+ from datetime import datetime, timedelta, timezone
290
+
291
+ ws = modal.Workspace.from_context()
292
+ start = datetime.now(timezone.utc) - timedelta(days=7)
293
+ past_week_count = ws.audit_logs.count(since=start)
294
+
295
+ # environments created or deleted in the past week
296
+ environment_change_count = ws.audit_logs.count(
297
+ "action:(environment.create OR environment.delete)", since=start
298
+ )
299
+
300
+ start = datetime(2026, 10, 1, tzinfo=timezone.utc)
301
+ end = datetime(2026, 10, 8, tzinfo=timezone.utc)
302
+ first_week_of_october_count = ws.audit_logs.count(since=start, until=end)
303
+ ```
304
+ """
305
+ oldest_ms, newest_ms = self._range(since, until)
306
+ await self._workspace.hydrate()
307
+ client = self._workspace.client
308
+ config = await _rpcs.get_settings(client)
309
+ return await count_audit_logs(client, query, oldest_ms, newest_ms, config)
310
+
311
+
148
312
  class _WorkspaceProxyTokenManager:
149
313
  """mdmd:namespace"""
150
314
 
@@ -748,31 +912,6 @@ class _WorkspaceMemberTokenManager:
748
912
  def __init__(self, workspace: _Workspace):
749
913
  self._workspace = workspace
750
914
 
751
- async def list(self) -> list[MemberTokenInfo]:
752
- """List Member Tokens in the specified Workspace.
753
-
754
- If you are a Manager or an Owner of this Workspace, this method will return a list of all the
755
- Member Tokens in the Workspace. Otherwise, this method will only return the Tokens you have
756
- created.
757
-
758
- Returns:
759
- A list of `MemberTokenInfo` dataclasses.
760
-
761
- Examples:
762
-
763
- ```python notest
764
- ws = modal.Workspace.from_context()
765
- for member_token in ws.member_tokens.list():
766
- print(member_token)
767
- ```
768
- """
769
- if not self._workspace._is_hydrated:
770
- await self._workspace.hydrate()
771
-
772
- resp = await self._workspace.client._stub.TokensList(Empty())
773
-
774
- return [MemberTokenInfo._from_proto(token) for token in resp.tokens]
775
-
776
915
  async def disable(self, *token_ids: str) -> None:
777
916
  """Disable member tokens in the specified Workspace.
778
917
 
@@ -829,29 +968,61 @@ class _WorkspaceMemberTokenManager:
829
968
 
830
969
  await self._workspace.client._stub.TokenEnable(api_pb2.TokenEnableRequest(token_ids=list(set(token_ids))))
831
970
 
832
- async def delete(self, token_id: str, *, allow_missing: bool = False) -> None:
833
- """Delete a Member Token in the specified Workspace.
971
+ async def delete(self, *token_ids: str, allow_missing: bool = False) -> "list[str]":
972
+ """Delete member tokens in the specified Workspace.
834
973
 
835
- If you are a Workspace Manager or Owner, you can use this method to delete any Token in the
836
- Workspace. Otherwise, you can only delete Member Tokens that you have created.
974
+ If you are a Workspace Manager or Owner, you can use this method to delete any token in the
975
+ Workspace. Otherwise, you can only delete member tokens that you have created.
837
976
 
838
977
  Args:
839
- token_id: The ID of the Member Token you would like to delete.
840
- allow_missing: If `True`, do not throw an exception if the Member Token does not exist.
978
+ *token_ids: The ID(s) of the token(s) you would like to delete.
979
+ allow_missing: If `True`, do not throw an exception if some of the tokens do not exist.
980
+
981
+ Returns:
982
+ A list of the tokens that were successfully deleted.
841
983
 
842
984
  Examples:
843
985
 
844
986
  ```python notest
845
987
  ws = modal.Workspace.from_context()
846
- ws.member_tokens.delete(token_id="ak-0123456789abcdefghijkl")
988
+ ws.member_tokens.delete("ak-0123456789abcdefghijkl", "ak-mnopqrstuvwxyz01234567")
847
989
  ```
848
990
  """
849
991
 
850
992
  if not self._workspace._is_hydrated:
851
993
  await self._workspace.hydrate()
852
994
 
853
- try:
854
- await self._workspace.client._stub.TokenDelete(req=api_pb2.TokenDeleteRequest(token_id=token_id))
855
- except NotFoundError:
856
- if not allow_missing:
857
- raise
995
+ resp = await self._workspace.client._stub.TokenDelete(
996
+ req=api_pb2.TokenDeleteRequest(
997
+ token_ids=token_ids,
998
+ allow_missing=allow_missing,
999
+ )
1000
+ )
1001
+
1002
+ return list(resp.deleted_token_ids)
1003
+
1004
+ # .list() must be defined last, as otherwise it masks the builtin `list` type in annotations
1005
+ async def list(self) -> "list[MemberTokenInfo]":
1006
+ """List Member Tokens in the specified Workspace.
1007
+
1008
+ If you are a Manager or an Owner of this Workspace, this method will return a list of all the
1009
+ Member Tokens in the Workspace. Otherwise, this method will only return the Tokens you have
1010
+ created.
1011
+
1012
+ Returns:
1013
+ A list of `MemberTokenInfo` dataclasses.
1014
+
1015
+ Examples:
1016
+
1017
+ ```python notest
1018
+ ws = modal.Workspace.from_context()
1019
+ for member_token in ws.member_tokens.list():
1020
+ print(member_token)
1021
+ ```
1022
+ """
1023
+ if not self._workspace._is_hydrated:
1024
+ await self._workspace.hydrate()
1025
+
1026
+ resp = await self._workspace.client._stub.TokensList(Empty())
1027
+
1028
+ return [MemberTokenInfo._from_proto(token) for token in resp.tokens]
@@ -371,31 +371,15 @@ async def _iter_tag_pages(
371
371
  async def _fetch_history_page(
372
372
  client: _Client,
373
373
  name_tag: str,
374
- page_token: str,
375
374
  ) -> api_pb2.ImageTagRevisionsResponse:
376
375
  return await client._stub.ImageTagRevisions(
377
376
  api_pb2.ImageTagRevisionsRequest(
378
377
  tag=name_tag,
379
378
  max_objects=IMAGE_NAMES_HISTORY_PAGE_SIZE,
380
- page_token=page_token,
381
379
  )
382
380
  )
383
381
 
384
382
 
385
- async def _iter_history_pages(
386
- client: _Client, name_tag: str, first_page: api_pb2.ImageTagRevisionsResponse
387
- ) -> AsyncIterator[api_pb2.ImageTagRevisionsResponse]:
388
- response = first_page
389
-
390
- while True:
391
- yield response
392
-
393
- if not response.next_page_token:
394
- return
395
- await asyncio.sleep(IMAGE_NAMES_HISTORY_PAGE_DELAY_SECONDS)
396
- response = await _fetch_history_page(client, name_tag, response.next_page_token)
397
-
398
-
399
383
  image_names_cli = ModalGroup(name="names", help="Manage Modal Image names.")
400
384
  image_cli.add_command(image_names_cli)
401
385
 
@@ -453,34 +437,32 @@ async def history(
453
437
  )
454
438
  client = await _Client.from_env()
455
439
 
456
- first_page = await _fetch_history_page(client, upgraded_image_name, "")
457
- if not first_page.items:
458
- raise click.ClickException(f"No publishing history found for named image {first_page.tag!r}.")
440
+ response = await _fetch_history_page(client, upgraded_image_name)
441
+ if not response.items:
442
+ raise click.ClickException(f"No publishing history found for named image {response.tag!r}.")
459
443
 
460
444
  if json:
461
445
  click.echo("[", nl=False)
462
446
  count = 0
463
- async for response in _iter_history_pages(client, upgraded_image_name, first_page):
464
- for item in response.items:
465
- if count:
466
- click.echo(",", nl=False)
467
- click.echo(json_module.dumps(_history_item_json(item)), nl=False)
468
- count += 1
447
+ for item in response.items:
448
+ if count:
449
+ click.echo(",", nl=False)
450
+ click.echo(json_module.dumps(_history_item_json(item)), nl=False)
451
+ count += 1
469
452
  click.echo("]")
470
453
  return
471
454
 
472
455
  count = 0
473
456
  show_title = True
474
- async for response in _iter_history_pages(client, upgraded_image_name, first_page):
475
- if response.items:
476
- title = f"History for {response.tag}" if show_title else ""
477
- display_table(
478
- ["Image ID", "Published at", "Published by"],
479
- [_history_item_row(item) for item in response.items],
480
- title=title,
481
- )
482
- show_title = False
483
- count += len(response.items)
457
+ if response.items:
458
+ title = f"History for {response.tag}" if show_title else ""
459
+ display_table(
460
+ ["Image ID", "Published at", "Published by"],
461
+ [_history_item_row(item) for item in response.items],
462
+ title=title,
463
+ )
464
+ show_title = False
465
+ count += len(response.items)
484
466
 
485
467
  _print_result_summary(count)
486
468
 
@@ -293,8 +293,18 @@ def _start_shell_from_image(
293
293
  multiple=True,
294
294
  help="Name of a modal.Secret to mount inside the shell (if not using REF). Can be used multiple times.",
295
295
  )
296
- @click.option("--cpu", default=None, type=int, help="Number of CPUs to allocate to the shell (if not using REF).")
297
- @click.option("--memory", default=None, type=int, help="Memory to allocate for the shell, in MiB (if not using REF).")
296
+ @click.option(
297
+ "--cpu",
298
+ default=None,
299
+ type=int,
300
+ help="Number of CPU cores to request for the shell (if not using REF). The shell can burst above this request.",
301
+ )
302
+ @click.option(
303
+ "--memory",
304
+ default=None,
305
+ type=int,
306
+ help="Memory to request for the shell, in MiB (if not using REF). The shell can burst above this request.",
307
+ )
298
308
  @click.option(
299
309
  "--gpu",
300
310
  default=None,
@@ -24,8 +24,6 @@ volume_cli = ModalGroup(
24
24
  name="volume",
25
25
  help="""
26
26
  Read and edit `modal.Volume` volumes.
27
-
28
- Note: users of `modal.NetworkFileSystem` should use the `modal nfs` command instead.
29
27
  """,
30
28
  )
31
29
 
@@ -726,28 +726,35 @@ def member_tokens_list(json: bool):
726
726
 
727
727
 
728
728
  @member_tokens_cli.command("delete", no_args_is_help=True)
729
- @click.argument("token_id")
730
- @click.option("--allow-missing", is_flag=True, default=False, help="Don't error if the Token doesn't exist.")
729
+ @click.argument("token_ids", nargs=-1)
730
+ @click.option(
731
+ "--allow-missing", is_flag=True, default=False, help="Don't error if any of the specified tokens don't exist."
732
+ )
731
733
  @yes_option
732
- def member_tokens_delete(token_id: str, *, allow_missing: bool, yes: bool):
733
- """Delete a Member Token in this Workspace.
734
+ def member_tokens_delete(token_ids: list[str], *, allow_missing: bool, yes: bool):
735
+ """Delete member tokens in this Workspace.
734
736
 
735
- Note that this action is irreversible. This will immediately invalidate the target token and will
736
- render it unable to authenticate with Modal.
737
+ Note that this action is irreversible. This will immediately invalidate the target tokens and will
738
+ render them unable to authenticate with Modal.
737
739
 
738
740
  ```bash
739
- # Delete the Token with ID `ak-0123456789abcdefghijkl`
741
+ # Delete the token with ID `ak-0123456789abcdefghijkl`
740
742
  modal workspace member-tokens delete ak-0123456789abcdefghijkl
743
+
744
+ # Delete multiple tokens
745
+ modal workspace member-tokens delete ak-0123456789abcdefghijkl ak-mnopqrstuvwxyz01234567
741
746
  ```
742
747
  """
743
748
  if not yes:
744
- confirm_or_suggest_yes(f"Are you sure you want to irrevocably delete the Token '{token_id}'?")
749
+ confirm_or_suggest_yes(f"Are you sure you want to irrevocably delete {len(token_ids)} token(s)?")
745
750
 
746
751
  ws = Workspace.from_context()
747
- ws.member_tokens.delete(token_id, allow_missing=allow_missing)
752
+ deleted_token_ids = ws.member_tokens.delete(*token_ids, allow_missing=allow_missing)
748
753
 
749
754
  output_manager = OutputManager.get()
750
- output_manager.print(f"[green]✓[/green] Deleted Token `{token_id}`.")
755
+ output_manager.print(
756
+ f"[green]✓[/green] Deleted {len(deleted_token_ids)} {'token' if len(deleted_token_ids) == 1 else 'tokens'}."
757
+ )
751
758
 
752
759
 
753
760
  @member_tokens_cli.command("disable", no_args_is_help=True)
@@ -85,7 +85,7 @@ class _Client:
85
85
  server_url: str,
86
86
  client_type: int,
87
87
  credentials: typing.Optional[tuple[str, str]],
88
- version: str = "1.6.5.dev3",
88
+ version: str = "1.6.5.dev5",
89
89
  *,
90
90
  oauth_credentials: typing.Optional[_OAuthCredentials] = None,
91
91
  ):
@@ -310,7 +310,7 @@ class Client:
310
310
  server_url: str,
311
311
  client_type: int,
312
312
  credentials: typing.Optional[tuple[str, str]],
313
- version: str = "1.6.5.dev3",
313
+ version: str = "1.6.5.dev5",
314
314
  *,
315
315
  oauth_credentials: typing.Optional[_OAuthCredentials] = None,
316
316
  ):
@@ -242,10 +242,12 @@ class _Sandbox(_Object, type_prefixes=("sb",)):
242
242
  cpu:
243
243
  Specify, in fractional CPU cores, how many CPU cores to request. Or, pass (request, limit) to
244
244
  additionally specify a hard limit in fractional CPU cores. CPU throttling will prevent a container
245
- from exceeding its specified limit.
245
+ from exceeding its specified limit. Modal Sandboxes support bursting above the CPU request, so most
246
+ users don't need to specify a request.
246
247
  memory:
247
248
  Specify, in MiB, a memory request which is the minimum memory required. Or, pass (request, limit) to
248
- additionally specify a hard limit in MiB.
249
+ additionally specify a hard limit in MiB. Modal Sandboxes support bursting above the memory request,
250
+ so most users don't need to specify a request.
249
251
  runtime:
250
252
  Runtime under which the Sandbox executes, or None to let Modal pick.
251
253
  block_network: Whether to block network access.
@@ -272,7 +274,9 @@ class _Sandbox(_Object, type_prefixes=("sb",)):
272
274
  proxy: Reference to a Modal Proxy to use in front of this Sandbox.
273
275
  include_oidc_identity_token:
274
276
  If True, the sandbox will receive a MODAL_IDENTITY_TOKEN env var for OIDC-based auth.
275
- readiness_probe: Probe used to determine when the sandbox has become ready.
277
+ readiness_probe:
278
+ Probe used to determine when the Sandbox is ready.
279
+ If not configured, the Sandbox is ready when it starts.
276
280
  verbose: Enable verbose logging for sandbox operations.
277
281
  experimental_options: Experimental options to pass to the sandbox.
278
282
  _experimental_enable_snapshot: Enable memory snapshots.
@@ -971,9 +975,10 @@ class _Sandbox(_Object, type_prefixes=("sb",)):
971
975
  await self._impl.wait(raise_on_termination)
972
976
 
973
977
  async def wait_until_ready(self, *, timeout: int = 300) -> None:
974
- """Wait for the Sandbox readiness probe to report that the Sandbox is ready.
978
+ """Wait until the Sandbox is ready.
975
979
 
976
- The Sandbox must be configured with a `readiness_probe` in order to use this method.
980
+ A Sandbox with a readiness probe is ready once the probe passes;
981
+ a Sandbox without one is ready once it starts.
977
982
 
978
983
  Args:
979
984
  timeout: Maximum time in seconds to wait for readiness.
@@ -812,7 +812,10 @@ class TaskCommandRouterClient:
812
812
  )
813
813
 
814
814
  async def sandbox_wait_until_ready(self, task_id: str, timeout: float) -> sr_pb2.SandboxWaitUntilReadyTcrResponse:
815
- """Wait until the sandbox's readiness probe reports ready.
815
+ """Wait until the Sandbox is ready.
816
+
817
+ A Sandbox with a readiness probe is ready once the probe passes;
818
+ a Sandbox without one is ready once it starts.
816
819
 
817
820
  Args:
818
821
  task_id: The task ID hosting the sandbox.