Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use version.py instead of pkg_resources.get_distribution #94

Merged
merged 5 commits into from Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions google/cloud/datastore/__init__.py
Expand Up @@ -55,10 +55,7 @@
"""


from pkg_resources import get_distribution

__version__ = get_distribution("google-cloud-datastore").version

from google.cloud.datastore.version import __version__
from google.cloud.datastore.batch import Batch
from google.cloud.datastore.client import Client
from google.cloud.datastore.entity import Entity
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/datastore/client.py
Expand Up @@ -21,7 +21,7 @@
from google.cloud._helpers import _LocalStack
from google.cloud._helpers import _determine_default_project as _base_default_project
from google.cloud.client import ClientWithProject
from google.cloud.datastore import __version__
from google.cloud.datastore.version import __version__
from google.cloud.datastore import helpers
from google.cloud.datastore._http import HTTPDatastoreAPI
from google.cloud.datastore.batch import Batch
Expand Down
15 changes: 15 additions & 0 deletions google/cloud/datastore/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__ = "1.15.1"
Expand Up @@ -17,7 +17,6 @@
"""Accesses the google.datastore.admin.v1 DatastoreAdmin API."""

import functools
import pkg_resources
import warnings

from google.oauth2 import service_account
Expand All @@ -43,10 +42,10 @@
from google.longrunning import operations_pb2
from google.protobuf import empty_pb2


_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution(
"google-cloud-datastore",
).version
version = {}
busunkim96 marked this conversation as resolved.
Show resolved Hide resolved
with open("../../datastore/version.py") as fp:
exec(fp.read(), version)
_GAPIC_LIBRARY_VERSION = version["__version__"]


class DatastoreAdminClient(object):
Expand Down
5 changes: 2 additions & 3 deletions google/cloud/datastore_v1/gapic/datastore_client.py
Expand Up @@ -36,11 +36,10 @@
from google.cloud.datastore_v1.proto import datastore_pb2_grpc
from google.cloud.datastore_v1.proto import entity_pb2
from google.cloud.datastore_v1.proto import query_pb2
from google.cloud.datastore.version import __version__


_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution(
"google-cloud-datastore",
).version
_GAPIC_LIBRARY_VERSION = __version__


class DatastoreClient(object):
Expand Down
6 changes: 5 additions & 1 deletion setup.py
Expand Up @@ -22,7 +22,11 @@

name = "google-cloud-datastore"
description = "Google Cloud Datastore API client library"
version = "1.15.1"
version = {}
with open("google/cloud/datastore/version.py") as fp:
exec(fp.read(), version)
version = version["__version__"]

# Should be one of:
# 'Development Status :: 3 - Alpha'
# 'Development Status :: 4 - Beta'
Expand Down