modal 1.5.4.dev9__tar.gz → 1.5.4.dev10__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 (238) hide show
  1. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/PKG-INFO +1 -1
  2. modal-1.5.4.dev10/modal/_utils/auth_token_manager.py +181 -0
  3. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/task_command_router_client.py +4 -3
  4. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/client.pyi +2 -2
  5. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/functions.pyi +6 -6
  6. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/sandbox.py +3 -0
  7. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal.egg-info/PKG-INFO +1 -1
  8. modal-1.5.4.dev10/modal_proto/__init__.py +11 -0
  9. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_proto/api_grpc.py +16 -0
  10. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_proto/api_pb2.py +1185 -1155
  11. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_proto/api_pb2.pyi +67 -0
  12. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_proto/api_pb2_grpc.py +34 -0
  13. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_proto/api_pb2_grpc.pyi +17 -0
  14. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_proto/modal_api_grpc.py +1 -0
  15. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_version/__init__.py +1 -1
  16. modal-1.5.4.dev9/modal/_utils/auth_token_manager.py +0 -157
  17. modal-1.5.4.dev9/modal_proto/__init__.py +0 -4
  18. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/LICENSE +0 -0
  19. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/README.md +0 -0
  20. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/__init__.py +0 -0
  21. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/__main__.py +0 -0
  22. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_billing.py +0 -0
  23. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_clustered_functions.py +0 -0
  24. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_clustered_functions.pyi +0 -0
  25. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_container_entrypoint.py +0 -0
  26. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_environments.py +0 -0
  27. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_function_variants.py +0 -0
  28. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_functions.py +0 -0
  29. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_grpc_client.py +0 -0
  30. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_image.py +0 -0
  31. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_ipython.py +0 -0
  32. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_load_context.py +0 -0
  33. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_location.py +0 -0
  34. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_logs.py +0 -0
  35. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_logs_manager.py +0 -0
  36. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_logs_manager.pyi +0 -0
  37. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_object.py +0 -0
  38. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_output/__init__.py +0 -0
  39. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_output/manager.py +0 -0
  40. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_output/pty.py +0 -0
  41. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_output/rich.py +0 -0
  42. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_output/status.py +0 -0
  43. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_partial_function.py +0 -0
  44. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_resolver.py +0 -0
  45. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_resources.py +0 -0
  46. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_runtime/__init__.py +0 -0
  47. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_runtime/asgi.py +0 -0
  48. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_runtime/container_io_manager.py +0 -0
  49. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_runtime/container_io_manager.pyi +0 -0
  50. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_runtime/execution_context.py +0 -0
  51. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_runtime/execution_context.pyi +0 -0
  52. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_runtime/gpu_memory_snapshot.py +0 -0
  53. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_runtime/task_lifecycle_manager.py +0 -0
  54. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_runtime/task_lifecycle_manager.pyi +0 -0
  55. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_runtime/telemetry.py +0 -0
  56. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_runtime/user_code_event_loop.py +0 -0
  57. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_runtime/user_code_imports.py +0 -0
  58. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_serialization.py +0 -0
  59. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_server.py +0 -0
  60. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_supports_logs.py +0 -0
  61. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_traceback.py +0 -0
  62. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_tunnel.py +0 -0
  63. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_tunnel.pyi +0 -0
  64. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_type_manager.py +0 -0
  65. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/__init__.py +0 -0
  66. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/app_utils.py +0 -0
  67. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/async_utils.py +0 -0
  68. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/blob_utils.py +0 -0
  69. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/browser_utils.py +0 -0
  70. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/bytes_io_segment_payload.py +0 -0
  71. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/curl_utils.py +0 -0
  72. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/deprecation.py +0 -0
  73. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/display_utils.py +0 -0
  74. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/docker_utils.py +0 -0
  75. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/function_utils.py +0 -0
  76. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/git_utils.py +0 -0
  77. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/grpc_testing.py +0 -0
  78. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/grpc_utils.py +0 -0
  79. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/hash_utils.py +0 -0
  80. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/http_utils.py +0 -0
  81. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/jwt_utils.py +0 -0
  82. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/logger.py +0 -0
  83. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/mount_utils.py +0 -0
  84. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/name_utils.py +0 -0
  85. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/package_utils.py +0 -0
  86. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/pattern_utils.py +0 -0
  87. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/proxy_support.py +0 -0
  88. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/rand_pb_testing.py +0 -0
  89. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/sandbox_fs_utils.py +0 -0
  90. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/shell_utils.py +0 -0
  91. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_utils/time_utils.py +0 -0
  92. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_vendor/__init__.py +0 -0
  93. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_vendor/a2wsgi_wsgi.py +0 -0
  94. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_vendor/cloudpickle.py +0 -0
  95. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_vendor/tblib.py +0 -0
  96. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_vendor/version.py +0 -0
  97. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_watcher.py +0 -0
  98. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/_workspace.py +0 -0
  99. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/app.py +0 -0
  100. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/app.pyi +0 -0
  101. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/billing.py +0 -0
  102. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/billing.pyi +0 -0
  103. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/builder/2023.12.312.txt +0 -0
  104. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/builder/2023.12.txt +0 -0
  105. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/builder/2024.04.txt +0 -0
  106. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/builder/2024.10.txt +0 -0
  107. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/builder/2025.06.txt +0 -0
  108. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/builder/PREVIEW.txt +0 -0
  109. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/builder/README.md +0 -0
  110. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/builder/base-images.json +0 -0
  111. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/call_graph.py +0 -0
  112. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/__init__.py +0 -0
  113. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/_download.py +0 -0
  114. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/_help.py +0 -0
  115. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/_traceback.py +0 -0
  116. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/app.py +0 -0
  117. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/billing.py +0 -0
  118. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/bootstrap.py +0 -0
  119. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/changelog.py +0 -0
  120. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/cluster.py +0 -0
  121. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/config.py +0 -0
  122. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/container.py +0 -0
  123. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/curl.py +0 -0
  124. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/dashboard.py +0 -0
  125. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/dict.py +0 -0
  126. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/endpoint.py +0 -0
  127. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/entry_point.py +0 -0
  128. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/environment.py +0 -0
  129. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/image.py +0 -0
  130. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/import_refs.py +0 -0
  131. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/launch.py +0 -0
  132. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/logo.py +0 -0
  133. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/network_file_system.py +0 -0
  134. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/profile.py +0 -0
  135. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/programs/__init__.py +0 -0
  136. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/programs/run_jupyter.py +0 -0
  137. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/programs/vscode.py +0 -0
  138. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/queues.py +0 -0
  139. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/run.py +0 -0
  140. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/secret.py +0 -0
  141. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/selector.py +0 -0
  142. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/shell.py +0 -0
  143. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/skills.py +0 -0
  144. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/token.py +0 -0
  145. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/utils.py +0 -0
  146. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/volume.py +0 -0
  147. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cli/workspace.py +0 -0
  148. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/client.py +0 -0
  149. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cloud_bucket_mount.py +0 -0
  150. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cloud_bucket_mount.pyi +0 -0
  151. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cls.py +0 -0
  152. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/cls.pyi +0 -0
  153. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/config.py +0 -0
  154. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/container_process.py +0 -0
  155. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/container_process.pyi +0 -0
  156. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/dict.py +0 -0
  157. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/dict.pyi +0 -0
  158. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/environments.py +0 -0
  159. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/environments.pyi +0 -0
  160. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/exception.py +0 -0
  161. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/experimental/__init__.py +0 -0
  162. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/experimental/flash.py +0 -0
  163. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/experimental/flash.pyi +0 -0
  164. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/experimental/ipython.py +0 -0
  165. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/file_io.py +0 -0
  166. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/file_io.pyi +0 -0
  167. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/file_pattern_matcher.py +0 -0
  168. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/functions.py +0 -0
  169. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/image.py +0 -0
  170. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/image.pyi +0 -0
  171. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/io_streams.py +0 -0
  172. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/io_streams.pyi +0 -0
  173. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/mount.py +0 -0
  174. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/mount.pyi +0 -0
  175. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/network_file_system.py +0 -0
  176. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/network_file_system.pyi +0 -0
  177. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/object.py +0 -0
  178. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/object.pyi +0 -0
  179. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/output.py +0 -0
  180. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/parallel_map.py +0 -0
  181. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/parallel_map.pyi +0 -0
  182. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/partial_function.py +0 -0
  183. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/partial_function.pyi +0 -0
  184. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/proxy.py +0 -0
  185. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/proxy.pyi +0 -0
  186. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/py.typed +0 -0
  187. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/queue.py +0 -0
  188. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/queue.pyi +0 -0
  189. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/retries.py +0 -0
  190. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/runner.py +0 -0
  191. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/runner.pyi +0 -0
  192. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/running_app.py +0 -0
  193. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/sandbox.pyi +0 -0
  194. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/sandbox_fs.py +0 -0
  195. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/sandbox_fs.pyi +0 -0
  196. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/schedule.py +0 -0
  197. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/scheduler_placement.py +0 -0
  198. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/secret.py +0 -0
  199. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/secret.pyi +0 -0
  200. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/server.py +0 -0
  201. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/server.pyi +0 -0
  202. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/serving.py +0 -0
  203. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/serving.pyi +0 -0
  204. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/skills/modal/SKILL.md +0 -0
  205. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/snapshot.py +0 -0
  206. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/snapshot.pyi +0 -0
  207. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/stream_type.py +0 -0
  208. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/token_flow.py +0 -0
  209. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/token_flow.pyi +0 -0
  210. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/types.py +0 -0
  211. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/volume.py +0 -0
  212. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/volume.pyi +0 -0
  213. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/workspace.py +0 -0
  214. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal/workspace.pyi +0 -0
  215. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal.egg-info/SOURCES.txt +0 -0
  216. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal.egg-info/dependency_links.txt +0 -0
  217. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal.egg-info/entry_points.txt +0 -0
  218. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal.egg-info/requires.txt +0 -0
  219. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal.egg-info/top_level.txt +0 -0
  220. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_docs/__init__.py +0 -0
  221. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_docs/gen_cli_docs.py +0 -0
  222. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_docs/gen_cli_docs_main.py +0 -0
  223. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_docs/gen_reference_docs.py +0 -0
  224. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_docs/gen_reference_docs_main.py +0 -0
  225. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_docs/mdmd/__init__.py +0 -0
  226. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_docs/mdmd/mdmd.py +0 -0
  227. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_docs/mdmd/signatures.py +0 -0
  228. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_docs/mdmd/types.py +0 -0
  229. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_docs/reference_intro.md +0 -0
  230. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_proto/py.typed +0 -0
  231. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_proto/task_command_router_grpc.py +0 -0
  232. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_proto/task_command_router_pb2.py +0 -0
  233. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_proto/task_command_router_pb2.pyi +0 -0
  234. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_proto/task_command_router_pb2_grpc.py +0 -0
  235. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_proto/task_command_router_pb2_grpc.pyi +0 -0
  236. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/modal_version/__main__.py +0 -0
  237. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/pyproject.toml +0 -0
  238. {modal-1.5.4.dev9 → modal-1.5.4.dev10}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 1.5.4.dev9
