modal 1.6.2.dev8__tar.gz → 1.6.2.dev9__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 (245) hide show
  1. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/PKG-INFO +1 -1
  2. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_workspace.py +176 -0
  3. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/import_refs.py +36 -7
  4. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/run.py +51 -1
  5. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/client.pyi +2 -2
  6. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/functions.pyi +6 -6
  7. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/types.py +37 -0
  8. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/workspace.py +3 -0
  9. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/workspace.pyi +248 -0
  10. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal.egg-info/PKG-INFO +1 -1
  11. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_version/__init__.py +1 -1
  12. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/LICENSE +0 -0
  13. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/README.md +0 -0
  14. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/__init__.py +0 -0
  15. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/__main__.py +0 -0
  16. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_billing.py +0 -0
  17. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_cluster.py +0 -0
  18. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_cluster.pyi +0 -0
  19. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_container_entrypoint.py +0 -0
  20. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_environments.py +0 -0
  21. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_function_variants.py +0 -0
  22. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_functions.py +0 -0
  23. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_grpc_client.py +0 -0
  24. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_image.py +0 -0
  25. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_ipython.py +0 -0
  26. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_load_context.py +0 -0
  27. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_location.py +0 -0
  28. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_logs.py +0 -0
  29. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_logs_manager.py +0 -0
  30. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_logs_manager.pyi +0 -0
  31. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_metrics.py +0 -0
  32. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_metrics.pyi +0 -0
  33. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_object.py +0 -0
  34. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_outbound_policy.py +0 -0
  35. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_outbound_policy.pyi +0 -0
  36. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_output/__init__.py +0 -0
  37. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_output/manager.py +0 -0
  38. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_output/pty.py +0 -0
  39. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_output/rich.py +0 -0
  40. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_output/status.py +0 -0
  41. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_partial_function.py +0 -0
  42. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_resolver.py +0 -0
  43. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_resources.py +0 -0
  44. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_runtime/__init__.py +0 -0
  45. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_runtime/asgi.py +0 -0
  46. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_runtime/container_io_manager.py +0 -0
  47. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_runtime/container_io_manager.pyi +0 -0
  48. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_runtime/execution_context.py +0 -0
  49. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_runtime/execution_context.pyi +0 -0
  50. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_runtime/gpu_memory_snapshot.py +0 -0
  51. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_runtime/task_lifecycle_manager.py +0 -0
  52. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_runtime/task_lifecycle_manager.pyi +0 -0
  53. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_runtime/telemetry.py +0 -0
  54. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_runtime/user_code_event_loop.py +0 -0
  55. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_runtime/user_code_imports.py +0 -0
  56. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_serialization.py +0 -0
  57. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_server.py +0 -0
  58. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_server.pyi +0 -0
  59. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_supports_logs.py +0 -0
  60. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_traceback.py +0 -0
  61. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_tunnel.py +0 -0
  62. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_tunnel.pyi +0 -0
  63. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_type_manager.py +0 -0
  64. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/__init__.py +0 -0
  65. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/app_utils.py +0 -0
  66. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/async_utils.py +0 -0
  67. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/auth_token_manager.py +0 -0
  68. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/blob_utils.py +0 -0
  69. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/browser_utils.py +0 -0
  70. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/bytes_io_segment_payload.py +0 -0
  71. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/curl_utils.py +0 -0
  72. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/deprecation.py +0 -0
  73. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/display_utils.py +0 -0
  74. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/docker_utils.py +0 -0
  75. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/function_utils.py +0 -0
  76. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/git_utils.py +0 -0
  77. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/grpc_testing.py +0 -0
  78. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/grpc_utils.py +0 -0
  79. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/hash_utils.py +0 -0
  80. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/http_utils.py +0 -0
  81. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/idle_countdown.py +0 -0
  82. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/jwt_utils.py +0 -0
  83. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/logger.py +0 -0
  84. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/mount_utils.py +0 -0
  85. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/name_utils.py +0 -0
  86. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/package_utils.py +0 -0
  87. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/pattern_utils.py +0 -0
  88. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/proxy_support.py +0 -0
  89. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/rand_pb_testing.py +0 -0
  90. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/sandbox_fs_utils.py +0 -0
  91. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/shell_utils.py +0 -0
  92. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_utils/time_utils.py +0 -0
  93. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_vendor/__init__.py +0 -0
  94. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_vendor/a2wsgi_wsgi.py +0 -0
  95. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_vendor/cloudpickle.py +0 -0
  96. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_vendor/tblib.py +0 -0
  97. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_vendor/version.py +0 -0
  98. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/_watcher.py +0 -0
  99. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/app.py +0 -0
  100. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/app.pyi +0 -0
  101. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/billing.py +0 -0
  102. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/billing.pyi +0 -0
  103. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/builder/2023.12.312.txt +0 -0
  104. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/builder/2023.12.txt +0 -0
  105. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/builder/2024.04.txt +0 -0
  106. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/builder/2024.10.txt +0 -0
  107. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/builder/2025.06.txt +0 -0
  108. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/builder/PREVIEW.txt +0 -0
  109. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/builder/README.md +0 -0
  110. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/builder/base-images.json +0 -0
  111. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/call_graph.py +0 -0
  112. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/__init__.py +0 -0
  113. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/_download.py +0 -0
  114. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/_help.py +0 -0
  115. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/_logs.py +0 -0
  116. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/_stats.py +0 -0
  117. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/_traceback.py +0 -0
  118. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/app.py +0 -0
  119. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/billing.py +0 -0
  120. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/changelog.py +0 -0
  121. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/config.py +0 -0
  122. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/container.py +0 -0
  123. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/curl.py +0 -0
  124. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/dashboard.py +0 -0
  125. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/dict.py +0 -0
  126. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/endpoint.py +0 -0
  127. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/entry_point.py +0 -0
  128. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/environment.py +0 -0
  129. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/function.py +0 -0
  130. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/image.py +0 -0
  131. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/logo.py +0 -0
  132. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/network_file_system.py +0 -0
  133. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/profile.py +0 -0
  134. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/queues.py +0 -0
  135. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/secret.py +0 -0
  136. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/selector.py +0 -0
  137. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/server.py +0 -0
  138. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/shell.py +0 -0
  139. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/skills.py +0 -0
  140. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/token.py +0 -0
  141. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/utils.py +0 -0
  142. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/volume.py +0 -0
  143. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cli/workspace.py +0 -0
  144. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/client.py +0 -0
  145. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cloud_bucket_mount.py +0 -0
  146. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cloud_bucket_mount.pyi +0 -0
  147. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cls.py +0 -0
  148. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cls.pyi +0 -0
  149. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cluster.py +0 -0
  150. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/cluster.pyi +0 -0
  151. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/config.py +0 -0
  152. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/container_process.py +0 -0
  153. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/container_process.pyi +0 -0
  154. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/dict.py +0 -0
  155. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/dict.pyi +0 -0
  156. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/environments.py +0 -0
  157. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/environments.pyi +0 -0
  158. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/exception.py +0 -0
  159. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/experimental/__init__.py +0 -0
  160. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/experimental/_flash_container_entry.py +0 -0
  161. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/experimental/flash.py +0 -0
  162. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/experimental/flash.pyi +0 -0
  163. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/experimental/flash_server.py +0 -0
  164. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/experimental/flash_server.pyi +0 -0
  165. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/experimental/ipython.py +0 -0
  166. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/file_pattern_matcher.py +0 -0
  167. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/functions.py +0 -0
  168. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/image.py +0 -0
  169. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/image.pyi +0 -0
  170. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/io_streams.py +0 -0
  171. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/io_streams.pyi +0 -0
  172. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/mount.py +0 -0
  173. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/mount.pyi +0 -0
  174. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/network_file_system.py +0 -0
  175. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/network_file_system.pyi +0 -0
  176. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/object.py +0 -0
  177. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/object.pyi +0 -0
  178. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/output.py +0 -0
  179. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/parallel_map.py +0 -0
  180. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/parallel_map.pyi +0 -0
  181. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/partial_function.py +0 -0
  182. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/partial_function.pyi +0 -0
  183. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/proxy.py +0 -0
  184. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/proxy.pyi +0 -0
  185. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/py.typed +0 -0
  186. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/queue.py +0 -0
  187. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/queue.pyi +0 -0
  188. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/retries.py +0 -0
  189. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/runner.py +0 -0
  190. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/runner.pyi +0 -0
  191. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/running_app.py +0 -0
  192. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/sandbox/__init__.py +0 -0
  193. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/sandbox/_common.py +0 -0
  194. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/sandbox/_filesystem.py +0 -0
  195. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/sandbox/_sandbox.py +0 -0
  196. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/sandbox/_sidecar.py +0 -0
  197. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/sandbox/_snapshot.py +0 -0
  198. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/sandbox/_task_command_router_client.py +0 -0
  199. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/sandbox/sandbox.py +0 -0
  200. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/sandbox/sandbox.pyi +0 -0
  201. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/schedule.py +0 -0
  202. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/scheduler_placement.py +0 -0
  203. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/secret.py +0 -0
  204. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/secret.pyi +0 -0
  205. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/server.py +0 -0
  206. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/server.pyi +0 -0
  207. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/serving.py +0 -0
  208. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/serving.pyi +0 -0
  209. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/skills/modal/SKILL.md +0 -0
  210. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/stream_type.py +0 -0
  211. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/token_flow.py +0 -0
  212. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/token_flow.pyi +0 -0
  213. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/volume.py +0 -0
  214. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal/volume.pyi +0 -0
  215. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal.egg-info/SOURCES.txt +0 -0
  216. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal.egg-info/dependency_links.txt +0 -0
  217. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal.egg-info/entry_points.txt +0 -0
  218. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal.egg-info/requires.txt +0 -0
  219. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal.egg-info/top_level.txt +0 -0
  220. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_docs/__init__.py +0 -0
  221. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_docs/gen_cli_docs.py +0 -0
  222. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_docs/gen_cli_docs_main.py +0 -0
  223. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_docs/gen_reference_docs.py +0 -0
  224. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_docs/gen_reference_docs_main.py +0 -0
  225. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_docs/mdmd/__init__.py +0 -0
  226. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_docs/mdmd/mdmd.py +0 -0
  227. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_docs/mdmd/signatures.py +0 -0
  228. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_docs/mdmd/types.py +0 -0
  229. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_docs/reference_intro.md +0 -0
  230. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_proto/__init__.py +0 -0
  231. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_proto/api_grpc.py +0 -0
  232. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_proto/api_pb2.py +0 -0
  233. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_proto/api_pb2.pyi +0 -0
  234. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_proto/api_pb2_grpc.py +0 -0
  235. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_proto/api_pb2_grpc.pyi +0 -0
  236. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_proto/modal_api_grpc.py +0 -0
  237. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_proto/py.typed +0 -0
  238. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_proto/task_command_router_grpc.py +0 -0
  239. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_proto/task_command_router_pb2.py +0 -0
  240. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_proto/task_command_router_pb2.pyi +0 -0
  241. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_proto/task_command_router_pb2_grpc.py +0 -0
  242. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_proto/task_command_router_pb2_grpc.pyi +0 -0
  243. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/modal_version/__main__.py +0 -0
  244. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/pyproject.toml +0 -0
  245. {modal-1.6.2.dev8 → modal-1.6.2.dev9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 1.6.2.dev8
3
+ Version: 1.6.2.dev9
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License-Expression: Apache-2.0
@@ -9,6 +9,7 @@ from typing import Optional
9
9
  from google.protobuf.empty_pb2 import Empty
10
10
 
11
11
  from modal.exception import DeprecationError, InvalidError
12
+ from modal.types import ServiceUserInfo
12
13
  from modal_proto import api_pb2
13
14
 
14
15
  from ._load_context import LoadContext
@@ -129,6 +130,15 @@ class _Workspace(_Object, type_prefix="ac"):
129
130
  """Namespace for Workspace settings APIs."""
130
131
  return _WorkspaceSettingsManager(self)
131
132
 
133
+ @property
134
+ def service_users(self) -> "_WorkspaceServiceUserManager":
135
+ """Namespace for managing Service Users in a Workspace.
136
+
137
+ See [the guide](https://modal.com/docs/guide/service-users) for more information about Service
138
+ Users.
139
+ """
140
+ return _WorkspaceServiceUserManager(self)
141
+
132
142
 
133
143
  class _WorkspaceProxyTokenManager:
134
144
  """mdmd:namespace"""
@@ -556,3 +566,169 @@ class _WorkspaceSettingsManager:
556
566
  await self._set_default_environment(value)
557
567
  case _:
558
568
  raise ValueError(f"Unknown setting {name!r}. Valid settings: {', '.join(self._valid_settings())}")
569
+
570
+
571
+ class _WorkspaceServiceUserManager:
572
+ """mdmd:namespace"""
573
+
574
+ def __init__(self, workspace: _Workspace):
575
+ """mdmd:hidden"""
576
+ self._workspace = workspace
577
+
578
+ async def create(self, name: str, *, expires_in: int | None) -> TokenData:
579
+ """Create a new Service User in the current workspace.
580
+
581
+ To call this function, you are required to have Manager permissions in the Workspace.
582
+
583
+ Args:
584
+ name: The name of the new Service User. Must consistent only of alphanumeric, '-', or '_'
585
+ characters.
586
+ expires_in: An expiration time, in seconds, after which the token will stop working. If
587
+ `None`, the token will never expire.
588
+
589
+ Returns:
590
+ A `TokenData` dataclass containing the credentials for the Service User. Note that this
591
+ is the only time you will be able to view these credentials.
592
+
593
+ Examples:
594
+
595
+ ```python notest
596
+ ws = modal.Workspace.from_context()
597
+
598
+ # Creates a Service User named "test-service-user", whose credentials expire after one year.
599
+ service_user_token_data = ws.service_users.create(
600
+ "test-service-user",
601
+ expires_in=datetime.timedelta(days=365).total_seconds(),
602
+ )
603
+ ```
604
+ """
605
+ if not self._workspace._is_hydrated:
606
+ await self._workspace.hydrate()
607
+
608
+ if expires_in is None:
609
+ req = api_pb2.ServiceUserCreateRequest(name=name)
610
+ else:
611
+ req = api_pb2.ServiceUserCreateRequest(name=name, expires_in_seconds=expires_in)
612
+
613
+ resp = await self._workspace.client._stub.ServiceUserCreate(req)
614
+
615
+ return TokenData(token_id=resp.token_id, token_secret=resp.token_secret)
616
+
617
+ async def set_role(
618
+ self,
619
+ service_user_name: str,
620
+ environment_name: str,
621
+ *,
622
+ role: str,
623
+ ) -> None:
624
+ """Set the role of a specified Service User within an Environment.
625
+
626
+ To call this function, you are required to have Manager permissions in the Workspace.
627
+
628
+ Args:
629
+ service_user_name: The name of the Service User.
630
+ environment_name: The name of the Environment to which the Service User's new role will
631
+ apply.
632
+ role: The access level to grant this Service User. Must be one of the strings `"no-access"`,
633
+ `"viewer"`, or `"contributor"`.
634
+
635
+ Examples:
636
+
637
+ ```python notest
638
+ ws = modal.Workspace.from_context()
639
+ # Grants Service User "test-service-user" the Viewer role in Environment "production"
640
+ ws.service_users.set_role("test-service-user", "production", role="viewer")
641
+
642
+ # Revokes access to "production" from Service User "test-service-user"
643
+ ws.service_users.set_role("test-service-user", "production", role="no-access")
644
+ ```
645
+ """
646
+
647
+ if not self._workspace._is_hydrated:
648
+ await self._workspace.hydrate()
649
+
650
+ from ._environments import _Environment
651
+
652
+ env = _Environment.from_name(environment_name, client=self._workspace.client)
653
+ await env.hydrate()
654
+
655
+ await self._workspace.client._stub.EnvironmentRoleSet(
656
+ api_pb2.EnvironmentRoleSetRequest(
657
+ service_user_name=service_user_name,
658
+ environment_id=env.object_id,
659
+ role_str=role,
660
+ )
661
+ )
662
+
663
+ async def info(self, name: str) -> ServiceUserInfo:
664
+ """Get information about a specific Service User.
665
+
666
+ To call this function, you are required to have Manager permissions in the Workspace.
667
+
668
+ Args:
669
+ name: The name of the Service User to introspect.
670
+
671
+ Returns:
672
+ A `ServiceUserInfo` dataclass containing information about the Service User.
673
+
674
+ Examples:
675
+
676
+ ```python notest
677
+ ws = modal.Workspace.from_context()
678
+ service_user = ws.service_users.info("test-service-user")
679
+ ```
680
+ """
681
+
682
+ if not self._workspace._is_hydrated:
683
+ await self._workspace.hydrate()
684
+
685
+ resp = await self._workspace.client._stub.ServiceUserInfo(
686
+ api_pb2.ServiceUserInfoRequest(service_user_name=name)
687
+ )
688
+
689
+ return ServiceUserInfo._from_proto(resp.service_user)
690
+
691
+ async def list(self) -> list[ServiceUserInfo]:
692
+ """List all Service Users in the current workspace.
693
+
694
+ To call this function, you are required to have Manager permissions in the Workspace.
695
+
696
+ Returns:
697
+ A list of `ServiceUserInfo` dataclasses.
698
+
699
+ Examples:
700
+
701
+ ```python notest
702
+ ws = modal.Workspace.from_context()
703
+ for service_user in ws.service_users.list():
704
+ print(service_user.name)
705
+ ```
706
+ """
707
+
708
+ if not self._workspace._is_hydrated:
709
+ await self._workspace.hydrate()
710
+
711
+ resp = await self._workspace.client._stub.ServiceUserList(Empty())
712
+
713
+ return [ServiceUserInfo._from_proto(su) for su in resp.service_users]
714
+
715
+ async def delete(self, name: str) -> None:
716
+ """Permanently delete a Service User.
717
+
718
+ To call this function, you are required to have Manager permissions in the Workspace.
719
+
720
+ Args:
721
+ name: The name of the Service User to delete.
722
+
723
+ Examples:
724
+
725
+ ```python notest
726
+ ws = modal.Workspace.from_context()
727
+ ws.service_users.delete("test-service-user")
728
+ ```
729
+ """
730
+
731
+ if not self._workspace._is_hydrated:
732
+ await self._workspace.hydrate()
733
+
734
+ await self._workspace.client._stub.ServiceUserDelete(api_pb2.ServiceUserDeleteRequest(service_user_name=name))
@@ -7,11 +7,14 @@ or the app lookup of `modal deploy some_file.py`.
7
7
  These functions are only called by the Modal CLI, not in tasks.
8
8
  """
9
9
 
10
+ import atexit
10
11
  import dataclasses
11
12
  import importlib
12
13
  import importlib.util
13
14
  import inspect
15
+ import shutil
14
16
  import sys
17
+ import tempfile
15
18
  import typing
16
19
  from collections import defaultdict
17
20
  from dataclasses import dataclass
@@ -60,15 +63,40 @@ def parse_import_ref(object_ref: str, use_module_mode: bool = False, command: st
60
63
 
61
64
  DEFAULT_APP_NAME = "app"
62
65
 
66
+ STDIN_REF = "-"
67
+ STDIN_MODULE_NAME = "modal_stdin_app"
63
68
 
64
- def import_file_or_module(import_ref: ImportRef, base_cmd: str = ""):
69
+
70
+ def _write_stdin_script() -> str:
71
+ if sys.stdin is None or sys.stdin.isatty():
72
+ raise InvalidError("No script was piped on stdin. Usage: `cat my_app.py | modal run -`")
73
+ source = sys.stdin.read()
74
+ # The file must outlive the import: the entrypoint mount is built from it when the App runs.
75
+ tmp_dir = tempfile.mkdtemp(prefix="modal-stdin-")
76
+ atexit.register(shutil.rmtree, tmp_dir, ignore_errors=True)
77
+ script_path = Path(tmp_dir) / f"{STDIN_MODULE_NAME}.py"
78
+ script_path.write_text(source)
79
+ return str(script_path)
80
+
81
+
82
+ def import_file_or_module(import_ref: ImportRef, base_cmd: str = "", allow_stdin: bool = False):
65
83
  if "" not in sys.path:
66
84
  # When running from a CLI like `modal run`
67
85
  # the current working directory isn't added to sys.path
68
86
  # so we add it in order to make module path specification possible
69
87
  sys.path.insert(0, "") # "" means the current working directory
70
88
 
71
- if not import_ref.file_or_module.endswith(".py") or import_ref.use_module_mode:
89
+ from_stdin = import_ref.file_or_module == STDIN_REF
90
+ if from_stdin:
91
+ if not allow_stdin:
92
+ raise InvalidError(f"`{base_cmd}` does not support reading a script from stdin.")
93
+ if import_ref.use_module_mode:
94
+ raise InvalidError("Reading a script from stdin (`-`) can't be combined with the -m flag.")
95
+ script_path = _write_stdin_script()
96
+ else:
97
+ script_path = import_ref.file_or_module
98
+
99
+ if not script_path.endswith(".py") or import_ref.use_module_mode:
72
100
  if not import_ref.use_module_mode:
73
101
  raise InvalidError(
74
102
  "Python module paths must be specified with the -m flag. "
@@ -82,7 +110,7 @@ def import_file_or_module(import_ref: ImportRef, base_cmd: str = ""):
82
110
  else:
83
111
  # when using a script path, that scripts directory should also be on the path as it is
84
112
  # with `python some/script.py`
85
- full_path = Path(import_ref.file_or_module).resolve()
113
+ full_path = Path(script_path).resolve()
86
114
  if "." in full_path.name.removesuffix(".py"):
87
115
  raise InvalidError(
88
116
  f"Invalid Modal source filename: {full_path.name!r}."
@@ -90,10 +118,10 @@ def import_file_or_module(import_ref: ImportRef, base_cmd: str = ""):
90
118
  )
91
119
  sys.path.insert(0, str(full_path.parent))
92
120
 
93
- module_name = inspect.getmodulename(import_ref.file_or_module)
121
+ module_name = inspect.getmodulename(script_path)
94
122
  assert module_name is not None
95
123
  # Import the module - see https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly
96
- spec = importlib.util.spec_from_file_location(module_name, import_ref.file_or_module)
124
+ spec = importlib.util.spec_from_file_location(module_name, script_path)
97
125
  assert spec is not None
98
126
  module = importlib.util.module_from_spec(spec)
99
127
  sys.modules[module_name] = module
@@ -103,7 +131,7 @@ def import_file_or_module(import_ref: ImportRef, base_cmd: str = ""):
103
131
  spec.loader.exec_module(module)
104
132
  except Exception as exc:
105
133
  if isinstance(exc, ImportError) and "attempted relative import with no known parent package" in str(exc):
106
- if import_ref.file_or_module and import_ref.command and not import_ref.use_module_mode:
134
+ if import_ref.command and not import_ref.use_module_mode and not from_stdin:
107
135
  file_path = Path(import_ref.file_or_module)
108
136
  suggested_module_path = ".".join(file_path.parts).removesuffix(".py").lstrip(".")
109
137
  suffix = f"::{import_ref.object_path}" if import_ref.object_path else ""
@@ -356,6 +384,7 @@ def import_and_filter(
356
384
  accept_local_entrypoint=True,
357
385
  accept_webhook=False,
358
386
  accept_service_functions=False,
387
+ allow_stdin=False,
359
388
  ) -> tuple[Runnable | None, list[CLICommand]]:
360
389
  """Takes a function ref string and returns a single determined "runnable" to use, and a list of all available
361
390
  runnables.
@@ -371,7 +400,7 @@ def import_and_filter(
371
400
  3. if there is a single method (within a class) that one is used
372
401
  """
373
402
  # all commands:
374
- module = import_file_or_module(import_ref, base_cmd)
403
+ module = import_file_or_module(import_ref, base_cmd, allow_stdin=allow_stdin)
375
404
  cli_commands = list_cli_commands(
376
405
  dict(inspect.getmembers(module)),
377
406
  include_service_functions=accept_service_functions,
@@ -2,7 +2,9 @@
2
2
  import asyncio
3
3
  import functools
4
4
  import inspect
5
+ import os
5
6
  import re
7
+ import stat
6
8
  import sys
7
9
  import time
8
10
  import typing
@@ -25,6 +27,7 @@ from ..runner import DEPLOYMENT_STRATEGY_TYPE, deploy_app, run_app
25
27
  from ..serving import serve_app
26
28
  from ._help import ModalCommand, ModalGroup, _consume_global_options, _global_option_token_length
27
29
  from .import_refs import (
30
+ STDIN_REF,
28
31
  CLICommand,
29
32
  MethodReference,
30
33
  _get_runnable_app,
@@ -399,6 +402,14 @@ def _get_click_command_for_local_entrypoint(app: App, entrypoint: LocalEntrypoin
399
402
  return click.command(cls=ModalCommand)(with_click_options)
400
403
 
401
404
 
405
+ def _stdin_is_piped() -> bool:
406
+ try:
407
+ mode = os.fstat(sys.stdin.fileno()).st_mode
408
+ except (AttributeError, OSError, ValueError):
409
+ return False
410
+ return stat.S_ISFIFO(mode) or stat.S_ISREG(mode)
411
+
412
+
402
413
  def _get_runnable_list(all_usable_commands: list[CLICommand]) -> str:
403
414
  usable_command_lines = []
404
415
  for cmd in all_usable_commands:
@@ -428,6 +439,8 @@ class RunGroup(ModalGroup):
428
439
  elif arg == "--":
429
440
  func_ref_index += 1
430
441
  break
442
+ elif arg == STDIN_REF:
443
+ break
431
444
  elif param := option_params.get(arg.split("=", 1)[0]):
432
445
  func_ref_index += 1 if "=" in arg or param.is_flag else param.nargs + 1
433
446
  elif arg.startswith("-"):
@@ -435,6 +448,14 @@ class RunGroup(ModalGroup):
435
448
  else:
436
449
  break
437
450
 
451
+ missing_func_ref = func_ref_index >= len(args)
452
+ requests_help = any(arg in ctx.help_option_names for arg in args)
453
+ if missing_func_ref and not requests_help and not ctx.resilient_parsing and _stdin_is_piped():
454
+ raise click.UsageError(
455
+ f"Missing FUNC_REF. To read the script from stdin, pass `{STDIN_REF}`: `cat my_app.py | modal run -`",
456
+ ctx,
457
+ )
458
+
438
459
  args[:] = _consume_global_options(ctx, args[:func_ref_index]) + args[func_ref_index:]
439
460
  return click.Group.parse_args(self, ctx, args)
440
461
 
@@ -448,9 +469,23 @@ class RunGroup(ModalGroup):
448
469
  func_ref = cmd_name
449
470
 
450
471
  import_ref = parse_import_ref(func_ref, use_module_mode=ctx.params["m"], command="modal run")
472
+ from_stdin = import_ref.file_or_module == STDIN_REF
473
+ if from_stdin and ctx.params["interactive"]:
474
+ raise ClickException("Interactive mode can't be used when reading a script from stdin.")
451
475
  runnable, all_usable_commands = import_and_filter(
452
- import_ref, base_cmd="modal run", accept_local_entrypoint=True, accept_webhook=False
476
+ import_ref, base_cmd="modal run", accept_local_entrypoint=True, accept_webhook=False, allow_stdin=True
453
477
  )
478
+ if not runnable and from_stdin:
479
+ help_header = (
480
+ "Couldn't determine what to run from the script on stdin. Define a single "
481
+ "`@app.local_entrypoint()`, or save the script to a file and pass `my_app.py::my_function`."
482
+ )
483
+ if all_usable_commands:
484
+ help_footer = "The script has the following functions and local entrypoints:\n"
485
+ help_footer += _get_runnable_list(all_usable_commands)
486
+ else:
487
+ help_footer = "The script has no functions or local entrypoints."
488
+ raise ClickException(f"{help_header}\n\n{help_footer}")
454
489
  if not runnable:
455
490
  help_header = (
456
491
  "Specify a Modal Function or local entrypoint to run. E.g.\n"
@@ -535,6 +570,21 @@ def run(
535
570
  ```
536
571
  modal run -m my_project.my_app
537
572
  ```
573
+
574
+ Pass `-` to read the script from stdin. The script must have a single local
575
+ entrypoint (or a single function):
576
+
577
+ ```
578
+ modal run - <<'EOF'
579
+ import modal
580
+
581
+ app = modal.App()
582
+
583
+ @app.function()
584
+ def hello():
585
+ print("hello from Modal")
586
+ EOF
587
+ ```
538
588
  """
539
589
  ctx.ensure_object(dict)
540
590
  ctx.obj["name"] = name
@@ -80,7 +80,7 @@ class _Client:
80
80
  server_url: str,
81
81
  client_type: int,
82
82
  credentials: typing.Optional[tuple[str, str]],
83
- version: str = "1.6.2.dev8",
83
+ version: str = "1.6.2.dev9",
84
84
  *,
85
85
  oauth_credentials: typing.Optional[_OAuthCredentials] = None,
86
86
  ):
@@ -290,7 +290,7 @@ class Client:
290
290
  server_url: str,
291
291
  client_type: int,
292
292
  credentials: typing.Optional[tuple[str, str]],
293
- version: str = "1.6.2.dev8",
293
+ version: str = "1.6.2.dev9",
294
294
  *,
295
295
  oauth_credentials: typing.Optional[_OAuthCredentials] = None,
296
296
  ):
