Skip to content

Commit d5400e8

Browse files
committed
feat(docs): add Google Artifact Registry index instructions
This commit adds Google Artifact Registry authentication instructions for both basic HTTP authentication and keyring methods. Locally tested using both methods.
1 parent d362e03 commit d5400e8

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

docs/guides/integration/alternative-indexes.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,55 @@ $ # 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).
69+
Authenticate to a repository using password authentication
70+
or using [`keyring`](https://github.com/jaraco/keyring) 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 password field of the URL. Username must be `oauth2accesstoken`, otherwise authentication will fail.
79+
80+
For example, with the token stored in the `$ARTIFACT_REGISTRY_TOKEN` environment variable, set the index URL with:
81+
82+
```bash
83+
export ARTIFACT_REGISTRY_TOKEN=$(gcloud auth application-default print-access-token)
84+
export UV_EXTRA_INDEX_URL=https://oauth2accesstoken:$ARTIFACT_REGISTRY_TOKEN@{region}-python.pkg.dev/{projectId}/{repositoryName}/simple
85+
```
86+
87+
### Using `keyring`
88+
89+
You can also authenticate to Artifact Registry using
90+
[`keyring`](https://github.com/jaraco/keyring) package with
91+
[`keyrings.google-artifactregistry-auth` plugin](https://github.com/GoogleCloudPlatform/artifact-registry-python-tools). Because these two
92+
packages are required to authenticate to Artifact Registry, they must be pre-installed from a source
93+
other than Artifact Registry.
94+
95+
The `artifacts-keyring` plugin wraps
96+
[gcloud CLI](https://cloud.google.com/sdk/gcloud) to generate short-lived access tokens, securely store them in system keyring and refresh them when they are expired.
97+
98+
uv only supports using the `keyring` package in
99+
[subprocess mode](https://github.com/astral-sh/uv/blob/main/PIP_COMPATIBILITY.md#registry-authentication).
100+
The `keyring` executable must be in the `PATH`, i.e., installed globally or in the active
101+
environment. The `keyring` CLI requires a username in the URL and it must be `oauth2accesstoken`.
102+
103+
```bash
104+
# Pre-install keyring and Artifact Registry plugin from the public PyPI
105+
uv tool install keyring --with keyrings.google-artifactregistry-auth
106+
107+
# Enable keyring authentication
108+
export UV_KEYRING_PROVIDER=subprocess
109+
110+
# Configure the index URL with the username
111+
export UV_EXTRA_INDEX_URL=https://oauth2accesstoken@{region}-python.pkg.dev/{projectId}/{repositoryName}/simple
112+
```
113+
65114
## AWS CodeArtifact
66115

67116
uv can install packages from
@@ -118,4 +167,4 @@ uv publish
118167

119168
## Other indexes
120169

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

0 commit comments

Comments
 (0)