diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-04-11 02:31:51 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-04-11 02:31:51 +0000 |
| commit | e565efd0b61874843931e383502b77f1c06cd660 (patch) | |
| tree | 70b88d23cc945cda7710218072c72358cc0c8945 /python-keyrings-google-artifactregistry-auth.spec | |
| parent | 0ac8c994523c4ab2a7ed33d554552f42f6232c70 (diff) | |
automatic import of python-keyrings-google-artifactregistry-auth
Diffstat (limited to 'python-keyrings-google-artifactregistry-auth.spec')
| -rw-r--r-- | python-keyrings-google-artifactregistry-auth.spec | 413 |
1 files changed, 413 insertions, 0 deletions
diff --git a/python-keyrings-google-artifactregistry-auth.spec b/python-keyrings-google-artifactregistry-auth.spec new file mode 100644 index 0000000..f31cc9b --- /dev/null +++ b/python-keyrings-google-artifactregistry-auth.spec @@ -0,0 +1,413 @@ +%global _empty_manifest_terminate_build 0 +Name: python-keyrings.google-artifactregistry-auth +Version: 1.1.2 +Release: 1 +Summary: Keyring backend for Google Auth tokens +License: Apache Software License +URL: https://github.com/GoogleCloudPlatform/artifact-registry-python-tools +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/62/e6/3b1803862ca29534aafe94a0d73756435116f8d302e5b482bce637634cb2/keyrings.google-artifactregistry-auth-1.1.2.tar.gz +BuildArch: noarch + +Requires: python3-google-auth +Requires: python3-keyring +Requires: python3-pluggy +Requires: python3-requests +Requires: python3-pytest +Requires: python3-pytest-checkdocs +Requires: python3-pytest-cov +Requires: python3-pytest-flake8 +Requires: python3-pytest-black +Requires: python3-pytest-mypy +Requires: python3-tox + +%description +# Artifact Registry tools for Python +This repository contains an alternate [keyring](https://pypi.python.org/pypi/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: + +1. [Google Application Default Credentials](https://developers.google.com/accounts/docs/application-default-credentials). +2. From the `gcloud` SDK. (i.e., the access token printed via `gcloud 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)'` +3. If neither of them exist, an error occurs. + +To use the keyring backend: + +1. 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 + ``` + +2. Configure twine (`.pypirc`) and pip (`pip.conf`) tools to connect to the repository. Use the output from the following command: + + $ gcloud artifacts print-settings python + + In your `.pypirc` file add: + + ```ini + [disutils] + index-servers = + REPOSITORY_ID + + [REPOSITORY_ID] + repository = https://LOCATION-python.pkg.dev/PROJECT_ID/REPOSITORY_ID/ + ``` + + In your `pip.conf` file add: + + ```ini + [global] + extra-index-url = https://LOCATION-python.pkg.dev/PROJECT_ID/REPOSITORY_ID/simple/ + ``` +3. 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 + + * `keyrings.gauth.GooglePythonAuth (priority: 9)` + * `keyring.backends.chainer.ChainerBackend (priority: -1)` + * `keyring.backends.fail.Keyring (priority: 0)` + +## Usage with other tools + +### Usage with `tox` + +The [`tox` tool](https://pypi.org/project/tox/) is a testing and automation tool. + +Because the credential helper needs to be installed _before_ any private +dependencies are installed, it needs to be bootstrapped into the `tox` +environment via a plugin. + +To do this, specify the `keyrings.google-artifactregistry-auth` package via the +[`requires`](https://tox.readthedocs.io/en/latest/config.html#conf-requires) +requirement in your `tox.ini` file: + +```ini +[tox] +envlist = py +requires = keyrings.google-artifactregistry-auth + +[testenv] +deps = -r requirements.txt +``` + +You can then configure your `requirement.txt` file to use the Artifact Registry repo as +an extra index, and specify both public and private dependencies: + +``` +--extra-index-url https://[REGION]-python.pkg.dev/[PROJECT_ID]/[REPOSITORY]/simple + +# samplepackage will be installed directly from PyPI +samplepackage +# mypackage will be installed from the Artifact Registry repository +mypackage +``` + + +%package -n python3-keyrings.google-artifactregistry-auth +Summary: Keyring backend for Google Auth tokens +Provides: python-keyrings.google-artifactregistry-auth +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-keyrings.google-artifactregistry-auth +# Artifact Registry tools for Python +This repository contains an alternate [keyring](https://pypi.python.org/pypi/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: + +1. [Google Application Default Credentials](https://developers.google.com/accounts/docs/application-default-credentials). +2. From the `gcloud` SDK. (i.e., the access token printed via `gcloud 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)'` +3. If neither of them exist, an error occurs. + +To use the keyring backend: + +1. 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 + ``` + +2. Configure twine (`.pypirc`) and pip (`pip.conf`) tools to connect to the repository. Use the output from the following command: + + $ gcloud artifacts print-settings python + + In your `.pypirc` file add: + + ```ini + [disutils] + index-servers = + REPOSITORY_ID + + [REPOSITORY_ID] + repository = https://LOCATION-python.pkg.dev/PROJECT_ID/REPOSITORY_ID/ + ``` + + In your `pip.conf` file add: + + ```ini + [global] + extra-index-url = https://LOCATION-python.pkg.dev/PROJECT_ID/REPOSITORY_ID/simple/ + ``` +3. 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 + + * `keyrings.gauth.GooglePythonAuth (priority: 9)` + * `keyring.backends.chainer.ChainerBackend (priority: -1)` + * `keyring.backends.fail.Keyring (priority: 0)` + +## Usage with other tools + +### Usage with `tox` + +The [`tox` tool](https://pypi.org/project/tox/) is a testing and automation tool. + +Because the credential helper needs to be installed _before_ any private +dependencies are installed, it needs to be bootstrapped into the `tox` +environment via a plugin. + +To do this, specify the `keyrings.google-artifactregistry-auth` package via the +[`requires`](https://tox.readthedocs.io/en/latest/config.html#conf-requires) +requirement in your `tox.ini` file: + +```ini +[tox] +envlist = py +requires = keyrings.google-artifactregistry-auth + +[testenv] +deps = -r requirements.txt +``` + +You can then configure your `requirement.txt` file to use the Artifact Registry repo as +an extra index, and specify both public and private dependencies: + +``` +--extra-index-url https://[REGION]-python.pkg.dev/[PROJECT_ID]/[REPOSITORY]/simple + +# samplepackage will be installed directly from PyPI +samplepackage +# mypackage will be installed from the Artifact Registry repository +mypackage +``` + + +%package help +Summary: Development documents and examples for keyrings.google-artifactregistry-auth +Provides: python3-keyrings.google-artifactregistry-auth-doc +%description help +# Artifact Registry tools for Python +This repository contains an alternate [keyring](https://pypi.python.org/pypi/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: + +1. [Google Application Default Credentials](https://developers.google.com/accounts/docs/application-default-credentials). +2. From the `gcloud` SDK. (i.e., the access token printed via `gcloud 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)'` +3. If neither of them exist, an error occurs. + +To use the keyring backend: + +1. 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 + ``` + +2. Configure twine (`.pypirc`) and pip (`pip.conf`) tools to connect to the repository. Use the output from the following command: + + $ gcloud artifacts print-settings python + + In your `.pypirc` file add: + + ```ini + [disutils] + index-servers = + REPOSITORY_ID + + [REPOSITORY_ID] + repository = https://LOCATION-python.pkg.dev/PROJECT_ID/REPOSITORY_ID/ + ``` + + In your `pip.conf` file add: + + ```ini + [global] + extra-index-url = https://LOCATION-python.pkg.dev/PROJECT_ID/REPOSITORY_ID/simple/ + ``` +3. 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 + + * `keyrings.gauth.GooglePythonAuth (priority: 9)` + * `keyring.backends.chainer.ChainerBackend (priority: -1)` + * `keyring.backends.fail.Keyring (priority: 0)` + +## Usage with other tools + +### Usage with `tox` + +The [`tox` tool](https://pypi.org/project/tox/) is a testing and automation tool. + +Because the credential helper needs to be installed _before_ any private +dependencies are installed, it needs to be bootstrapped into the `tox` +environment via a plugin. + +To do this, specify the `keyrings.google-artifactregistry-auth` package via the +[`requires`](https://tox.readthedocs.io/en/latest/config.html#conf-requires) +requirement in your `tox.ini` file: + +```ini +[tox] +envlist = py +requires = keyrings.google-artifactregistry-auth + +[testenv] +deps = -r requirements.txt +``` + +You can then configure your `requirement.txt` file to use the Artifact Registry repo as +an extra index, and specify both public and private dependencies: + +``` +--extra-index-url https://[REGION]-python.pkg.dev/[PROJECT_ID]/[REPOSITORY]/simple + +# samplepackage will be installed directly from PyPI +samplepackage +# mypackage will be installed from the Artifact Registry repository +mypackage +``` + + +%prep +%autosetup -n keyrings.google-artifactregistry-auth-1.1.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-keyrings.google-artifactregistry-auth -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 1.1.2-1 +- Package Spec generated |
