Keyring backend for Google Auth tokens
Project description
Artifact Registry tools for PyPI
This repository contains an alternate keyring backend implementation to help with interacting with PyPI Repositories hosted on Artifact Registry.
Authentication
keyrings.google-artifactregistry-auth is a python package which allows you to configure keyring to interact with PyPI 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
gcloud
SDK. (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 login`
Option 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 alpha artifacts print-settings pypi
In your
.pypirc
file add:[disutils] index-servers = REPOSITORY_ID [REPOSITORY_ID] repository: https://LOCATION-pypi.pkg.dev/PROJECT_ID/REPOSITORY_ID/
In your
pip.conf
file add:[global] index-url = https://LOCATION-pypi.pkg.dev/PROJECT_ID/REPOSITORY_ID/simple/
-
Install the keyrings.google-artifactregistry-auth package
pip install keyrings.google-artifactregistry-auth
List backends to confirm the installation.
`keyring --list-backends`
The list should include
-`ChainerBackend(priority:10)`
-`GooglePyPIAuth(priority:9)`
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file keyrings.google-artifactregistry-auth-0.0.2.tar.gz
.
File metadata
- Download URL: keyrings.google-artifactregistry-auth-0.0.2.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5159494aab6d84ab1162b79d077ae25cc6ec5b340382e8a386a888abc25b9c0f |
|
MD5 | 5704d0b87961d6f37d7b570c6727eb01 |
|
BLAKE2b-256 | 2870f03c85972c75921482f4a08e406ae21dbd1dc8af4ffea889234307c8f711 |
Provenance
File details
Details for the file keyrings.google_artifactregistry_auth-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: keyrings.google_artifactregistry_auth-0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83ca7e1f0ca4dd66e388e2c437abf7923c9c90b660cd56e6591a3d655d0bf05a |
|
MD5 | 9deb7bf4c18583005d07e82d494d44f2 |
|
BLAKE2b-256 | 76029f28458631602cbc62c6d188c313ce81a2b796bc3eb4f4fa3e9c10e6e3b4 |