prefect.cli.cloud

Command line interface for interacting with Prefect Cloud

Functions

set_login_api_ready_event

set_login_api_ready_event() -> None

lifespan

lifespan(app: FastAPI)

receive_login

receive_login(payload: LoginSuccess) -> None

receive_failure

receive_failure(payload: LoginFailed) -> None

serve_login_api

serve_login_api(cancel_scope: anyio.CancelScope, task_status: anyio.abc.TaskStatus[uvicorn.Server]) -> None

confirm_logged_in

confirm_logged_in() -> None

get_current_workspace

get_current_workspace(workspaces: Iterable[Workspace]) -> Workspace | None

prompt_select_from_list

prompt_select_from_list(console: Console, prompt: str, options: list[str] | list[tuple[T, str]]) -> str | T
Given a list of options, display the values to user in a table and prompt them to select one. Args:
  • options: A list of options to present to the user. A list of tuples can be passed as key value pairs. If a value is chosen, the key will be returned.
Returns:
  • the selected option

login_with_browser

login_with_browser() -> str
Perform login using the browser. On failure, this function will exit the process. On success, it will return an API key.

check_key_is_valid_for_login

check_key_is_valid_for_login(key: str) -> bool
Attempt to use a key to see if it is valid

login

login(key: Optional[str] = typer.Option(None, '--key', '-k', help='API Key to authenticate with Prefect'), workspace_handle: Optional[str] = typer.Option(None, '--workspace', '-w', help="Full handle of workspace, in format '<account_handle>/<workspace_handle>'"))
Log in to Prefect Cloud. Creates a new profile configured to use the specified PREFECT_API_KEY. Uses a previously configured profile if it exists.

logout

logout()
Logout the current workspace. Reset PREFECT_API_KEY and PREFECT_API_URL to default.

open

open()
Open the Prefect Cloud UI in the browser.

ls

ls()
List available workspaces.

set

set(workspace_handle: str = typer.Option(None, '--workspace', '-w', help="Full handle of workspace, in format '<account_handle>/<workspace_handle>'"))
Set current workspace. Shows a workspace picker if no workspace is specified.

Classes

LoginSuccess

LoginFailed

LoginResult

ServerExit