From ff6b52ccbb3811dbc5adcb2c12f6d66fa4e8ef78 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Thu, 4 Feb 2021 22:05:58 +0000 Subject: [PATCH 1/2] feat: expose library version at google.auth.__version__ --- google/auth/__init__.py | 5 +++++ google/auth/version.py | 15 +++++++++++++++ setup.py | 8 +++++++- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 google/auth/version.py diff --git a/google/auth/__init__.py b/google/auth/__init__.py index 22d61c66f..9bee29d28 100644 --- a/google/auth/__init__.py +++ b/google/auth/__init__.py @@ -17,6 +17,11 @@ import logging from google.auth._default import default, load_credentials_from_file +from google.auth import version as google_auth_version + + +__version__ = google_auth_version.__version__ + __all__ = ["default", "load_credentials_from_file"] diff --git a/google/auth/version.py b/google/auth/version.py new file mode 100644 index 000000000..54ad93268 --- /dev/null +++ b/google/auth/version.py @@ -0,0 +1,15 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +__version__ = "1.27.1" diff --git a/setup.py b/setup.py index 33089cb71..16ba98cfd 100644 --- a/setup.py +++ b/setup.py @@ -13,6 +13,7 @@ # limitations under the License. import io +import os from setuptools import find_packages from setuptools import setup @@ -37,7 +38,12 @@ with io.open("README.rst", "r") as fh: long_description = fh.read() -version = "1.27.1" +package_root = os.path.abspath(os.path.dirname(__file__)) + +version = {} +with open(os.path.join(package_root, "google/auth/version.py")) as fp: + exec(fp.read(), version) +version = version["__version__"] setup( name="google-auth", From 3fc6de1815d02353b49071477b07f622c9074356 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Thu, 4 Feb 2021 22:25:49 +0000 Subject: [PATCH 2/2] chore: fix lint --- google/auth/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google/auth/__init__.py b/google/auth/__init__.py index 9bee29d28..861abe7ea 100644 --- a/google/auth/__init__.py +++ b/google/auth/__init__.py @@ -16,8 +16,8 @@ import logging -from google.auth._default import default, load_credentials_from_file from google.auth import version as google_auth_version +from google.auth._default import default, load_credentials_from_file __version__ = google_auth_version.__version__