Skip to content

Commit

Permalink
Removal of base 3.7 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ViridianForge committed Jun 30, 2024
1 parent 31f98b0 commit edc75cf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 43 deletions.
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ classifiers =
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Expand All @@ -29,7 +28,7 @@ classifiers =
packages = find:
package_dir = = src
include_package_data = true
python_requires = >= 3.7
python_requires = >= 3.8
# Dependencies are in setup.py for GitHub's dependency graph.

[options.packages.find]
Expand Down
25 changes: 6 additions & 19 deletions src/grpc_requests/aio.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
import sys
from contextlib import suppress
from enum import Enum
from functools import partial
Expand All @@ -15,8 +14,10 @@
Union,
)

import importlib.metadata
from typing import Protocol

import grpc
import warnings
from google.protobuf import (
descriptor_pb2,
message_factory,
Expand All @@ -39,23 +40,9 @@

logger = logging.getLogger(__name__)

if sys.version_info >= (3, 8):
import importlib.metadata
from typing import Protocol

def get_metadata(package_name: str):
return importlib.metadata.version(package_name)
else:
import pkg_resources
from typing_extensions import Protocol

warnings.warn(
"Support for Python 3.7 is deprecated and will be removed in version 0.1.19",
stacklevel=1,
)

def get_metadata(package_name: str):
return pkg_resources.get_distribution(package_name).version
def get_metadata(package_name: str):
return importlib.metadata.version(package_name)


# Import GetMessageClass if protobuf version supports it
Expand Down Expand Up @@ -687,7 +674,7 @@ def methods_meta(self):

_cached_clients: Dict[
str, Union[BaseAsyncClient, StubAsyncClient, ReflectionAsyncClient]
] = {} # Dict[str, AsyncClient] type (for 3.6,3.7 compatibility https://bugs.python.org/issue34939)
] = {}


def get_by_endpoint(endpoint, service_descriptors=None, **kwargs) -> AsyncClient:
Expand Down
31 changes: 9 additions & 22 deletions src/grpc_requests/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
import sys
from enum import Enum
from functools import partial
from typing import (
Expand All @@ -14,7 +13,6 @@
)

import grpc
import warnings
from google.protobuf import descriptor_pb2, message_factory
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf.descriptor import MethodDescriptor, ServiceDescriptor
Expand All @@ -24,26 +22,15 @@

from .utils import describe_descriptor, load_data

if sys.version_info >= (3, 8):
import importlib.metadata
from typing import (
Protocol,
TypedDict, # pylint: disable=no-name-in-module
)

def get_metadata(package_name: str):
return importlib.metadata.version(package_name)
else:
import pkg_resources
from typing_extensions import Protocol, TypedDict

warnings.warn(
"Support for Python 3.7 is deprecated and will be removed in version 0.1.19",
stacklevel=1,
)

def get_metadata(package_name: str):
return pkg_resources.get_distribution(package_name).version
import importlib.metadata
from typing import (
Protocol,
TypedDict, # pylint: disable=no-name-in-module
)


def get_metadata(package_name: str):
return importlib.metadata.version(package_name)


# Import GetMessageClass if protobuf version supports it
Expand Down

0 comments on commit edc75cf

Please sign in to comment.