Keyring backend for Google Auth tokens
Slowing down. Last release over 3 years ago, little activity since. Fine for existing code; think twice for a new project.
pip install keyrings-google-artifactregistry-authREADME as published on PyPI with version 1.1.2.
Artifact Registry tools for Python
This repository contains an alternate keyring backend implementation to help with interacting with Python repositories hosted on Artifact Registry.
Authentication
keyrings.google-artifactregistry-auth is a Python package which allows you to configure keyring to interact with Python repositories stored in Artifact Registry.
The backend automatically searches for credentials from the environment and authenticates to Artifact Registry. It looks for credentials in the following order:
- Google Application Default Credentials.
- From the
gcloudSDK. (i.e., the access token printed viagcloud config config-helper --format='value(credential.access_token)')- Hint: You can see which account is active with the command
gcloud config config-helper --format='value(configuration.properties.core.account)'
- Hint: You can see which account is active with the command
- If neither of them exist, an error occurs.
To use the keyring backend:
-
Log in
Option 1: log in as a service account:
(1). Using a JSON file that contains a service account key:
$ export GOOGLE_APPLICATION_CREDENTIALS=[path/to/key.json](2). Or using
gcloud:$ gcloud auth application-default loginOption 2: log in as an end user via
gcloud:$ gcloud auth login -
Configure twine (
.pypirc) and pip (pip.conf) tools to connect to the repository. Use the output from the following command:$ gcloud artifacts print-settings pythonIn your
.pypircfile add:[disutils] index-servers = REPOSITORY_ID [REPOSITORY_ID] repository = https://LOCATION-python.pkg.dev/PROJECT_ID/REPOSITORY_ID/In your
pip.conffile add:[global] extra-index-url = https://LOCATION-python.pkg.dev/PROJECT_ID/REPOSITORY_ID/simple/