From 9a66968aefc2bfe4a66c8ea803d784abcbc826ce Mon Sep 17 00:00:00 2001 From: HemangChothani Date: Wed, 7 Oct 2020 17:14:17 +0530 Subject: [PATCH 1/2] fix: use version.py instead of pkg_resources.get_distribution --- google/cloud/bigquery/__init__.py | 4 ++-- google/cloud/bigquery/version.py | 15 +++++++++++++++ setup.py | 6 +++++- 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 google/cloud/bigquery/version.py diff --git a/google/cloud/bigquery/__init__.py b/google/cloud/bigquery/__init__.py index 89c5a3624..e83e70084 100644 --- a/google/cloud/bigquery/__init__.py +++ b/google/cloud/bigquery/__init__.py @@ -28,9 +28,9 @@ """ -from pkg_resources import get_distribution +from google.cloud.bigquery import version as bigquery_version -__version__ = get_distribution("google-cloud-bigquery").version +__version__ = bigquery_version.__version__ from google.cloud.bigquery.client import Client from google.cloud.bigquery.dataset import AccessEntry diff --git a/google/cloud/bigquery/version.py b/google/cloud/bigquery/version.py new file mode 100644 index 000000000..8b5d3328c --- /dev/null +++ b/google/cloud/bigquery/version.py @@ -0,0 +1,15 @@ +# Copyright 2020 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__ = "2.1.0" diff --git a/setup.py b/setup.py index 2cb57aad2..570538bec 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,11 @@ name = "google-cloud-bigquery" description = "Google BigQuery API client library" -version = "2.0.0" + +version = {} +with open("google/cloud/bigquery/version.py") as fp: + exec(fp.read(), version) +version = version["__version__"] # Should be one of: # 'Development Status :: 3 - Alpha' # 'Development Status :: 4 - Beta' From 4914fb1b97cfbcaf013a89b289675736e701b309 Mon Sep 17 00:00:00 2001 From: HemangChothani Date: Mon, 12 Oct 2020 17:44:50 +0530 Subject: [PATCH 2/2] fix: nit --- setup.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index d156c1385..be7296081 100644 --- a/setup.py +++ b/setup.py @@ -23,14 +23,6 @@ name = "google-cloud-bigquery" description = "Google BigQuery API client library" - -package_root = os.path.abspath(os.path.dirname(__file__)) - -version = {} -with open(os.path.join(package_root, "google/cloud/bigquery/version.py")) as fp: - exec(fp.read(), version) -version = version["__version__"] - # Should be one of: # 'Development Status :: 3 - Alpha' # 'Development Status :: 4 - Beta' @@ -91,6 +83,11 @@ with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() +version = {} +with open(os.path.join(package_root, "google/cloud/bigquery/version.py")) as fp: + exec(fp.read(), version) +version = version["__version__"] + # Only include packages under the 'google' namespace. Do not include tests, # benchmarks, etc. packages = [