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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove dependency on pkg_resources #361

Merged
merged 3 commits into from Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions google/api_core/client_info.py
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__
parthea marked this conversation as resolved.
Show resolved Hide resolved
except ImportError: # pragma: NO COVER
_GRPC_VERSION = None


Expand Down
9 changes: 0 additions & 9 deletions google/api_core/grpc_helpers.py
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
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