modal 1.6.3.dev13__tar.gz → 1.6.4__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.
- {modal-1.6.3.dev13 → modal-1.6.4}/PKG-INFO +1 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/__init__.py +11 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/__main__.py +2 -1
- modal-1.6.4/modal/_audit_logs/__init__.py +1 -0
- modal-1.6.4/modal/_audit_logs/_rpcs.py +66 -0
- modal-1.6.4/modal/_audit_logs/count.py +17 -0
- modal-1.6.4/modal/_audit_logs/list.py +83 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_cluster.py +1 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_environments.py +1 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_function_variants.py +1 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_functions.py +42 -7
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_image.py +70 -31
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_object.py +17 -11
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_output/manager.py +4 -3
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_output/rich.py +18 -5
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_runtime/task_lifecycle_manager.py +24 -3
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_runtime/task_lifecycle_manager.pyi +6 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_server.py +10 -4
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_server.pyi +8 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_type_manager.py +7 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/async_utils.py +23 -5
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/auth_token_manager.py +17 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/http_utils.py +9 -3
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/name_utils.py +8 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_workspace.py +57 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/app.py +161 -17
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/app.pyi +309 -9
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/_help.py +107 -15
- modal-1.6.4/modal/cli/_suggest.py +155 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/app.py +221 -2
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/endpoint.py +164 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/function.py +1 -13
- modal-1.6.4/modal/cli/image.py +529 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/import_refs.py +7 -4
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/profile.py +40 -29
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/run.py +66 -26
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/server.py +565 -3
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/shell.py +3 -17
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/token.py +83 -14
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/utils.py +60 -2
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/workspace.py +96 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/client.py +75 -27
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/client.pyi +45 -14
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cls.py +1 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/config.py +22 -10
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/dict.py +1 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/experimental/__init__.py +9 -0
- modal-1.6.4/modal/experimental/stream.py +889 -0
- modal-1.6.4/modal/experimental/stream.pyi +1072 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/functions.pyi +14 -6
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/image.pyi +23 -14
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/mount.py +2 -2
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/network_file_system.py +1 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/object.pyi +3 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/proxy.py +1 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/queue.py +1 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/runner.py +10 -7
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/runner.pyi +5 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/sandbox/_common.py +1 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/sandbox/_impl_persistent.py +11 -2
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/sandbox/_sandbox.py +65 -3
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/sandbox/_sidecar.py +1 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/sandbox/_snapshot.py +1 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/sandbox/_task_command_router_client.py +33 -5
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/sandbox/sandbox.pyi +107 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/secret.py +16 -8
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/secret.pyi +3 -3
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/server.pyi +3 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/token_flow.py +32 -2
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/token_flow.pyi +2 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/types.py +205 -2
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/volume.py +1 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/workspace.pyi +104 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal.egg-info/PKG-INFO +1 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/modal.egg-info/SOURCES.txt +7 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_proto/api_grpc.py +144 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_proto/api_pb2.py +1982 -1633
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_proto/api_pb2.pyi +857 -86
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_proto/api_pb2_grpc.py +300 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_proto/api_pb2_grpc.pyi +96 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_proto/modal_api_grpc.py +9 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_version/__init__.py +1 -1
- {modal-1.6.3.dev13 → modal-1.6.4}/pyproject.toml +4 -3
- modal-1.6.3.dev13/modal/cli/image.py +0 -243
- {modal-1.6.3.dev13 → modal-1.6.4}/LICENSE +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/README.md +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_billing.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_cluster.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_container_entrypoint.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_grpc_client.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_ipython.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_load_context.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_location.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_logs.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_logs_manager.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_logs_manager.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_metrics.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_metrics.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_outbound_policy.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_outbound_policy.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_output/__init__.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_output/pty.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_output/status.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_partial_function.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_resolver.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_resources.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_runtime/__init__.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_runtime/asgi.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_runtime/container_io_manager.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_runtime/container_io_manager.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_runtime/execution_context.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_runtime/execution_context.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_runtime/gpu_memory_snapshot.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_runtime/telemetry.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_runtime/user_code_event_loop.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_runtime/user_code_imports.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_serialization.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_supports_logs.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_traceback.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_tunnel.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_tunnel.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/__init__.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/app_utils.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/blob_utils.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/browser_utils.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/bytes_io_segment_payload.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/curl_utils.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/deprecation.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/display_utils.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/docker_utils.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/function_utils.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/git_utils.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/grpc_testing.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/grpc_utils.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/hash_utils.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/idle_countdown.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/jwt_utils.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/logger.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/mount_utils.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/oauth.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/package_utils.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/pattern_utils.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/proxy_support.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/rand_pb_testing.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/sandbox_fs_utils.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/shell_utils.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_utils/time_utils.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_vendor/__init__.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_vendor/a2wsgi_wsgi.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_vendor/cloudpickle.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_vendor/tblib.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_vendor/version.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/_watcher.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/billing.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/billing.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/builder/2023.12.312.txt +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/builder/2023.12.txt +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/builder/2024.04.txt +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/builder/2024.10.txt +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/builder/2025.06.txt +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/builder/2026.10.txt +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/builder/PREVIEW.txt +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/builder/README.md +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/builder/base-images.json +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/call_graph.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/__init__.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/_download.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/_logs.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/_stats.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/_traceback.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/billing.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/changelog.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/config.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/container.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/curl.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/dashboard.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/dict.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/entry_point.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/environment.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/logo.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/network_file_system.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/queues.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/secret.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/selector.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/skills.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cli/volume.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cloud_bucket_mount.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cloud_bucket_mount.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cls.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cluster.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/cluster.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/container_process.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/container_process.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/dict.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/environments.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/environments.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/exception.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/experimental/_flash_container_entry.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/experimental/flash.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/experimental/flash.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/experimental/flash_server.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/experimental/flash_server.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/experimental/ipython.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/file_pattern_matcher.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/functions.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/image.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/io_streams.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/io_streams.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/mount.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/network_file_system.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/object.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/output.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/parallel_map.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/parallel_map.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/partial_function.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/partial_function.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/proxy.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/py.typed +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/queue.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/retries.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/running_app.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/sandbox/__init__.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/sandbox/_filesystem.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/sandbox/_impl_v1.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/sandbox/_impl_v2.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/sandbox/sandbox.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/schedule.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/scheduler_placement.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/server.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/serving.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/serving.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/skills/modal/SKILL.md +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/stream_type.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/volume.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal/workspace.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal.egg-info/dependency_links.txt +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal.egg-info/entry_points.txt +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal.egg-info/requires.txt +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal.egg-info/top_level.txt +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_docs/__init__.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_docs/gen_cli_docs.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_docs/gen_cli_docs_main.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_docs/gen_reference_docs.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_docs/gen_reference_docs_main.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_docs/mdmd/__init__.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_docs/mdmd/mdmd.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_docs/mdmd/signatures.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_docs/mdmd/types.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_docs/reference_intro.md +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_proto/__init__.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_proto/py.typed +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_proto/task_command_router_grpc.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_proto/task_command_router_pb2.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_proto/task_command_router_pb2.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_proto/task_command_router_pb2_grpc.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_proto/task_command_router_pb2_grpc.pyi +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/modal_version/__main__.py +0 -0
- {modal-1.6.3.dev13 → modal-1.6.4}/setup.cfg +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# Copyright Modal Labs 2022
|
|
2
|
+
import os
|
|
2
3
|
import sys
|
|
3
4
|
|
|
4
5
|
if sys.version_info[:2] < (3, 10):
|
|
@@ -59,6 +60,16 @@ except Exception:
|
|
|
59
60
|
print()
|
|
60
61
|
raise
|
|
61
62
|
|
|
63
|
+
if sys.version_info[:2] == (3, 10) and os.environ.get("MODAL_IS_REMOTE") != "1":
|
|
64
|
+
from ._utils.deprecation import deprecation_warning
|
|
65
|
+
|
|
66
|
+
deprecation_warning(
|
|
67
|
+
(2026, 11, 4),
|
|
68
|
+
"Python 3.10 is EOL and Modal will not support it in version 1.7.0. "
|
|
69
|
+
"Please upgrade your local Python to 3.11 or later.",
|
|
70
|
+
show_source=False,
|
|
71
|
+
)
|
|
72
|
+
|
|
62
73
|
|
|
63
74
|
__all__ = [
|
|
64
75
|
"__version__",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import sys
|
|
3
3
|
|
|
4
4
|
from ._traceback import reduce_traceback_to_user_code
|
|
5
|
+
from .cli._suggest import get_hint
|
|
5
6
|
from .cli._traceback import highlight_modal_warnings, setup_rich_traceback
|
|
6
7
|
from .cli.entry_point import entrypoint_cli
|
|
7
8
|
from .cli.import_refs import _CliUserExecutionError
|
|
@@ -41,7 +42,7 @@ def main():
|
|
|
41
42
|
if notes := getattr(exc, "__notes__", []):
|
|
42
43
|
content = f"{content}\n\nNote: {' '.join(notes)}"
|
|
43
44
|
|
|
44
|
-
OutputManager.get().print_error(content)
|
|
45
|
+
OutputManager.get().print_error(content, hint=get_hint(exc))
|
|
45
46
|
sys.exit(1)
|
|
46
47
|
|
|
47
48
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Copyright Modal Labs 2026
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Copyright Modal Labs 2026
|
|
2
|
+
"""The audit log RPCs, one call each, retried with backoff. Ordering and batching live in list.py."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from collections.abc import Awaitable, Callable
|
|
7
|
+
from typing import TYPE_CHECKING, TypeVar
|
|
8
|
+
|
|
9
|
+
from modal._utils.grpc_utils import Retry
|
|
10
|
+
from modal_proto import api_pb2
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from modal.client import _Client
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
_Resp = TypeVar("_Resp")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
_MAX_RETRIES = 4
|
|
20
|
+
_PLAN_MAX_RETRIES = 2
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
async def _call(
|
|
24
|
+
rpc: Callable[..., Awaitable[_Resp]], req: object, *, timeout: float, max_retries: int = _MAX_RETRIES
|
|
25
|
+
) -> _Resp:
|
|
26
|
+
"""Call with backoff on timeouts and transient errors; rate and resource limits wait as the server says."""
|
|
27
|
+
retry = Retry(base_delay=1.0, delay_factor=2.0, max_delay=8.0, max_retries=max_retries, attempt_timeout=timeout)
|
|
28
|
+
return await rpc(req, retry=retry)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
async def get_settings(client: _Client) -> api_pb2.AuditLogSettingsGetResponse:
|
|
32
|
+
return await client._stub.AuditLogSettingsGet(api_pb2.AuditLogSettingsGetRequest())
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
async def count_entries(
|
|
36
|
+
client: _Client, q: str, oldest_ms: int, newest_ms: int, config: api_pb2.AuditLogSettingsGetResponse
|
|
37
|
+
) -> int:
|
|
38
|
+
req = api_pb2.AuditLogCountRequest(q=q, oldest_ms=oldest_ms, newest_ms=newest_ms)
|
|
39
|
+
resp = await _call(client._stub.AuditLogCount, req, timeout=config.request_timeout_secs)
|
|
40
|
+
return resp.count
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
async def list_page(
|
|
44
|
+
client: _Client,
|
|
45
|
+
q: str,
|
|
46
|
+
oldest_ms: int,
|
|
47
|
+
newest_ms: int,
|
|
48
|
+
limit: int,
|
|
49
|
+
config: api_pb2.AuditLogSettingsGetResponse,
|
|
50
|
+
newest_cursor: api_pb2.AuditLogCursor | None = None,
|
|
51
|
+
oldest_cursor: api_pb2.AuditLogCursor | None = None,
|
|
52
|
+
) -> api_pb2.AuditLogListResponse:
|
|
53
|
+
req = api_pb2.AuditLogListRequest(q=q, oldest_ms=oldest_ms, newest_ms=newest_ms, limit=limit)
|
|
54
|
+
if newest_cursor is not None:
|
|
55
|
+
req.newest_cursor.CopyFrom(newest_cursor)
|
|
56
|
+
if oldest_cursor is not None:
|
|
57
|
+
req.oldest_cursor.CopyFrom(oldest_cursor)
|
|
58
|
+
return await _call(client._stub.AuditLogList, req, timeout=config.request_timeout_secs)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
async def plan_buckets(
|
|
62
|
+
client: _Client, q: str, oldest_ms: int, newest_ms: int, config: api_pb2.AuditLogSettingsGetResponse
|
|
63
|
+
) -> list[api_pb2.AuditLogCursor]:
|
|
64
|
+
req = api_pb2.AuditLogBucketsRequest(q=q, oldest_ms=oldest_ms, newest_ms=newest_ms, bucket_size=config.bucket_size)
|
|
65
|
+
resp = await _call(client._stub.AuditLogPlan, req, timeout=config.plan_timeout_secs, max_retries=_PLAN_MAX_RETRIES)
|
|
66
|
+
return list(resp.cursors)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Copyright Modal Labs 2026
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
5
|
+
|
|
6
|
+
from modal._audit_logs import _rpcs
|
|
7
|
+
from modal_proto import api_pb2
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from modal.client import _Client
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
async def count_audit_logs(
|
|
14
|
+
client: _Client, q: str, oldest_ms: int, newest_ms: int, config: api_pb2.AuditLogSettingsGetResponse
|
|
15
|
+
) -> int:
|
|
16
|
+
"""Count the entries in [oldest_ms, newest_ms) that match the query."""
|
|
17
|
+
return await _rpcs.count_entries(client, q, oldest_ms, newest_ms, config)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Copyright Modal Labs 2026
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from collections.abc import AsyncGenerator
|
|
5
|
+
from contextlib import aclosing
|
|
6
|
+
|
|
7
|
+
from modal._audit_logs import _rpcs
|
|
8
|
+
from modal._utils.async_utils import async_map_ordered
|
|
9
|
+
from modal.client import _Client
|
|
10
|
+
from modal_proto import api_pb2
|
|
11
|
+
|
|
12
|
+
# (newest_cursor, oldest_cursor); None where the bucket is open-ended.
|
|
13
|
+
Bucket = tuple[api_pb2.AuditLogCursor | None, api_pb2.AuditLogCursor | None]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
async def get_bucket_cursors(
|
|
17
|
+
client: _Client, q: str, oldest_ms: int, newest_ms: int, config: api_pb2.AuditLogSettingsGetResponse
|
|
18
|
+
) -> list[Bucket]:
|
|
19
|
+
"""Split the range into buckets, as (newest_cursor, oldest_cursor) pairs ordered oldest to newest.
|
|
20
|
+
|
|
21
|
+
The first bucket has no oldest cursor and the last has no newest cursor.
|
|
22
|
+
"""
|
|
23
|
+
cursors = await _rpcs.plan_buckets(client, q, oldest_ms, newest_ms, config)
|
|
24
|
+
return list(zip([None, *cursors], [*cursors, None]))[::-1]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
async def _fetch_bucket(
|
|
28
|
+
client: _Client,
|
|
29
|
+
q: str,
|
|
30
|
+
oldest_ms: int,
|
|
31
|
+
newest_ms: int,
|
|
32
|
+
config: api_pb2.AuditLogSettingsGetResponse,
|
|
33
|
+
bucket: Bucket,
|
|
34
|
+
) -> list[api_pb2.AuditLogEntry]:
|
|
35
|
+
"""Read one bucket's entries, oldest to newest, using pagination"""
|
|
36
|
+
newest_cursor, oldest_cursor = bucket
|
|
37
|
+
entries: list[api_pb2.AuditLogEntry] = []
|
|
38
|
+
while True:
|
|
39
|
+
resp = await _rpcs.list_page(
|
|
40
|
+
client, q, oldest_ms, newest_ms, config.page_size, config, newest_cursor, oldest_cursor
|
|
41
|
+
)
|
|
42
|
+
entries.extend(resp.items)
|
|
43
|
+
# Skips the empty request a full last page would otherwise trigger; an unset next_cursor also ends the loop.
|
|
44
|
+
if oldest_cursor is not None and resp.items and resp.items[-1].id == oldest_cursor.id:
|
|
45
|
+
break
|
|
46
|
+
if not resp.HasField("next_cursor"):
|
|
47
|
+
break
|
|
48
|
+
newest_cursor = resp.next_cursor
|
|
49
|
+
entries.reverse()
|
|
50
|
+
return entries
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
async def fetch_audit_logs(
|
|
54
|
+
q: str,
|
|
55
|
+
oldest_ms: int,
|
|
56
|
+
newest_ms: int,
|
|
57
|
+
*,
|
|
58
|
+
client: _Client | None = None,
|
|
59
|
+
config: api_pb2.AuditLogSettingsGetResponse,
|
|
60
|
+
) -> AsyncGenerator[api_pb2.AuditLogEntry]:
|
|
61
|
+
"""Yield the range's entries from the oldest to the newest, one bucket at a time.
|
|
62
|
+
|
|
63
|
+
At most `max_concurrent_requests` buckets are fetched at once, and at most `max_buffered_buckets` are fetched
|
|
64
|
+
or held at once. A new bucket is admitted only after the consumer has taken all of a bucket's entries, so a slow
|
|
65
|
+
consumer or a stalled request cannot grow memory.
|
|
66
|
+
If any request fails after its attempts, the remaining requests are cancelled and the error is raised.
|
|
67
|
+
"""
|
|
68
|
+
if client is None:
|
|
69
|
+
client = await _Client.from_env()
|
|
70
|
+
buckets = await get_bucket_cursors(client, q, oldest_ms, newest_ms, config)
|
|
71
|
+
|
|
72
|
+
async def bucket_stream() -> AsyncGenerator[Bucket]:
|
|
73
|
+
for bucket in buckets:
|
|
74
|
+
yield bucket
|
|
75
|
+
|
|
76
|
+
async def fetch(bucket: Bucket) -> list[api_pb2.AuditLogEntry]:
|
|
77
|
+
return await _fetch_bucket(client, q, oldest_ms, newest_ms, config, bucket)
|
|
78
|
+
|
|
79
|
+
fetched = async_map_ordered(bucket_stream(), fetch, config.max_concurrent_requests, config.max_buffered_buckets)
|
|
80
|
+
async with aclosing(fetched) as stream:
|
|
81
|
+
async for entries in stream:
|
|
82
|
+
for entry in entries:
|
|
83
|
+
yield entry
|
|
@@ -40,7 +40,7 @@ def get_current_cluster_context() -> ClusterContext:
|
|
|
40
40
|
return current_cluster_context
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
class _Cluster(_Object,
|
|
43
|
+
class _Cluster(_Object, type_prefixes=("cu",)):
|
|
44
44
|
"""A group of containers scheduled together for a clustered Function or Server.
|
|
45
45
|
|
|
46
46
|
Use `Cluster.from_context()` inside a cluster, or `Cluster.from_id()` to
|
|
@@ -408,6 +408,7 @@ def _make_function_variant(
|
|
|
408
408
|
if not base_function._is_hydrated:
|
|
409
409
|
await base_function.hydrate(load_context.client)
|
|
410
410
|
|
|
411
|
+
base_function._check_not_observability_only()
|
|
411
412
|
assert base_function._client and base_function._client._stub
|
|
412
413
|
|
|
413
414
|
if parameter_schema is None:
|
|
@@ -119,6 +119,16 @@ if TYPE_CHECKING:
|
|
|
119
119
|
import modal.functions
|
|
120
120
|
|
|
121
121
|
MAX_INTERNAL_FAILURE_COUNT = 8
|
|
122
|
+
_OBSERVABILITY_ONLY_APIS = (
|
|
123
|
+
".logs",
|
|
124
|
+
".metrics",
|
|
125
|
+
".info()",
|
|
126
|
+
".stats()",
|
|
127
|
+
".get_current_stats()",
|
|
128
|
+
".get_web_url()",
|
|
129
|
+
".autoscaler",
|
|
130
|
+
".update_autoscaler()",
|
|
131
|
+
)
|
|
122
132
|
TERMINAL_STATUSES = (
|
|
123
133
|
api_pb2.GenericResult.GENERIC_STATUS_SUCCESS,
|
|
124
134
|
api_pb2.GenericResult.GENERIC_STATUS_TERMINATED,
|
|
@@ -610,7 +620,7 @@ OriginalReturnType = typing.TypeVar(
|
|
|
610
620
|
T = typing.TypeVar("T", covariant=True)
|
|
611
621
|
|
|
612
622
|
|
|
613
|
-
class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object,
|
|
623
|
+
class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type_prefixes=("fu",)):
|
|
614
624
|
"""Functions are the basic units of serverless execution on Modal.
|
|
615
625
|
|
|
616
626
|
Generally, you will not construct a `Function` directly. Instead, use the
|
|
@@ -651,6 +661,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
651
661
|
_base_function: "_Function | None" = None
|
|
652
662
|
_app_id: str | None = None
|
|
653
663
|
_function_info: FunctionInfo | None = None
|
|
664
|
+
_is_observability_only: bool = False
|
|
654
665
|
|
|
655
666
|
async def _get_log_query_data(self) -> _LogQueryData:
|
|
656
667
|
await self.hydrate()
|
|
@@ -734,6 +745,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
734
745
|
experimental_options: dict[str, str] | None = None,
|
|
735
746
|
restrict_output: bool = False,
|
|
736
747
|
http_config: api_pb2.HTTPConfig | None = None,
|
|
748
|
+
include_client_mounts: bool = True,
|
|
737
749
|
) -> "_Function":
|
|
738
750
|
"""mdmd:hidden
|
|
739
751
|
|
|
@@ -777,7 +789,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
777
789
|
|
|
778
790
|
entrypoint_mount = info.get_entrypoint_mount() if include_source else {}
|
|
779
791
|
all_mounts = [
|
|
780
|
-
_get_client_mount(),
|
|
792
|
+
*([_get_client_mount()] if include_client_mounts else []),
|
|
781
793
|
*entrypoint_mount.values(),
|
|
782
794
|
]
|
|
783
795
|
|
|
@@ -1485,16 +1497,15 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
1485
1497
|
# refine the error message
|
|
1486
1498
|
msg = f"Lookup failed for {called_from} '{function_id}': {exc}."
|
|
1487
1499
|
raise NotFoundError(msg) from None
|
|
1488
|
-
if called_from == "Function" and
|
|
1489
|
-
|
|
1490
|
-
raise InvalidError(f"{function_id} is a Server. Use \n ``modal.Server.from_id('{function_id}')``")
|
|
1491
|
-
raise InvalidError(f"{function_id} is a Cls and cannot be loaded with Function.from_id().")
|
|
1500
|
+
if called_from == "Function" and response.function.is_server:
|
|
1501
|
+
raise InvalidError(f"{function_id} is a Server. Use \n ``modal.Server.from_id('{function_id}')``")
|
|
1492
1502
|
if called_from == "Server" and not response.function.is_server:
|
|
1493
1503
|
if response.function.is_class:
|
|
1494
1504
|
raise InvalidError(f"{function_id} is a Cls and cannot be loaded with Server.from_id().")
|
|
1495
1505
|
raise InvalidError(f"{function_id} is a Function. Use \n ``modal.Function.from_id('{function_id}')``")
|
|
1496
1506
|
self._hydrate(function_id, load_context.client, response.handle_metadata)
|
|
1497
1507
|
self._function_info = FunctionInfo._from_function_proto(response.function)
|
|
1508
|
+
self._is_observability_only = called_from == "Function" and response.function.is_class
|
|
1498
1509
|
|
|
1499
1510
|
rep = f"modal.Function.from_id('{function_id}')"
|
|
1500
1511
|
return cls._from_loader(
|
|
@@ -1514,6 +1525,11 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
1514
1525
|
object with metadata from Modal servers until the first
|
|
1515
1526
|
time it is actually used.
|
|
1516
1527
|
|
|
1528
|
+
If the ID belongs to a Cls, the Function only supports the following APIs:
|
|
1529
|
+
`.logs`, `.metrics`, `.info()`, `.stats()`, `.get_current_stats()`,
|
|
1530
|
+
`.get_web_url()`, `.autoscaler` and `.update_autoscaler()`. Use `modal.Cls.from_name(...)`
|
|
1531
|
+
to invoke all other methods.
|
|
1532
|
+
|
|
1517
1533
|
Args:
|
|
1518
1534
|
function_id: ID of the function.
|
|
1519
1535
|
client: Modal client to use; defaults to `Client.from_env()` when omitted.
|
|
@@ -1744,6 +1760,18 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
1744
1760
|
+ f"or call it locally: {self._function_name}.local()"
|
|
1745
1761
|
)
|
|
1746
1762
|
|
|
1763
|
+
def _check_not_observability_only(self):
|
|
1764
|
+
if self._is_observability_only:
|
|
1765
|
+
assert self._function_name
|
|
1766
|
+
class_name = self._function_name.removesuffix(".*")
|
|
1767
|
+
apis = [f"`{name}`" for name in _OBSERVABILITY_ONLY_APIS]
|
|
1768
|
+
allowed_apis = ", ".join(apis[:-1]) + " and " + apis[-1]
|
|
1769
|
+
raise InvalidError(
|
|
1770
|
+
f"`{self.object_id}` belongs to the Cls `{class_name}`. A Function loaded with "
|
|
1771
|
+
f"`Function.from_id` only supports {allowed_apis}. "
|
|
1772
|
+
"Use `modal.Cls.from_name(...)` to invoke all other methods."
|
|
1773
|
+
)
|
|
1774
|
+
|
|
1747
1775
|
@live_method
|
|
1748
1776
|
async def get_web_url(self) -> str | None:
|
|
1749
1777
|
"""URL for addressing a Web Function via HTTP.
|
|
@@ -1779,6 +1807,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
1779
1807
|
config_method_name: str,
|
|
1780
1808
|
) -> "_Function[P, ReturnType, OriginalReturnType]":
|
|
1781
1809
|
base_function = self._base_function or self
|
|
1810
|
+
base_function._check_not_observability_only()
|
|
1782
1811
|
combined_options = self._options.merge_options(new_options)
|
|
1783
1812
|
|
|
1784
1813
|
# For "True Functions" (i.e. not the Function inside a Cls), we will use
|
|
@@ -1941,6 +1970,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
1941
1970
|
_SynchronizedQueue is used instead of asyncio.Queue so that the main thread can put
|
|
1942
1971
|
items in the queue safely.
|
|
1943
1972
|
"""
|
|
1973
|
+
self._check_not_observability_only()
|
|
1944
1974
|
self._check_no_web_url("map")
|
|
1945
1975
|
if self._is_generator:
|
|
1946
1976
|
raise InvalidError("A generator function cannot be called with `.map(...)`.")
|
|
@@ -1978,6 +2008,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
1978
2008
|
|
|
1979
2009
|
@live_method
|
|
1980
2010
|
async def _spawn_map(self, input_queue: _SynchronizedQueue) -> "_FunctionCall[ReturnType]":
|
|
2011
|
+
self._check_not_observability_only()
|
|
1981
2012
|
self._check_no_web_url("spawn_map")
|
|
1982
2013
|
if self._is_generator:
|
|
1983
2014
|
raise InvalidError("A generator function cannot be called with `.spawn_map(...)`.")
|
|
@@ -1995,6 +2026,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
1995
2026
|
return fc
|
|
1996
2027
|
|
|
1997
2028
|
async def _call_function(self, args, kwargs) -> ReturnType:
|
|
2029
|
+
self._check_not_observability_only()
|
|
1998
2030
|
invocation: _Invocation | _InputPlaneInvocation
|
|
1999
2031
|
if self._input_plane_url:
|
|
2000
2032
|
invocation = await _InputPlaneInvocation.create(
|
|
@@ -2024,6 +2056,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
2024
2056
|
function_call_invocation_type: "api_pb2.FunctionCallInvocationType.ValueType",
|
|
2025
2057
|
from_spawn_map: bool = False,
|
|
2026
2058
|
) -> _Invocation:
|
|
2059
|
+
self._check_not_observability_only()
|
|
2027
2060
|
return await _Invocation.create(
|
|
2028
2061
|
self,
|
|
2029
2062
|
args,
|
|
@@ -2037,6 +2070,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
2037
2070
|
@live_method_gen
|
|
2038
2071
|
@synchronizer.no_input_translation
|
|
2039
2072
|
async def _call_generator(self, args, kwargs):
|
|
2073
|
+
self._check_not_observability_only()
|
|
2040
2074
|
invocation: _Invocation | _InputPlaneInvocation
|
|
2041
2075
|
if self._input_plane_url:
|
|
2042
2076
|
invocation = await _InputPlaneInvocation.create(
|
|
@@ -2093,6 +2127,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
2093
2127
|
Values produced by the remote generator.
|
|
2094
2128
|
"""
|
|
2095
2129
|
# TODO: Generics/TypeVars
|
|
2130
|
+
self._check_not_observability_only()
|
|
2096
2131
|
self._check_no_web_url("remote_gen")
|
|
2097
2132
|
|
|
2098
2133
|
if not self._is_generator:
|
|
@@ -2336,7 +2371,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
2336
2371
|
experimental_spawn_map = MethodWithAio(_experimental_spawn_map_sync, _experimental_spawn_map_async, synchronizer)
|
|
2337
2372
|
|
|
2338
2373
|
|
|
2339
|
-
class _FunctionCall(typing.Generic[ReturnType], _Object,
|
|
2374
|
+
class _FunctionCall(typing.Generic[ReturnType], _Object, type_prefixes=("fc",)):
|
|
2340
2375
|
"""A reference to an executed function call.
|
|
2341
2376
|
|
|
2342
2377
|
Constructed using `.spawn(...)` on a Modal function with the same
|
|
@@ -37,6 +37,7 @@ from ._serialization import get_preferred_payload_format, serialize
|
|
|
37
37
|
from ._supports_logs import _ImageLogQueryData
|
|
38
38
|
from ._utils.async_utils import TaskContext, deprecate_aio_usage, synchronizer
|
|
39
39
|
from ._utils.blob_utils import MAX_OBJECT_SIZE_BYTES
|
|
40
|
+
from ._utils.deprecation import deprecation_warning
|
|
40
41
|
from ._utils.docker_utils import (
|
|
41
42
|
extract_copy_command_patterns,
|
|
42
43
|
find_dockerignore_file,
|
|
@@ -87,6 +88,23 @@ SUPPORTED_PYTHON_SERIES: dict[ImageBuilderVersion, list[str]] = {
|
|
|
87
88
|
"2023.12": ["3.10", "3.11", "3.12"],
|
|
88
89
|
}
|
|
89
90
|
|
|
91
|
+
|
|
92
|
+
def _uses_python_310(metadata: api_pb2.ImageMetadata | None) -> bool:
|
|
93
|
+
return metadata is not None and bool(re.match(r"Python 3\.10\.", metadata.python_version_info))
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def _warn_if_python_310(image_id: str, metadata: api_pb2.ImageMetadata | None) -> None:
|
|
97
|
+
if _uses_python_310(metadata):
|
|
98
|
+
deprecation_warning(
|
|
99
|
+
(2026, 11, 4),
|
|
100
|
+
f"Image {image_id} uses Python 3.10, which is EOL. Modal 1.7.0 and later will not run or deploy apps "
|
|
101
|
+
"that use Images with Python 3.10; apps already deployed with older clients keep working. "
|
|
102
|
+
"Please update the Image to use Python 3.11 or later "
|
|
103
|
+
"(e.g. via `python_version=` or `add_python=`).",
|
|
104
|
+
show_source=False,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
|
|
90
108
|
LOCAL_REQUIREMENTS_DIR = Path(__file__).parent / "builder"
|
|
91
109
|
CONTAINER_REQUIREMENTS_PATH = "/modal_requirements.txt"
|
|
92
110
|
|
|
@@ -569,7 +587,7 @@ class _FailedBuildAttempt:
|
|
|
569
587
|
client: _Client
|
|
570
588
|
|
|
571
589
|
|
|
572
|
-
class _Image(_Object,
|
|
590
|
+
class _Image(_Object, type_prefixes=("im",)):
|
|
573
591
|
"""Base class for container images to run functions in.
|
|
574
592
|
|
|
575
593
|
Do not construct this class directly; instead use one of its static factory methods,
|
|
@@ -584,6 +602,7 @@ class _Image(_Object, type_prefix="im"):
|
|
|
584
602
|
] # added as mounts on any container referencing the Image, see `def _mount_layers`
|
|
585
603
|
_added_python_source_set: frozenset[str] # used to warn about missing mounts during auto-mount deprecation
|
|
586
604
|
_metadata: api_pb2.ImageMetadata | None = None # set on hydration, private for now
|
|
605
|
+
_cache_hit: bool | None = None # set when built, True if an existing build was reused
|
|
587
606
|
_is_empty: bool
|
|
588
607
|
_build_steps: list[api_pb2.ImageBuildStep] | None = None
|
|
589
608
|
# A failed image ID is only queryable through the client that performed the build.
|
|
@@ -832,6 +851,7 @@ class _Image(_Object, type_prefix="im"):
|
|
|
832
851
|
result: api_pb2.GenericResult
|
|
833
852
|
metadata: api_pb2.ImageMetadata | None = None
|
|
834
853
|
|
|
854
|
+
self._cache_hit = bool(resp.result.status)
|
|
835
855
|
if resp.result.status:
|
|
836
856
|
# image already built
|
|
837
857
|
result = resp.result
|
|
@@ -875,6 +895,8 @@ class _Image(_Object, type_prefix="im"):
|
|
|
875
895
|
raise ImageBuildError("Unknown status %s!" % result.status, image_id)
|
|
876
896
|
|
|
877
897
|
self._hydrate(image_id, load_context.client, metadata)
|
|
898
|
+
if not any(_uses_python_310(base._metadata) for base in base_images.values()):
|
|
899
|
+
_warn_if_python_310(image_id, metadata)
|
|
878
900
|
local_mounts: set[_Mount] = set()
|
|
879
901
|
for base in base_images.values():
|
|
880
902
|
local_mounts |= base._serve_mounts
|
|
@@ -1096,6 +1118,7 @@ class _Image(_Object, type_prefix="im"):
|
|
|
1096
1118
|
async def _load(self: _Image, resolver: Resolver, load_context: LoadContext, existing_object_id: str | None):
|
|
1097
1119
|
resp = await load_context.client._stub.ImageFromId(api_pb2.ImageFromIdRequest(image_id=image_id))
|
|
1098
1120
|
self._hydrate(resp.image_id, load_context.client, resp.metadata)
|
|
1121
|
+
_warn_if_python_310(resp.image_id, resp.metadata)
|
|
1099
1122
|
|
|
1100
1123
|
rep = f"Image.from_id({image_id!r})"
|
|
1101
1124
|
|
|
@@ -1104,7 +1127,7 @@ class _Image(_Object, type_prefix="im"):
|
|
|
1104
1127
|
|
|
1105
1128
|
return typing.cast(typing_extensions.Self, synchronizer._translate_out(obj))
|
|
1106
1129
|
|
|
1107
|
-
async def build(self, app: "modal.app._App") -> "_Image":
|
|
1130
|
+
async def build(self, app: "modal.app._App | None" = None) -> "_Image":
|
|
1108
1131
|
"""Eagerly build an image.
|
|
1109
1132
|
|
|
1110
1133
|
If your image was previously built, then this method will not rebuild your image
|
|
@@ -1114,7 +1137,8 @@ class _Image(_Object, type_prefix="im"):
|
|
|
1114
1137
|
You do not need to build the image explicitly in that case.
|
|
1115
1138
|
|
|
1116
1139
|
Args:
|
|
1117
|
-
app:
|
|
1140
|
+
app: App for running the build. If not provided, the build will run
|
|
1141
|
+
in an ephemeral App.
|
|
1118
1142
|
|
|
1119
1143
|
Returns:
|
|
1120
1144
|
This image after the build (and resolver load) completes.
|
|
@@ -1123,9 +1147,8 @@ class _Image(_Object, type_prefix="im"):
|
|
|
1123
1147
|
```python
|
|
1124
1148
|
image = modal.Image.debian_slim().uv_pip_install("scipy", "numpy")
|
|
1125
1149
|
|
|
1126
|
-
app = modal.App.lookup("build-image", create_if_missing=True)
|
|
1127
1150
|
with modal.enable_output(): # To see logs in your local terminal
|
|
1128
|
-
image.build(
|
|
1151
|
+
image.build()
|
|
1129
1152
|
|
|
1130
1153
|
# Save the image id
|
|
1131
1154
|
my_image_id = image.object_id
|
|
@@ -1158,23 +1181,34 @@ class _Image(_Object, type_prefix="im"):
|
|
|
1158
1181
|
...
|
|
1159
1182
|
```
|
|
1160
1183
|
"""
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
image_id=e.image_id,
|
|
1174
|
-
client=load_context.client,
|
|
1184
|
+
|
|
1185
|
+
if app is None:
|
|
1186
|
+
from .runner import _run_app
|
|
1187
|
+
|
|
1188
|
+
app_context = _run_app(modal.app._App("modal-image-build"), stream_output=False)
|
|
1189
|
+
else:
|
|
1190
|
+
app_context = contextlib.nullcontext(app)
|
|
1191
|
+
|
|
1192
|
+
async with app_context as app:
|
|
1193
|
+
if app.app_id is None:
|
|
1194
|
+
raise InvalidError(
|
|
1195
|
+
"App has not been initialized yet. Use the context manager `app.run()` or `App.lookup`"
|
|
1175
1196
|
)
|
|
1176
1197
|
|
|
1177
|
-
|
|
1198
|
+
resolver = Resolver()
|
|
1199
|
+
async with TaskContext() as tc:
|
|
1200
|
+
self._build_steps = None
|
|
1201
|
+
self._failed_build_attempt = None
|
|
1202
|
+
load_context = LoadContext(task_context=tc).merged_with(app._root_load_context)
|
|
1203
|
+
try:
|
|
1204
|
+
await resolver.load(self, load_context)
|
|
1205
|
+
except ImageBuildError as e:
|
|
1206
|
+
self._failed_build_attempt = _FailedBuildAttempt(
|
|
1207
|
+
image_id=e.image_id,
|
|
1208
|
+
client=load_context.client,
|
|
1209
|
+
)
|
|
1210
|
+
|
|
1211
|
+
raise
|
|
1178
1212
|
return self
|
|
1179
1213
|
|
|
1180
1214
|
@_requires_image_instance
|
|
@@ -2062,8 +2096,7 @@ class _Image(_Object, type_prefix="im"):
|
|
|
2062
2096
|
if not isinstance(entrypoint_commands, list) or not all(isinstance(x, str) for x in entrypoint_commands):
|
|
2063
2097
|
raise InvalidError("entrypoint_commands must be a list of strings.")
|
|
2064
2098
|
args = _flatten_str_args("entrypoint", "entrypoint_commands", entrypoint_commands)
|
|
2065
|
-
|
|
2066
|
-
dockerfile_cmd = f"ENTRYPOINT [{args_str}]"
|
|
2099
|
+
dockerfile_cmd = f"ENTRYPOINT {json.dumps(args, ensure_ascii=False)}"
|
|
2067
2100
|
|
|
2068
2101
|
return self.dockerfile_commands(dockerfile_cmd)
|
|
2069
2102
|
|
|
@@ -2083,8 +2116,7 @@ class _Image(_Object, type_prefix="im"):
|
|
|
2083
2116
|
if not isinstance(shell_commands, list) or not all(isinstance(x, str) for x in shell_commands):
|
|
2084
2117
|
raise InvalidError("shell_commands must be a list of strings.")
|
|
2085
2118
|
args = _flatten_str_args("shell", "shell_commands", shell_commands)
|
|
2086
|
-
|
|
2087
|
-
dockerfile_cmd = f"SHELL [{args_str}]"
|
|
2119
|
+
dockerfile_cmd = f"SHELL {json.dumps(args, ensure_ascii=False)}"
|
|
2088
2120
|
|
|
2089
2121
|
return self.dockerfile_commands(dockerfile_cmd)
|
|
2090
2122
|
|
|
@@ -2407,7 +2439,11 @@ class _Image(_Object, type_prefix="im"):
|
|
|
2407
2439
|
add_python: str | None = None,
|
|
2408
2440
|
**kwargs,
|
|
2409
2441
|
) -> "_Image":
|
|
2410
|
-
"""
|
|
2442
|
+
"""mdmd:hidden
|
|
2443
|
+
Build a Modal image from a private image in Google Cloud Platform (GCP) Artifact Registry.
|
|
2444
|
+
|
|
2445
|
+
**Note:** This constructor is superseded by `Image.from_registry()`, which can also authenticate
|
|
2446
|
+
to private repositories when provided with the appropriate keys in a `modal.Secret`.
|
|
2411
2447
|
|
|
2412
2448
|
You will need to pass a `modal.Secret` containing [your GCP service account key data](https://cloud.google.com/iam/docs/keys-create-delete#creating)
|
|
2413
2449
|
as `SERVICE_ACCOUNT_JSON`. This can be done from the [Secrets](https://modal.com/secrets) page.
|
|
@@ -2468,11 +2504,15 @@ class _Image(_Object, type_prefix="im"):
|
|
|
2468
2504
|
add_python: str | None = None,
|
|
2469
2505
|
**kwargs,
|
|
2470
2506
|
) -> "_Image":
|
|
2471
|
-
"""
|
|
2507
|
+
"""mdmd:hidden
|
|
2508
|
+
Build a Modal image from a private image in AWS Elastic Container Registry (ECR).
|
|
2472
2509
|
|
|
2473
2510
|
You will need to pass a `modal.Secret` containing either IAM user credentials or OIDC
|
|
2474
2511
|
configuration to access the target ECR registry.
|
|
2475
2512
|
|
|
2513
|
+
**Note:** This constructor is superseded by `Image.from_registry()`, which can also authenticate
|
|
2514
|
+
to private repositories when provided with the appropriate keys in a `modal.Secret`.
|
|
2515
|
+
|
|
2476
2516
|
For IAM user authentication, set `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_REGION`.
|
|
2477
2517
|
|
|
2478
2518
|
For OIDC authentication, set `AWS_ROLE_ARN` and `AWS_REGION`.
|
|
@@ -2900,8 +2940,8 @@ class _Image(_Object, type_prefix="im"):
|
|
|
2900
2940
|
volumes: Volume and bucket mounts attached for the build.
|
|
2901
2941
|
network_file_systems: Network file systems attached for the build.
|
|
2902
2942
|
gpu: GPU type or list of types for the builder container.
|
|
2903
|
-
cpu: CPU cores to request
|
|
2904
|
-
memory: Memory to request in MiB
|
|
2943
|
+
cpu: CPU cores to request.
|
|
2944
|
+
memory: Memory to request in MiB.
|
|
2905
2945
|
timeout: Maximum build-step runtime in seconds.
|
|
2906
2946
|
cloud: Cloud provider for the builder function.
|
|
2907
2947
|
region: Region or regions for the builder function.
|
|
@@ -3066,8 +3106,7 @@ class _Image(_Object, type_prefix="im"):
|
|
|
3066
3106
|
raise InvalidError("Image CMD must be a list of strings.")
|
|
3067
3107
|
|
|
3068
3108
|
cmd_args = _flatten_str_args("cmd", "cmd", cmd)
|
|
3069
|
-
|
|
3070
|
-
dockerfile_cmd = f"CMD [{cmd_str}]"
|
|
3109
|
+
dockerfile_cmd = f"CMD {json.dumps(cmd_args, ensure_ascii=False)}"
|
|
3071
3110
|
|
|
3072
3111
|
return self.dockerfile_commands(dockerfile_cmd)
|
|
3073
3112
|
|
|
@@ -3211,7 +3250,7 @@ class _Image(_Object, type_prefix="im"):
|
|
|
3211
3250
|
|
|
3212
3251
|
```python notest
|
|
3213
3252
|
image = modal.Image.debian_slim().pip_install("numpy")
|
|
3214
|
-
image.build(
|
|
3253
|
+
image.build()
|
|
3215
3254
|
image.publish("my-image-with-numpy") # my-image-with-numpy:latest
|
|
3216
3255
|
image.publish("my-image-with-numpy:v1")
|
|
3217
3256
|
```
|