Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions sdks/python/gen_protos.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import argparse
import contextlib
import glob
import importlib.resources
import inspect
import logging
import os
Expand All @@ -31,8 +32,6 @@
from collections import defaultdict
from importlib import import_module

import pkg_resources

LOG = logging.getLogger()
LOG.setLevel(logging.INFO)

Expand Down Expand Up @@ -474,7 +473,7 @@ def generate_proto_files(force=False):

protoc_gen_mypy = _find_protoc_gen_mypy()
from grpc_tools import protoc
builtin_protos = pkg_resources.resource_filename('grpc_tools', '_proto')
builtin_protos = importlib.resources.files('grpc_tools') / '_proto'
args = (
[sys.executable] + # expecting to be called from command line
['--proto_path=%s' % builtin_protos] +
Expand Down
18 changes: 12 additions & 6 deletions sdks/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@

# pylint: disable=ungrouped-imports
import setuptools
from pkg_resources import normalize_path
from pkg_resources import parse_version
from pkg_resources import to_filename
from packaging.version import parse
from setuptools import Command

# pylint: disable=wrong-import-order
Expand All @@ -43,6 +41,14 @@
from distutils.errors import DistutilsError # isort:skip


def to_filename(name: str) -> str:
return name.replace('-', '_')


def normalize_path(filename):
return os.path.normcase(os.path.realpath(os.path.normpath(filename)))


class mypy(Command):
user_options = []

Expand Down Expand Up @@ -101,7 +107,7 @@ def get_version():
RECOMMENDED_MIN_PIP_VERSION = '19.3.0'
try:
_PIP_VERSION = distribution('pip').version
if parse_version(_PIP_VERSION) < parse_version(RECOMMENDED_MIN_PIP_VERSION):
if parse(_PIP_VERSION) < parse(RECOMMENDED_MIN_PIP_VERSION):
warnings.warn(
"You are using version {0} of pip. " \
"However, the recommended min version is {1}.".format(
Expand All @@ -116,7 +122,7 @@ def get_version():
REQUIRED_CYTHON_VERSION = '3.0.0'
try:
_CYTHON_VERSION = distribution('cython').version
if parse_version(_CYTHON_VERSION) < parse_version(REQUIRED_CYTHON_VERSION):
if parse(_CYTHON_VERSION) < parse(REQUIRED_CYTHON_VERSION):
warnings.warn(
"You are using version {0} of cython. " \
"However, version {1} is recommended.".format(
Expand Down Expand Up @@ -355,7 +361,7 @@ def get_portability_package_data():
'fasteners>=0.3,<1.0',
# TODO(https://github.com/grpc/grpc/issues/37710): Unpin grpc
'grpcio>=1.33.1,<2,!=1.48.0,!=1.59.*,!=1.60.*,!=1.61.*,!=1.62.0,!=1.62.1,<1.66.0; python_version <= "3.12"', # pylint: disable=line-too-long
'grpcio>=1.67.0; python_version >= "3.13"',
'grpcio>=1.67.0; python_version >= "3.13"',
'hdfs>=2.1.0,<3.0.0',
'httplib2>=0.8,<0.23.0',
'jsonschema>=4.0.0,<5.0.0',
Expand Down
Loading