3
+ Version: 1.5.4.dev10
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License-Expression: Apache-2.0
@@ -0,0 +1,181 @@
1
+ # Copyright Modal Labs 2025
2
+ import asyncio
3
+ import base64
4
+ import json
5
+ import random
6
+ import time
7
+ from typing import Any
8
+
9
+ from modal._utils.grpc_utils import DEFAULT_MAX_RETRIES, Retry
10
+ from modal.exception import AuthError, ExecutionError, PermissionDeniedError
11
+ from modal_proto import api_pb2, modal_api_grpc
12
+
13
+ from .logger import logger
14
+
15
+ AUTH_DENIED_EXCEPTIONS = (AuthError, PermissionDeniedError)
16
+
17
+
18
+ class _AuthTokenManager:
19
+ """Handles fetching and refreshing of the input plane auth token."""
20
+
21
+ # Fraction of the token's lifetime to use before refreshing.
22
+ REFRESH_FRACTION = 0.5
23
+ # Width of the random band added on top of REFRESH_FRACTION, so that clients issued
24
+ # same-lifetime tokens at the same moment (a fan-out of containers starting together)
25
+ # spread their refreshes out instead of refreshing in lockstep every cycle. The band
26
+ # only ever delays a refresh, so the margin before expiry stays at no less than
27
+ # 1 - REFRESH_FRACTION - REFRESH_JITTER of the lifetime.
28
+ REFRESH_JITTER = 0.1
29
+ # Bound each AuthTokenGet attempt so a refresh can't hang.
30
+ AUTH_TOKEN_TIMEOUT = 5.0
31
+ AUTH_TOKEN_RETRY_TOTAL_TIMEOUT = 3 * AUTH_TOKEN_TIMEOUT
32
+ # After a failed refresh, wait before hitting the server again, growing exponentially with
33
+ # consecutive failures between these bounds (in seconds).
34
+ FAILURE_BACKOFF_BASE = 0.5
35
+ FAILURE_BACKOFF_MAX = 60.0
36
+ # If the token doesn't have an expiry field, default to current time plus this value (not expected).
37
+ DEFAULT_EXPIRY_OFFSET = 20 * 60
38
+
39
+ def __init__(self, stub: "modal_api_grpc.ModalClientModal"):
40
+ self._stub = stub
41
+ self._token = ""
42
+ self._expiry = 0.0
43
+ self._refresh_at = 0.0
44
+ self._retry_after = 0.0
45
+ self._backoff = self.FAILURE_BACKOFF_BASE
46
+ self._refresh_task: asyncio.Task | None = None
47
+
48
+ async def get_token(self) -> str:
49
+ """
50
+ When called, the AuthTokenManager can be in one of three states:
51
+ 1. Has a valid cached token. It is returned to the caller.
52
+ 2. Has no cached token, or the token is expired. We fetch a new one and cache it. If `get_token` is called
53
+ concurrently by multiple coroutines, all requests will block until the token has been fetched. But only one
54
+ coroutine will actually make a request to the control plane to fetch the new token. This ensures we do not hit
55
+ the control plane with more requests than needed.
56
+ 3. Has a valid cached token that has used up its refresh fraction of its lifetime. In this case we fetch a new
57
+ token and cache it. If `get_token` is called concurrently, only one request will fetch the new token, and the
58
+ others will be given the old (but still valid) token - i.e. they will not block.
59
+ """
60
+ if not self._token or self._is_expired():
61
+ # We either have no token or it is expired - block everyone until we get a new token
62
+ await self._try_refresh_token()
63
+ elif self._should_refresh():
64
+ # The token is still valid, but has used up its refresh fraction of its lifetime.
65
+ if self._refresh_task is not None:
66
+ # A refresh is in flight, so someone else is refreshing. Continue to use the old token.
67
+ return self._token
68
+ else:
69
+ # Nobody is refreshing, so we need to fetch a new token.
70
+ await self._try_refresh_token()
71
+
72
+ return self._token
73
+
74
+ async def _try_refresh_token(self):
75
+ try:
76
+ await self._refresh_token()
77
+ except AUTH_DENIED_EXCEPTIONS:
78
+ raise
79
+ except Exception as e:
80
+ if not self._token:
81
+ raise
82
+ logger.warning("Auth token refresh failed; falling back to cached token: %s", e)
83
+
84
+ async def _refresh_token(self):
85
+ """
86
+ Fetch a new token from the control plane. Concurrent callers share a single request: the first caller starts it
87
+ and the others await the same task, so a burst of callers results in one RPC whether it succeeds or fails. The
88
+ task is owned by the event loop rather than by the caller that started it, so it runs to completion even if that
89
+ caller goes away.
90
+ """
91
+ if self._refresh_task is None:
92
+ # Maybe another coroutine refreshed already, or we're cooling down after a failure.
93
+ if self._token and not self._should_refresh():
94
+ return
95
+ # Note: the task is created in async code so it binds to the synchronicity event loop.
96
+ self._refresh_task = asyncio.create_task(self._fetch_token())
97
+ self._refresh_task.add_done_callback(self._refresh_task_done)
98
+ # Shielded so a cancelled caller doesn't cancel the refresh for everyone else.
99
+ await asyncio.shield(self._refresh_task)
100
+
101
+ def _refresh_task_done(self, task: "asyncio.Task"):
102
+ if self._refresh_task is task:
103
+ self._refresh_task = None
104
+ if not task.cancelled():
105
+ # Retrieve the exception, if any, so a failure isn't logged as unhandled when no caller is waiting.
106
+ task.exception()
107
+
108
+ async def _fetch_token(self):
109
+ """Make the AuthTokenGet request and cache its token, or arm the failure backoff."""
110
+ try:
111
+ resp: api_pb2.AuthTokenGetResponse = await self._stub.AuthTokenGet(
112
+ api_pb2.AuthTokenGetRequest(),
113
+ # No cached token to fall back on, so a failure is user-visible: retry transient errors.
114
+ # Otherwise one attempt, and _retry_after handles the cooldown.
115
+ retry=Retry(
116
+ attempt_timeout=self.AUTH_TOKEN_TIMEOUT,
117
+ total_timeout=self.AUTH_TOKEN_RETRY_TOTAL_TIMEOUT,
118
+ max_retries=0 if self._token else DEFAULT_MAX_RETRIES,
119
+ ),
120
+ )
121
+ if not resp.token:
122
+ # Not expected
123
+ raise ExecutionError(
124
+ "Internal error: Did not receive auth token from server. Please contact Modal support."
125
+ )
126
+ if exp := self._decode_jwt(resp.token).get("exp"):
127
+ expiry = float(exp)
128
+ else:
129
+ # This should never happen.
130
+ logger.warning("x-modal-auth-token does not contain exp field")
131
+ expiry = time.time() + self.DEFAULT_EXPIRY_OFFSET
132
+ self._token = resp.token
133
+ self._set_expiry(expiry)
134
+ self._retry_after = 0.0
135
+ self._backoff = self.FAILURE_BACKOFF_BASE
136
+ except AUTH_DENIED_EXCEPTIONS:
137
+ raise
138
+ except Exception as e:
139
+ # Back off (exponentially on consecutive failures) so we don't hammer a struggling server.
140
+ self._retry_after = time.time() + self._backoff
141
+ self._backoff = min(self._backoff * 2, self.FAILURE_BACKOFF_MAX)
142
+ raise
143
+
144
+ @staticmethod
145
+ def _decode_jwt(token: str) -> dict[str, Any]:
146
+ """
147
+ Decodes a JWT into a dict without verifying signature. We do this manually instead of using a library to avoid
148
+ adding another dependency to the client.
149
+ """
150
+ try:
151
+ payload = token.split(".")[1]
152
+ padding = "=" * (-len(payload) % 4)
153
+ decoded_bytes = base64.urlsafe_b64decode(payload + padding)
154
+ return json.loads(decoded_bytes)
155
+ except Exception as e:
156
+ raise ValueError("Internal error: Cannot parse auth token. Please contact Modal support.") from e
157
+
158
+ def _in_backoff(self):
159
+ return time.time() < self._retry_after
160
+
161
+ def _should_refresh(self):
162
+ # Fetch only when the token is stale/expiring and we're not in a post-failure backoff.
163
+ return self._needs_refresh() and not self._in_backoff()
164
+
165
+ def _set_expiry(self, expiry: float) -> None:
166
+ """Record a new expiry and schedule the proactive refresh a jittered fraction of the way through.
167
+
168
+ The delay is measured from the remaining lifetime as this client sees it, so a client whose clock is
169
+ skewed relative to the issuer still keeps a margin proportional to the lifetime it observes.
170
+ """
171
+ now = time.time()
172
+ self._expiry = expiry
173
+ remaining = max(expiry - now, 0.0)
174
+ fraction = self.REFRESH_FRACTION + random.random() * self.REFRESH_JITTER
175
+ self._refresh_at = now + remaining * fraction
176
+
177
+ def _needs_refresh(self):
178
+ return time.time() >= self._refresh_at
179
+
180
+ def _is_expired(self):
181
+ return time.time() >= self._expiry
@@ -292,9 +292,10 @@ class TaskCommandRouterClient:
292
292
  ) -> "TaskCommandRouterClient":
