Skip to content

Commit

Permalink
fix: remove dependency on pkg_resources (#361)
Browse files Browse the repository at this point in the history
Fixes #360 🦕
  • Loading branch information
parthea authored Apr 13, 2022
1 parent caba5f2 commit 523dbd0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 23 deletions.
8 changes: 4 additions & 4 deletions google/api_core/client_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import platform
from typing import Union

import pkg_resources

from google.api_core import version as api_core_version

_PY_VERSION = platform.python_version()
Expand All @@ -31,8 +29,10 @@
_GRPC_VERSION: Union[str, None]

try:
_GRPC_VERSION = pkg_resources.get_distribution("grpcio").version
except pkg_resources.DistributionNotFound: # pragma: NO COVER
import grpc

_GRPC_VERSION = grpc.__version__
except ImportError: # pragma: NO COVER
_GRPC_VERSION = None


Expand Down
9 changes: 0 additions & 9 deletions google/api_core/grpc_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import functools

import grpc
import pkg_resources

from google.api_core import exceptions
import google.auth
Expand All @@ -33,14 +32,6 @@
except ImportError:
HAS_GRPC_GCP = False

try:
# google.auth.__version__ was added in 1.26.0
_GOOGLE_AUTH_VERSION = google.auth.__version__
except AttributeError:
try: # try pkg_resources if it is available
_GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version
except pkg_resources.DistributionNotFound: # pragma: NO COVER
_GOOGLE_AUTH_VERSION = None

# The list of gRPC Callable interfaces that return iterators.
_STREAM_WRAP_CLASSES = (grpc.UnaryStreamMultiCallable, grpc.StreamStreamMultiCallable)
Expand Down
15 changes: 5 additions & 10 deletions google/api_core/operations_v1/transports/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,21 @@
import abc
from typing import Awaitable, Callable, Optional, Sequence, Union

import pkg_resources

import google.api_core # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
from google.api_core import version
import google.auth # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.longrunning import operations_pb2
from google.oauth2 import service_account # type: ignore
from google.protobuf import empty_pb2 # type: ignore

try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google.api_core.operations_v1",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()

DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=version.__version__,
)


class OperationsTransport(abc.ABC):
Expand Down

0 comments on commit 523dbd0

Please sign in to comment.