Skip to content

Commit 08d0229

Browse files
authored
feat(docs): add Google Artifact Registry index instructions (#8579)
## Summary This commit adds Google Artifact Registry authentication instructions for both basic HTTP authentication and keyring methods. ## Test Plan Locally tested using both methods.
1 parent 2829ab1 commit 08d0229

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

docs/guides/integration/alternative-indexes.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,58 @@ $ # Configure the index URL with the username
6262
$ export UV_EXTRA_INDEX_URL=https://[email protected]/{organisation}/{project}/_packaging/{feedName}/pypi/simple/
6363
```
6464

65+
## Google Artifact Registry
66+
67+
uv can install packages from
68+
[Google Artifact Registry](https://cloud.google.com/artifact-registry/docs). Authenticate to a
69+
repository using password authentication or using [`keyring`](https://github.com/jaraco/keyring)
70+
package.
71+
72+
!!! note
73+
74+
This guide assumes `gcloud` CLI has previously been installed and setup.
75+
76+
### Password authentication
77+
78+
Credentials can be provided via "Basic" HTTP authentication scheme. Include access token in the
79+
password field of the URL. Username must be `oauth2accesstoken`, otherwise authentication will fail.
80+
81+
For example, with the token stored in the `$ARTIFACT_REGISTRY_TOKEN` environment variable, set the
82+
index URL with:
83+
84+
```bash
85+
export ARTIFACT_REGISTRY_TOKEN=$(gcloud auth application-default print-access-token)
86+
export UV_EXTRA_INDEX_URL=https://oauth2accesstoken:$ARTIFACT_REGISTRY_TOKEN@{region}-python.pkg.dev/{projectId}/{repositoryName}/simple
87+
```
88+
89+
### Using `keyring`
90+
91+
You can also authenticate to Artifact Registry using [`keyring`](https://github.com/jaraco/keyring)
92+
package with
93+
[`keyrings.google-artifactregistry-auth` plugin](https://github.com/GoogleCloudPlatform/artifact-registry-python-tools).
94+
Because these two packages are required to authenticate to Artifact Registry, they must be
95+
pre-installed from a source other than Artifact Registry.
96+
97+
The `artifacts-keyring` plugin wraps [gcloud CLI](https://cloud.google.com/sdk/gcloud) to generate
98+
short-lived access tokens, securely store them in system keyring and refresh them when they are
99+
expired.
100+
101+
uv only supports using the `keyring` package in
102+
[subprocess mode](https://github.com/astral-sh/uv/blob/main/PIP_COMPATIBILITY.md#registry-authentication).
103+
The `keyring` executable must be in the `PATH`, i.e., installed globally or in the active
104+
environment. The `keyring` CLI requires a username in the URL and it must be `oauth2accesstoken`.
105+
106+
```bash
107+
# Pre-install keyring and Artifact Registry plugin from the public PyPI
108+
uv tool install keyring --with keyrings.google-artifactregistry-auth
109+
110+
# Enable keyring authentication
111+
export UV_KEYRING_PROVIDER=subprocess
112+
113+
# Configure the index URL with the username
114+
export UV_EXTRA_INDEX_URL=https://oauth2accesstoken@{region}-python.pkg.dev/{projectId}/{repositoryName}/simple
115+
```
116+
65117
## AWS CodeArtifact
66118

67119
uv can install packages from
@@ -118,4 +170,4 @@ uv publish
118170

119171
## Other indexes
120172

121-
uv is also known to work with JFrog's Artifactory and the Google Cloud Artifact Registry.
173+
uv is also known to work with JFrog's Artifactory.

0 commit comments

Comments
 (0)