w.environments: Environments.v1

class databricks.sdk.service.environments.EnvironmentsAPI

APIs to manage environment resources.

The Environments API provides management capabilities for different types of environments including workspace-level base environments that define the environment version and dependencies to be used in serverless notebooks and jobs.

create_workspace_base_environment(workspace_base_environment: WorkspaceBaseEnvironment [, request_id: Optional[str], workspace_base_environment_id: Optional[str]]) CreateWorkspaceBaseEnvironmentOperation

Creates a new WorkspaceBaseEnvironment. This is a long-running operation. The operation will asynchronously generate a materialized environment to optimize dependency resolution and is only marked as done when the materialized environment has been successfully generated or has failed.

Parameters:
  • workspace_base_environmentWorkspaceBaseEnvironment Required. The workspace base environment to create.

  • request_id – str (optional) A unique identifier for this request. A random UUID is recommended. This request is only idempotent if a request_id is provided.

  • workspace_base_environment_id – str (optional) The ID to use for the workspace base environment, which will become the final component of the resource name. This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.

Returns:

Operation

delete_workspace_base_environment(name: str)

Deletes a WorkspaceBaseEnvironment. Deleting a base environment may impact linked notebooks and jobs. This operation is irreversible and should be performed only when you are certain the environment is no longer needed.

Parameters:

name – str Required. The resource name of the workspace base environment to delete. Format: workspace-base-environments/{workspace_base_environment}

get_default_workspace_base_environment(name: str) DefaultWorkspaceBaseEnvironment

Gets the default WorkspaceBaseEnvironment configuration for the workspace. Returns the current default base environment settings for both CPU and GPU compute.

Parameters:

name – str A static resource name of the default workspace base environment. Format: default-workspace-base-environment

Returns:

DefaultWorkspaceBaseEnvironment

get_operation(name: str) Operation

Gets the status of a long-running operation. Clients can use this method to poll the operation result.

Parameters:

name – str The name of the operation resource.

Returns:

Operation

get_workspace_base_environment(name: str) WorkspaceBaseEnvironment

Retrieves a WorkspaceBaseEnvironment by its name.

Parameters:

name – str Required. The resource name of the workspace base environment to retrieve. Format: workspace-base-environments/{workspace_base_environment}

Returns:

WorkspaceBaseEnvironment

list_workspace_base_environments([, page_size: Optional[int], page_token: Optional[str]]) Iterator[WorkspaceBaseEnvironment]

Lists all WorkspaceBaseEnvironments in the workspace.

Databricks provides the following base environments:

  • workspace-base-environments/databricks_ai_…: includes popular AI and deep learning packages for

serverless GPU compute.

  • workspace-base-environments/databricks_ml_…: includes popular ML packages for serverless

compute.

Databricks-provided base environments are versioned. For example, workspace-base-environments/databricks_ml_v5 corresponds to the ML environment built on environment version 5.

Parameters:
  • page_size – int (optional) The maximum number of environments to return per page. Default is 1000.

  • page_token – str (optional) Page token for pagination. Received from a previous ListWorkspaceBaseEnvironments call.

Returns:

Iterator over WorkspaceBaseEnvironment

refresh_workspace_base_environment(name: str) RefreshWorkspaceBaseEnvironmentOperation

Refreshes the materialized environment for a WorkspaceBaseEnvironment. This is a long-running operation. The operation will asynchronously regenerate the materialized environment and is only marked as done when the materialized environment has been successfully generated or has failed. The existing materialized environment remains available until it expires.

Parameters:

name – str Required. The resource name of the workspace base environment to delete. Format: workspace-base-environments/{workspace_base_environment}

Returns:

Operation

update_default_workspace_base_environment(name: str, default_workspace_base_environment: DefaultWorkspaceBaseEnvironment, update_mask: FieldMask) DefaultWorkspaceBaseEnvironment

Updates the default WorkspaceBaseEnvironment configuration for the workspace. Sets the specified base environments as the workspace defaults for CPU and/or GPU compute.

Parameters:
  • name – str The resource name of this singleton resource. Format: default-workspace-base-environment

  • default_workspace_base_environmentDefaultWorkspaceBaseEnvironment Required. The default workspace base environment configuration to update.

  • update_mask

    FieldMask Field mask specifying which fields to update. Use comma as the separator for multiple fields (no space). The special value ‘*’ indicates that all fields should be updated (full replacement). Valid field paths: cpu_workspace_base_environment, gpu_workspace_base_environment

    To unset one or both defaults, include the field path(s) in the mask and omit them from the request body. To unset both, you must list both paths explicitly — the wildcard ‘*’ cannot be used to unset fields.

Returns:

DefaultWorkspaceBaseEnvironment

update_workspace_base_environment(name: str, workspace_base_environment: WorkspaceBaseEnvironment) UpdateWorkspaceBaseEnvironmentOperation

Updates an existing WorkspaceBaseEnvironment. This is a long-running operation. The operation will asynchronously regenerate the materialized environment and is only marked as done when the materialized environment has been successfully generated or has failed. The existing materialized environment remains available until it expires.

Parameters:
  • name – str

  • workspace_base_environmentWorkspaceBaseEnvironment Required. The workspace base environment with updated fields. The name field is used to identify the environment to update.

Returns:

Operation