Skip to content

Commit

Permalink
fix: use version.py instead of pkg_resources.get_distribution (#307)
Browse files Browse the repository at this point in the history
* fix: use version.py instead of pkg_resources.get_distribution

* fix: nit
  • Loading branch information
HemangChothani committed Oct 12, 2020
1 parent 35627d1 commit b8f502b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
4 changes: 2 additions & 2 deletions google/cloud/bigquery/__init__.py
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions 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"
7 changes: 6 additions & 1 deletion setup.py
Expand Up @@ -22,7 +22,7 @@

name = "google-cloud-bigquery"
description = "Google BigQuery API client library"
version = "2.1.0"

# Should be one of:
# 'Development Status :: 3 - Alpha'
# 'Development Status :: 4 - Beta'
Expand Down Expand Up @@ -83,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 = [
Expand Down

0 comments on commit b8f502b

Please sign in to comment.