The `google-cloud-artifact-registry` client library for Python allows developers to interact with Google Cloud Artifact Registry. This service provides a universal package manager for various artifact formats, including Docker images, Maven artifacts, npm packages, and more. The library is currently at version 1.21.0 and is part of the actively maintained Google Cloud Python client libraries, receiving frequent updates.
pip install google-cloud-artifact-registryVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the `ArtifactRegistryClient` and list repositories within a specified Google Cloud project and location. It highlights the use of `parent` resource names and iterating over paginated results.
Always specify the correct `location` parameter in your API calls, typically in the `parent` resource name string (e.g., `projects/{project_id}/locations/{location}`).Ensure that resource name strings are constructed precisely according to the API documentation. For instance, `client.repository_path(project, location, repository_id)` can be used to generate the correct format.
Verify that the environment has access to valid credentials and that the principal (user or service account) has the necessary IAM roles (e.g., 'Artifact Registry Reader' or 'Artifact Registry Administrator') for the resources it's attempting to access.
Ensure the service account or user has the appropriate IAM roles (e.g., `Artifact Registry Reader` for pulling, `Artifact Registry Writer` for pushing) on the target repository. For Docker, run `gcloud auth configure-docker <REGION>-docker.pkg.dev` to refresh credentials. For Python packages, ensure `keyrings.google-artifactregistry-auth` is installed and configured, or pass credentials via `gcloud artifacts print-settings python`.
Install the library using pip: `pip install google-cloud-artifact-registry`. Ensure you are installing it in the correct virtual environment if you are using one.
Start the Docker daemon on your local machine. If connecting to a remote daemon, verify that `DOCKER_HOST` is correctly configured and the remote daemon is running and accessible.
Double-check the package name, version, and the full repository URL used in your `pip` or `twine` command. Verify the package exists in the repository by listing its contents in the Google Cloud Console or using `gcloud artifacts packages list`.
No dependency data recorded yet.