293
293
  """Initialize a TaskCommandRouterClient for a V2 sandbox.
294
294
 
295
- `access` is the router access returned by SandboxCreateV2, which lets a
296
- freshly created sandbox connect without a round-trip. When it is absent —
297
- a re-attached sandbox, or the server could not mint a token — we ask for it.
295
+ `access` is the router access returned by SandboxCreateV2/SandboxRestoreV2,
296
+ which lets a freshly scheduled sandbox connect without a round-trip. When it
297
+ is absent — a re-attached sandbox, or the server could not mint a token — we
298
+ ask for it.
298
299
  """
299
300
  if access is not None:
300
301
  url, jwt = access.url, access.jwt
@@ -37,7 +37,7 @@ class _Client:
37
37
  server_url: str,
38
38
  client_type: int,
39
39
  credentials: typing.Optional[tuple[str, str]],
40
- version: str = "1.5.4.dev9",
40
+ version: str = "1.5.4.dev10",
41
41
  ):
42
42
  """mdmd:hidden
43
43
  The Modal client object is not intended to be instantiated directly by users.
@@ -207,7 +207,7 @@ class Client:
207
207
  server_url: str,
208
208
  client_type: int,
209
209
  credentials: typing.Optional[tuple[str, str]],
210
- version: str = "1.5.4.dev9",
210
+ version: str = "1.5.4.dev10",
211
211
  ):
212
212
  """mdmd:hidden
