Workspace admins can configure private or authenticated package repositories within workspaces as the default pip configuration for serverless notebooks, serverless jobs, and classic compute.
If a workspace is configured with a default Python package repo, users in the workspace will be able to install packages from internal Python repositories without explicitly defining index-url
or extra-index-url
values. However, if these values are specified in code or in a notebook, they take precedence over the workspace defaults.
This configuration leverages Databricks secrets to securely store and manage repository URLs and credentials. Workspace admins can configure the setup using the workspace admin settings page or using a predefined secret scope and the Databricks CLI secrets commands or the REST API.
Set up default dependencies for a workspaceâWorkspace admins can add or remove the default Python package repositories using the workspace admin settings page.
note
Modifications or deletions to secrets are applied after reattaching the compute resource to notebooks or rerunning the jobs.
Setup using the secrets CLI or REST APIâTo configure default Python package repositories using the CLI or REST API, create a predefined secret scope and configure access permissions, then add the package repository secrets.
Predefined secret scope nameâWorkspace administrators can set default pip index URLs or extra index URLs along with authentication tokens and secrets in a designated secret scope under predefined keys:
databricks-package-management
pip-index-url
pip-extra-index-urls
pip-cert
A secret scope can be created using the Databricks CLI secrets commands or the REST API. After creating the secret scope, configure access control lists to grant all workspace users read access. This ensures that the repository remains secure and cannot be altered by individual users. The secret scope must use the predefined secret scope name databricks-package-management
.
Bash
databricks secrets create-scope databricks-package-management
databricks secrets put-acl databricks-package-management admins MANAGE
databricks secrets put-acl databricks-package-management users READ
Add Python package repository secretsâ
Add the Python package repository details using the predefined secret key names, with all three fields being optional.
Bash
databricks secrets put-secret --json '{"scope": "databricks-package-management", "key": "pip-index-url", "string_value":"<index-url-value>"}'
databricks secrets put-secret --json '{"scope": "databricks-package-management", "key": "pip-extra-index-urls", "string_value":"<extra-index-url-1 extra-index-url-2>"}'
databricks secrets put-secret --json '{"scope": "databricks-package-management", "key": "pip-cert", "string_value":"<cert-content>"}'
Modify or delete private PyPI repository secretsâ
To modify PyPI repository secrets, use the put-secret
command. To delete PyPI repository secrets, use delete-secret
as shown below:
Bash
databricks secrets delete-secret databricks-package-management pip-index-url
databricks secrets delete-secret databricks-package-management pip-extra-index-urls
databricks secrets delete-secret databricks-package-management pip-cert
databricks secrets delete-scope databricks-package-management
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4