@@ -619,7 +619,7 @@ class Function(
619
619
 
620
620
  _call_generator: ___call_generator_spec
621
621
 
622
- class __remote_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
622
+ class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
623
623
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER:
624
624
  """Calls the function remotely, executing it with the given arguments and returning the execution's result.
625
625
 
@@ -644,7 +644,7 @@ class Function(
644
644
  """
645
645
  ...
646
646
 
647
- remote: __remote_spec[modal._functions.P, modal._functions.ReturnType]
647
+ remote: __remote_spec[modal._functions.ReturnType, modal._functions.P]
648
648
 
649
649
  class __remote_gen_spec(typing_extensions.Protocol):
650
650
  def __call__(self, /, *args, **kwargs) -> typing.Generator[typing.Any, None, None]:
@@ -694,7 +694,7 @@ class Function(
694
694
  """
695
695
  ...
696
696
 
697
- class ___experimental_spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
697
+ class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
698
698
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
699
699
  """[Experimental] Calls the function with the given arguments, without waiting for the results.
700
700
 
@@ -727,7 +727,7 @@ class Function(
727
727
  """
728
728
  ...
729
729
 
730
- _experimental_spawn: ___experimental_spawn_spec[modal._functions.P, modal._functions.ReturnType]
730
+ _experimental_spawn: ___experimental_spawn_spec[modal._functions.ReturnType, modal._functions.P]
731
731
 
732
732
  class ___spawn_map_inner_spec(typing_extensions.Protocol[P_INNER]):
733
733
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> None: ...
@@ -735,7 +735,7 @@ class Function(
735
735
 
736
736
  _spawn_map_inner: ___spawn_map_inner_spec[modal._functions.P]
737
737
 
738
- class __spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
738
+ class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
739
739
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
740
740
  """Calls the function with the given arguments, without waiting for the results.
741
741
 
@@ -768,7 +768,7 @@ class Function(
768
768
  """
769
769
  ...
770
770
 
771
- spawn: __spawn_spec[modal._functions.P, modal._functions.ReturnType]
771
+ spawn: __spawn_spec[modal._functions.ReturnType, modal._functions.P]
772
772
 
773
773
  @property
774
774
  def _raw_f_(self) -> collections.abc.Callable[..., typing.Any]: ...
@@ -441,6 +441,43 @@ class TokenData:
441
441
  token_secret: str
442
442
 
443
443
 
444
+ @dataclass(frozen=True)
445
+ class ServiceUserInfo:
446
+ """A lightweight dataclass containing metadata about a Modal Service User."""
447
+
448
+ service_user_id: str
449
+ name: str
450
+ token_id: str
451
+ created_by: str
452
+ created_at: datetime
453
+ last_used_at: datetime | None
454
+ expires_at: datetime | None
455
+
456
+ # Environment Name -> Role
457
+ environment_roles: dict[str, str]
458
+
459
+ @classmethod
460
+ def _from_proto(cls, proto: api_pb2.ServiceUser) -> "ServiceUserInfo":
461
+ created_at = datetime.fromtimestamp(proto.created_at, tz=timezone.utc)
462
+ last_used_at = datetime.fromtimestamp(proto.last_used_at, tz=timezone.utc) if proto.last_used_at else None
463
+ expires_at = datetime.fromtimestamp(proto.expires_at, tz=timezone.utc) if proto.expires_at else None
464
+
465
+ environment_roles: dict[str, str] = {}
466
+ for item in proto.environment_roles:
467
+ environment_roles[item.environment_name] = item.role_str
468
+
469
+ return cls(
470
+ service_user_id=proto.service_user_id,
471
+ name=proto.name,
472
+ token_id=proto.token_id,
473
+ created_by=proto.created_by,
474
+ created_at=created_at,
475
+ last_used_at=last_used_at,
476
+ expires_at=expires_at,
477
+ environment_roles=environment_roles,
478
+ )
479
+
480
+
444
481
  @dataclass(frozen=True)
445
482
  class ProxyTokenInfo:
446
483
  """Metadata about a proxy token, not including the token secret."""
@@ -9,6 +9,7 @@ from ._workspace import (
9
9
  _WorkspaceBillingManager,
10
10
  _WorkspaceMembersManager,
11
11
  _WorkspaceProxyTokenManager,
12
+ _WorkspaceServiceUserManager,
12
13
  _WorkspaceSettingsManager,
13
14
  )
14
15
 
@@ -17,6 +18,7 @@ WorkspaceMembersManager = synchronize_api(_WorkspaceMembersManager, target_modul
17
18
  WorkspaceBillingManager = synchronize_api(_WorkspaceBillingManager, target_module=__name__)
18
19
  WorkspaceProxyTokenManager = synchronize_api(_WorkspaceProxyTokenManager, target_module=__name__)
19
20
  WorkspaceSettingsManager = synchronize_api(_WorkspaceSettingsManager, target_module=__name__)
21
+ WorkspaceServiceUserManager = synchronize_api(_WorkspaceServiceUserManager, target_module=__name__)
20
22
 
21
23
  __all__ = [
22
24
  "ProxyTokenInfo",
@@ -25,6 +27,7 @@ __all__ = [
25
27
  "WorkspaceMemberInfo",
26
28
  "WorkspaceMembersManager",
27
29
  "WorkspaceProxyTokenManager",
30
+ "WorkspaceServiceUserManager",
28
31
  "WorkspaceSettingsManager",
29
32
  "WorkspaceSettings",
30
33
  ]