commit | a2cbc3245460e1ae1d310de6a2a4007d5a3a06b7 | [log] [tgz] |
---|---|---|
author | Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> | Tue Mar 16 14:56:02 2021 -0600 |
committer | GitHub <noreply@github.com> | Tue Mar 16 20:56:02 2021 +0000 |
tree | b100034eb66cafdfa44068c2b2928ef5aea6ea74 | |
parent | e87b1eca82ffc5ca9d2704b04656aa4e869547bf [diff] [blame] |
feat: expose library version at `google.auth.__version` (#683) Move the version from `setup.py` to `google/auth/version.py`. Same as https://github.com/googleapis/python-api-core/pull/80. (see https://github.com/googleapis/python-api-core/issues/27 for motivation). This is option 3 in https://packaging.python.org/guides/single-sourcing-package-version/. This unblocks a version check I'd like to add in https://github.com/googleapis/python-api-core/pull/134. Usage: ```py >>> import google.auth >>> google.auth.__version__ '1.25.0' ```
diff --git a/setup.py b/setup.py index 33089cb..16ba98c 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",