213
213
  The Modal client object is not intended to be instantiated directly by users.
@@ -546,7 +546,7 @@ class Function(
546
546
 
547
547
  _call_generator: ___call_generator_spec
548
548
 
549
- class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
549
+ class __remote_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
550
550
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER:
551
551
  """Calls the function remotely, executing it with the given arguments and returning the execution's result.
552
552
 
@@ -571,7 +571,7 @@ class Function(
571
571
  """
572
572
  ...
573
573
 
574
- remote: __remote_spec[modal._functions.ReturnType, modal._functions.P]
574
+ remote: __remote_spec[modal._functions.P, modal._functions.ReturnType]
575
575
 
576
576
  class __remote_gen_spec(typing_extensions.Protocol):
577
577
  def __call__(self, /, *args, **kwargs) -> typing.Generator[typing.Any, None, None]:
@@ -621,7 +621,7 @@ class Function(
621
621
  """
622
622
  ...
623
623
 
624
- class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
624
+ class ___experimental_spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
625
625
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
626
626
  """[Experimental] Calls the function with the given arguments, without waiting for the results.
627
627
 
@@ -654,7 +654,7 @@ class Function(
654
654
  """
655
655
  ...
656
656
 
657
- _experimental_spawn: ___experimental_spawn_spec[modal._functions.ReturnType, modal._functions.P]
657
+ _experimental_spawn: ___experimental_spawn_spec[modal._functions.P, modal._functions.ReturnType]
658
658
 
659
659
  class ___spawn_map_inner_spec(typing_extensions.Protocol[P_INNER]):
660
660
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> None: ...
@@ -662,7 +662,7 @@ class Function(
662
662
 
663
663
  _spawn_map_inner: ___spawn_map_inner_spec[modal._functions.P]
664
664
 
665
- class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
665
+ class __spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
666
666
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
667
667
  """Calls the function with the given arguments, without waiting for the results.
668
668
 
@@ -695,7 +695,7 @@ class Function(
695
695
  """
696
696
  ...
697
697
 
698
- spawn: __spawn_spec[modal._functions.ReturnType, modal._functions.P]
698
+ spawn: __spawn_spec[modal._functions.P, modal._functions.ReturnType]
699
699
 
700
700
  def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]:
701
701
  """Return the inner Python object wrapped by this Modal Function.
@@ -2288,6 +2288,9 @@ class _Sandbox(_Object, type_prefix="sb"):
2288
2288
 
2289
2289
  sandbox = await _Sandbox.from_id(restore_resp.sandbox_id, client)
2290
2290
  sandbox._task_id = restore_resp.task_id
2291
+ # Seeded after from_id, whose hydration resets the field.
2292
+ if restore_resp.HasField("command_router_access"):
2293
+ sandbox._init_command_router_access = restore_resp.command_router_access
2291
2294
  return sandbox
2292
2295
 
2293
2296
  @property
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 1.5.4.dev9
3
+ Version: 1.5.4.dev10
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License-Expression: Apache-2.0
@@ -0,0 +1,11 @@
1
+ # Copyright Modal Labs 2024
2
+ """Modal gRPC types for Python.
3
+
4
+ Warning: direct usage of Modal's gRPC API is discouraged,
5
+ and no support or compatibility guarantees are provided.
6
+ Message fields or entire RPCs may be changed or removed
7
+ without notice. We recommend using official SDKs instead.
8
+ """
9
+ from pkgutil import extend_path
10
+
11
+ __path__ = extend_path(__path__, __name__) # type: ignore[has-type]
@@ -123,6 +123,10 @@ class ModalClientBase(abc.ABC):
123
123
  async def AuthTokenGet(self, stream: 'grpclib.server.Stream[modal_proto.api_pb2.AuthTokenGetRequest, modal_proto.api_pb2.AuthTokenGetResponse]') -> None:
124
124
  pass
125
125
 
126
+ @abc.abstractmethod
127
+ async def AutoscalerOverrideHistory(self, stream: 'grpclib.server.Stream[modal_proto.api_pb2.AutoscalerOverrideHistoryRequest, modal_proto.api_pb2.AutoscalerOverrideHistoryResponse]') -> None:
128
+ pass
129
+
126
130
  @abc.abstractmethod
127
131
  async def BlobCreate(self, stream: 'grpclib.server.Stream[modal_proto.api_pb2.BlobCreateRequest, modal_proto.api_pb2.BlobCreateResponse]') -> None:
128
132
  pass
@@ -1117,6 +1121,12 @@ class ModalClientBase(abc.ABC):
1117
1121
  modal_proto.api_pb2.AuthTokenGetRequest,
1118
1122
  modal_proto.api_pb2.AuthTokenGetResponse,
1119
1123
  ),
1124
+ '/modal.client.ModalClient/AutoscalerOverrideHistory': grpclib.const.Handler(
1125
+ self.AutoscalerOverrideHistory,
1126
+ grpclib.const.Cardinality.UNARY_UNARY,
1127
+ modal_proto.api_pb2.AutoscalerOverrideHistoryRequest,
1128
+ modal_proto.api_pb2.AutoscalerOverrideHistoryResponse,
1129
+ ),
1120
1130
  '/modal.client.ModalClient/BlobCreate': grpclib.const.Handler(
1121
1131
  self.BlobCreate,
1122
1132
  grpclib.const.Cardinality.UNARY_UNARY,
@@ -2533,6 +2543,12 @@ class ModalClientStub:
2533
2543
  modal_proto.api_pb2.AuthTokenGetRequest,
2534
2544
  modal_proto.api_pb2.AuthTokenGetResponse,
2535
2545
  )
2546
+ self.AutoscalerOverrideHistory = grpclib.client.UnaryUnaryMethod(
2547
+ channel,
2548
+ '/modal.client.ModalClient/AutoscalerOverrideHistory',
2549
+ modal_proto.api_pb2.AutoscalerOverrideHistoryRequest,
2550
+ modal_proto.api_pb2.AutoscalerOverrideHistoryResponse,
2551
+ )
2536
2552
  self.BlobCreate = grpclib.client.UnaryUnaryMethod(
2537
2553
  channel,
2538
2554
  '/modal.client.ModalClient/BlobCreate',