modal-client API reference
132 public APIs from modal-client (modal-labs/modal-client) — 56 classes, 57 functions, 19 methods. Signatures extracted by static analysis of the actual source.
Repository: modal-labs/modal-client
| Kind | Count |
|---|---|
| Classes | 56 |
| Functions | 57 |
| Methods | 19 |
API list
class
py.modal._output.manager.DisabledStatusRowNo-op StatusRow used when output is disabled.
class
py.modal._output.rich.ProgressHandlerInternal handler for rich-based transfer progress display.
class
py.modal._output.rich.RichOutputManagerRich-based implementation of OutputManager.
method
py.modal._output.rich.RichOutputManager.add_status_row() -> StatusRowAdd a status row to the current object tree.
method
py.modal._output.rich.RichOutputManager.print(renderable:Any, *stderr:bool=False, *highlight:bool=True, *style:str | None=None, *sep:str=' ', *end:str='\n') -> NonePrint a renderable to the console.
method
py.modal._output.rich.RichOutputManager.print_json(data:str) -> NonePrint JSON data with formatting.
method
py.modal._output.rich.RichOutputManager.put_fetched_log(log:api_pb2.TaskLogs, prefix:str='') -> NoneProcess and display log content with batched output.
method
py.modal._output.rich.RichOutputManager.put_streaming_log(log:api_pb2.TaskLogs, prefix:str='') -> NoneProcess and display log content with immediate output.
method
py.modal._output.rich.RichOutputManager.status(message:str) -> StatusContextCreate a status spinner context manager.
method
py.modal._output.rich.RichOutputManager.step_completed(message:str) -> NonePrint a step completed message.
method
py.modal._output.rich.RichOutputManager.stop_status_spinner() -> NoneStop the status spinner if it's running.
class
py.modal._output.rich.RichStatusRowRich-backed implementation of StatusRow.
class
py.modal._runtime.container_io_manager.SentinelUsed to get type-stubs to work with this object.
func
py.modal._runtime.execution_context.current_input_id() -> str | NoneReturns the input ID for the current input.
func
py.modal._runtime.execution_context.is_local() -> boolIndicate the execution context of the current process.
class
py.modal._runtime.gpu_memory_snapshot.CudaCheckpointExceptionException raised for CUDA checkpoint operations.
class
py.modal._runtime.gpu_memory_snapshot.CudaCheckpointStateState representation from the CUDA API [1].
class
py.modal._runtime.task_lifecycle_manager.UserExceptionUsed to shut down the task gracefully.
func
py.modal._serialization.deserialize(s:bytes, client) -> AnyDeserializes object and replaces all client placeholders by self.
func
py.modal._serialization.serialize_data_format(obj:Any, data_format:int) -> bytesSimilar to serialize(), but supports other data formats.
class
py.modal._tunnel.TunnelA port forwarded from within a running Modal container.
method
py.modal._tunnel.Tunnel.tcp_socket() -> tuple[str, int]Get the public TCP socket as a (host, port) tuple.
method
py.modal._tunnel.Tunnel.tls_socket() -> tuple[str, int]Get the public TLS socket as a (host, port) tuple.
method
py.modal._tunnel.Tunnel.url() -> strGet the public HTTPS URL of the forwarded port.
class
py.modal._utils.async_utils.TaskContextA structured group that helps manage stray tasks.
method
py.modal._utils.async_utils.TaskContext.gather(*coros:Awaitable) -> AnyWait for a sequence of coroutines to finish, concurrently.
func
py.modal._utils.async_utils.asyncnullcontext(*args, **kwargs)Async noop context manager.
func
py.modal._utils.async_utils.iterate_blocking(iterator:Iterator[T]) -> AsyncGenerator[T, None]Iterate over a blocking iterator in an async context.
func
py.modal._utils.async_utils.rewrite_sync_to_async(code_line:str, original_func:Callable) -> tuple[bool, str]Rewrite a blocking call to use async/await syntax.
func
py.modal._utils.browser_utils.open_url_and_display(url:str, target:str) -> NoneOpen a URL in the web browser and display it to the user.
func
py.modal._utils.curl_utils.find_url(curl_args:tuple[str, ...]) -> str | NoneFind the Modal direct URL operand within a curl argument list.
func
py.modal._utils.docker_utils.extract_copy_command_patterns(dockerfile_lines:Sequence[str]) -> list[str]Extract all COPY command sources from a Dockerfile.
func
py.modal._utils.function_utils.exc_with_hints(exc:BaseException)mdmd:hidden
func
py.modal._utils.function_utils.is_top_level_function(f:Callable) -> boolReturns True if this function is defined in global scope.
class
py.modal._utils.grpc_utils.CustomProtoStatusDetailsCodecgrpclib compatible details codec.
func
py.modal._utils.grpc_utils.create_channel(server_url:str, metadata:dict[str, str]={}) -> grpclib.client.ChannelCreates a grpclib.Channel to be used by a GRPC stub.
func
py.modal._utils.grpc_utils.find_free_port() -> intFind a free TCP port, useful for testing.
func
py.modal._utils.grpc_utils.get_server_retry_policy(exc:Exception) -> api_pb2.RPCRetryPolicy | NoneGet server retry policy.
func
py.modal._utils.mount_utils.validate_only_modal_volumes(volumes:dict[str | PurePosixPath, _Volume] | None, caller_name:str) -> Sequence[tuple[str, _Volume]]Validate all volumes are `modal.Volume`.
class
py.modal._utils.pattern_utils.PatternDefines a single regex pattern used to filter file paths.
method
py.modal._utils.pattern_utils.Pattern.compile(separator:str) -> NoneCompile the pattern into a regular expression.
method
py.modal._utils.pattern_utils.Pattern.match(path:str) -> boolCheck if the path matches the pattern.
func
py.modal._utils.rand_pb_testing.rand_pb(proto:type[T], rand:Random | None=None) -> TGenerate a pseudorandom protobuf message.
func
py.modal._utils.sandbox_fs_utils.make_list_files_command(remote_path:str) -> strBuild the JSON command string for a ListFiles operation.
func
py.modal._utils.sandbox_fs_utils.make_read_file_command(remote_path:str) -> strBuild the JSON command string for a ReadFile operation.
func
py.modal._utils.sandbox_fs_utils.make_remove_command(remote_path:str, recursive:bool) -> strBuild the JSON command string for a Remove operation.
func
py.modal._utils.sandbox_fs_utils.make_stat_command(remote_path:str) -> strBuild the JSON command string for a Stat operation.
func
py.modal._utils.sandbox_fs_utils.make_write_file_command(remote_path:str) -> strBuild the JSON command string for a WriteFile operation.
func
py.modal._utils.shell_utils.get_winsz(fd=None) -> tuple[int | None, int | None]Get the window size of a terminal.
func
py.modal._utils.shell_utils.set_nonblocking(fd:int)Set a file descriptor to non-blocking mode.
func
py.modal._utils.time_utils.as_timestamp(arg:datetime | str | None) -> floatCoerce a user-provided argument to a timestamp.
func
py.modal._utils.time_utils.resolve_timezone(s:str) -> tzinfoResolve a timezone string to a tzinfo object.
class
py.modal.cli._help.ModalCommandclick.Command that renders --help with custom rich output.
func
py.modal.cli._help.use_rich_style() -> boolWhether help output should be rendered in the rich style.
func
py.modal.cli.app.history(app_identifier:str, *env:str | None=None, *json:bool=False)Show an App's deployment history.
func
py.modal.cli.billing.summary(for_:str | None, json:bool)Generate a billing summary for the workspace.
func
py.modal.cli.bootstrap.bootstrap(name:str | None=None, output:str='.', force:bool=False) -> NoneInitialize a sample Modal App.
func
py.modal.cli.cluster.list_(env:str | None=None, json:bool=False)List all clusters that are currently running.
func
py.modal.cli.cluster.shell(cluster_id:str, rank:int=0)Open a shell to a multi-node cluster node.
func
py.modal.cli.container.exec(pty:bool | None=None, container_id:str='', command:tuple[str, ...]=())Execute a command in a container.
func
py.modal.cli.container.stop(container_id:str='', *graceful:bool=False, *yes:bool=False)Terminate a running container.
func
py.modal.cli.dashboard.dashboard(object_id:str | None=None)Open the Modal Dashboard in a web browser.
func
py.modal.cli.dict.create(name:str, *env:str | None=None)Create a named Dict object.
func
py.modal.cli.dict.get(name:str, key:str, *env:str | None=None)Print the value for a specific key.
func
py.modal.cli.dict.items(name:str, n:int=20, *all:bool=False, *use_repr:bool=False, *json:bool=False, *env:str | None=None)Print the contents of a Dict.
func
py.modal.cli.dict.list_(*json:bool=False, *env:str | None=None)List all named Dicts.
func
py.modal.cli.image.logs(image_id:str, layers:int | None, all_layers:bool) -> NoneFetch build logs for an Image.
func
py.modal.cli.queues.create(name:str, *env:str | None=None)Create a named Queue.
func
py.modal.cli.queues.list_(*json:bool=False, *env:str | None=None)List all named Queues.
class
py.modal.cli.run.LiteralIntParamTypeA ParamType for Literal types containing only integers.
method
py.modal.cli.selector.Selector.run(live:Live | None=None) -> strRun an interactive selection loop.
func
py.modal.cli.volume.cp(volume_name:str, paths:tuple[str, ...], recursive:bool=False, env:str | None=None)Copy within a modal.Volume.
func
py.modal.cli.workspace.settings_group(ctx:click.Context, json:bool)View the current settings for the workspace.
func
py.modal.cli.workspace.settings_set(setting:str, value:str)Update a workspace setting.
class
py.modal.config.ConfigSingleton that holds configuration used by Modal internally.
method
py.modal.config.Config.get(key:str, *profile:str | None=None, *use_env:bool=True) -> AnyLook up a configuration value.
class
py.modal.exception.AuthErrorRaised when a client has missing or invalid authentication.
class
py.modal.exception.DataLossErrorRaised when data is lost or corrupted.
class
py.modal.exception.ErrorBase class for all Modal errors.
class
py.modal.exception.ExecutionErrorRaised when something unexpected happened during runtime.
class
py.modal.exception.ImageBuildErrorRaised when an image build fails.
class
py.modal.exception.InternalErrorRaised when an internal error occurs in the Modal system.
class
py.modal.exception.InternalFailureRetriable internal error.
class
py.modal.exception.InvalidErrorRaised when user does something invalid.
class
py.modal.exception.LogsFetchErrorRaised when trying to fetch too many logs.
class
py.modal.exception.MountUploadTimeoutErrorRaised when a Mount upload times out.
class
py.modal.exception.NotFoundErrorRaised when a requested resource was not found.
class
py.modal.exception.OutputExpiredErrorRaised when the Output exceeds expiration and times out.
class
py.modal.exception.RemoteErrorRaised when an error occurs on the Modal server.
class
py.modal.exception.SandboxFilesystemDirectoryNotEmptyErrorRaised when a directory is not empty.
class
py.modal.exception.SandboxFilesystemErrorBase class for sandbox filesystem errors.
class
py.modal.exception.SnapshotCreationErrorRaised when a Sandbox fails to create an exit snapshot.
class
py.modal.exception.TimeoutErrorBase class for Modal timeouts.
class
py.modal.exception.VolumeUploadTimeoutErrorRaised when a Volume upload times out.
class
py.modal.exception.WorkspaceManagementErrorRaised when an error occurs while managing a workspace.
class
py.modal.experimental.AppLifecycleLifecycle information about an App.
func
py.modal.experimental.get_app_lifecycle(app_id:str, *client:_Client | None=None) -> AppLifecycleGet lifecycle information about an App.
func
py.modal.experimental.image_delete(image_id:str, *client:_Client | None=None) -> NoneDelete an Image by its ID.
func
py.modal.experimental.stop_app(name:str, *environment_name:str | None=None, *client:_Client | None=None) -> NoneStop a deployed App.
func
py.modal.file_io.ls(path:str, client:_Client, task_id:str) -> list[str]List the contents of the provided directory.
func
py.modal.file_io.mkdir(path:str, client:_Client, task_id:str, parents:bool=False) -> NoneCreate a new directory.
func
py.modal.file_io.rm(path:str, client:_Client, task_id:str, recursive:bool=False) -> NoneRemove a file or directory in the Sandbox.
func
py.modal.file_io.watch(path:str, client:_Client, task_id:str, filter:list[FileWatchEventType] | None=None, recursive:bool=False, timeout:int | None=None) -> AsyncIterator[FileWatchEvent]Watch a file or directory for changes.
func
py.modal.mount.client_mount_name() -> strGet the deployed name of the client package mount.
func
py.modal.mount.python_standalone_mount_name(version:str) -> strGet the deployed name of the python-build-standalone mount.
func
py.modal.network_file_system.network_file_system_mount_protos(validated_network_file_systems:list[tuple[str, '_NetworkFileSystem']]) -> list[api_pb2.SharedVolumeMount]mdmd:hidden
class
py.modal.retries.RetriesAdds a retry policy to a Modal function.
class
py.modal.retries.RetryManagerHelper class to apply the specified retry policy.
class
py.modal.runner.DeployResultDataclass representing the result of deploying an app.
class
py.modal.sandbox.ProbeProbe configuration for the Sandbox Readiness Probe.
class
py.modal.schedule.PeriodCreate a schedule that runs every given time interval.
class
py.modal.scheduler_placement.SchedulerPlacementmdmd:hidden This is an experimental feature.
class
py.modal.types.DictInfoInformation about a Dict object.
class
py.modal.types.FileEntryA file or directory entry listed from a Modal volume.
class
py.modal.types.FileEntryTypeType of a file entry listed from a Modal volume.
class
py.modal.types.FileInfoMetadata for a file or directory entry in a Sandbox.
method
py.modal.types.FileInfo.is_dir() -> boolReturn `True` if this entry is a directory.
method
py.modal.types.FileInfo.is_file() -> boolReturn `True` if this entry is a regular file.
method
py.modal.types.FileInfo.is_symlink() -> boolReturn `True` if this entry is a symbolic link.
class
py.modal.types.FileTypeType of a filesystem entry.
class
py.modal.types.FunctionStatsSimple data structure storing stats for a running function.
class
py.modal.types.InputStatusEnum representing status of a function input.
class
py.modal.types.LogEntryA log entry emitted by a Modal object.
class
py.modal.types.QueueInfoInformation about a Queue object.
class
py.modal.types.SecretInfoInformation about a Secret object.
class
py.modal.types.TokenDataA token ID / secret pair.
class
py.modal.types.VolumeCreateOptionsOptions used when creating a Volume.
class
py.modal.types.VolumeInfoInformation about a Volume object.
class
py.modal.types.WorkspaceMemberInfoMetadata about a Workspace member.
class
py.modal.types.WorkspaceSettingsCurrent settings for the workspace.
func
py.modal_docs.gen_reference_docs.run(output_dir:str | None=None)Generate Modal docs.
func
py.modal_docs.mdmd.mdmd.module_items(module, filter_items:Callable[[ModuleType, str], bool])Returns filtered members of module
About this data
These signatures were extracted from the public source of modal-labs/modal-client
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.