From 7aca6d4007f2892c74183d70af58336e61076860 Mon Sep 17 00:00:00 2001 From: Xuan Wang Date: Mon, 17 Oct 2022 09:34:45 -0700 Subject: [PATCH] [Remove Six] Remove dependency on six (#31340) * [Python][Remove Six] Remove Six from requirements --- bazel/grpc_python_deps.bzl | 12 ------------ examples/python/cancellation/BUILD.bazel | 1 - requirements.bazel.txt | 1 - requirements.txt | 1 - setup.py | 5 +---- src/python/grpcio/grpc/BUILD.bazel | 1 - .../grpcio/grpc/framework/foundation/BUILD.bazel | 12 +++--------- .../grpc/framework/interfaces/base/BUILD.bazel | 1 - .../grpc/framework/interfaces/face/BUILD.bazel | 1 - src/python/grpcio_tests/setup.py | 4 ++-- src/python/grpcio_tests/tests/csds/BUILD.bazel | 1 - src/python/grpcio_tests/tests/unit/BUILD.bazel | 2 -- src/python/grpcio_tests/tests_aio/unit/BUILD.bazel | 1 - .../grpcio_tests/tests_py3_only/unit/BUILD.bazel | 1 - .../helper_scripts/prepare_build_linux_rc | 2 -- .../helper_scripts/prepare_build_macos_rc | 2 +- .../helper_scripts/prepare_build_windows.bat | 2 +- 17 files changed, 8 insertions(+), 42 deletions(-) diff --git a/bazel/grpc_python_deps.bzl b/bazel/grpc_python_deps.bzl index c88526e531e..35f1ab2901d 100644 --- a/bazel/grpc_python_deps.bzl +++ b/bazel/grpc_python_deps.bzl @@ -19,18 +19,6 @@ load("@com_github_grpc_grpc//third_party/py:python_configure.bzl", "python_confi # buildifier: disable=unnamed-macro def grpc_python_deps(): """Loads dependencies for gRPC Python.""" - - # protobuf binds to the name "six", so we can't use it here. - # See https://github.com/bazelbuild/bazel/issues/1952 for why bind is - # horrible. - if "six" not in native.existing_rules(): - http_archive( - name = "six", - build_file = "@com_github_grpc_grpc//third_party:six.BUILD", - sha256 = "1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", - urls = ["https://files.pythonhosted.org/packages/71/39/171f1c67cd00715f190ba0b100d606d440a28c93c7714febeca8b79af85e/six-1.16.0.tar.gz"], - ) - if "enum34" not in native.existing_rules(): http_archive( name = "enum34", diff --git a/examples/python/cancellation/BUILD.bazel b/examples/python/cancellation/BUILD.bazel index 1c23a390512..2c00d23ac27 100644 --- a/examples/python/cancellation/BUILD.bazel +++ b/examples/python/cancellation/BUILD.bazel @@ -44,7 +44,6 @@ py_binary( ":hash_name_py_pb2", ":hash_name_py_pb2_grpc", "//src/python/grpcio/grpc:grpcio", - "@six", ], ) diff --git a/requirements.bazel.txt b/requirements.bazel.txt index 432d04475fc..4d993add214 100644 --- a/requirements.bazel.txt +++ b/requirements.bazel.txt @@ -3,7 +3,6 @@ coverage==4.5.4 cython==0.29.21 enum34==1.1.10 protobuf>=3.5.0.post1, < 4.0dev -six==1.16.0 wheel==0.36.2 futures==3.1.1 google-auth==1.24.0 diff --git a/requirements.txt b/requirements.txt index 32eec1a35fe..603db125747 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,5 +2,4 @@ coverage>=4.0 cython>=0.29.8 protobuf>=4.21.3,<5.0dev -six>=1.10 wheel>=0.29 diff --git a/setup.py b/setup.py index 3a50c975d8b..2ff1518ac5a 100644 --- a/setup.py +++ b/setup.py @@ -482,7 +482,6 @@ PACKAGE_DIRECTORIES = { } INSTALL_REQUIRES = ( - "six>=1.5.2", "futures>=2.2.0; python_version<'3.2'", "enum34>=1.0.4; python_version<'3.4'", ) @@ -491,9 +490,7 @@ EXTRAS_REQUIRES = { } SETUP_REQUIRES = INSTALL_REQUIRES + ( - 'Sphinx~=1.8.1', - 'six>=1.10', -) if ENABLE_DOCUMENTATION_BUILD else () + 'Sphinx~=1.8.1',) if ENABLE_DOCUMENTATION_BUILD else () try: import Cython diff --git a/src/python/grpcio/grpc/BUILD.bazel b/src/python/grpcio/grpc/BUILD.bazel index dd4a5fbe1df..f5d0b038bc2 100644 --- a/src/python/grpcio/grpc/BUILD.bazel +++ b/src/python/grpcio/grpc/BUILD.bazel @@ -110,7 +110,6 @@ py_library( "//src/python/grpcio/grpc/_cython:cygrpc", "//src/python/grpcio/grpc/experimental", "//src/python/grpcio/grpc/framework", - "@six//:six", ] + select({ "//conditions:default": ["@enum34//:enum34"], "//:python3": [], diff --git a/src/python/grpcio/grpc/framework/foundation/BUILD.bazel b/src/python/grpcio/grpc/framework/foundation/BUILD.bazel index c90a225cff2..bae480df252 100644 --- a/src/python/grpcio/grpc/framework/foundation/BUILD.bazel +++ b/src/python/grpcio/grpc/framework/foundation/BUILD.bazel @@ -34,9 +34,7 @@ py_library( py_library( name = "callable_util", srcs = ["callable_util.py"], - deps = [ - "@six//:six", - ] + select({ + deps = select({ "//conditions:default": ["@enum34//:enum34"], "//:python3": [], }), @@ -45,9 +43,7 @@ py_library( py_library( name = "future", srcs = ["future.py"], - deps = [ - "@six", - ], + deps = [], ) py_library( @@ -70,7 +66,5 @@ py_library( py_library( name = "stream", srcs = ["stream.py"], - deps = [ - "@six", - ], + deps = [], ) diff --git a/src/python/grpcio/grpc/framework/interfaces/base/BUILD.bazel b/src/python/grpcio/grpc/framework/interfaces/base/BUILD.bazel index 98a1c5f7d05..975bc0e9f43 100644 --- a/src/python/grpcio/grpc/framework/interfaces/base/BUILD.bazel +++ b/src/python/grpcio/grpc/framework/interfaces/base/BUILD.bazel @@ -27,7 +27,6 @@ py_library( srcs = ["base.py"], deps = [ "//src/python/grpcio/grpc/framework/foundation:abandonment", - "@six//:six", ] + select({ "//conditions:default": ["@enum34//:enum34"], "//:python3": [], diff --git a/src/python/grpcio/grpc/framework/interfaces/face/BUILD.bazel b/src/python/grpcio/grpc/framework/interfaces/face/BUILD.bazel index 19f764f64b4..370d2e33431 100644 --- a/src/python/grpcio/grpc/framework/interfaces/face/BUILD.bazel +++ b/src/python/grpcio/grpc/framework/interfaces/face/BUILD.bazel @@ -28,7 +28,6 @@ py_library( deps = [ "//src/python/grpcio/grpc/framework/foundation", "//src/python/grpcio/grpc/framework/common", - "@six//:six", ] + select({ "//conditions:default": ["@enum34//:enum34"], "//:python3": [], diff --git a/src/python/grpcio_tests/setup.py b/src/python/grpcio_tests/setup.py index 0abd38bb3d1..a0fc32fe8d5 100644 --- a/src/python/grpcio_tests/setup.py +++ b/src/python/grpcio_tests/setup.py @@ -42,8 +42,8 @@ INSTALL_REQUIRES = ( 'grpcio-status>={version}'.format(version=grpc_version.VERSION), 'grpcio-tools>={version}'.format(version=grpc_version.VERSION), 'grpcio-health-checking>={version}'.format(version=grpc_version.VERSION), - 'oauth2client>=1.4.7', 'protobuf>=4.21.6', 'six>=1.10', - 'google-auth>=1.17.2', 'requests>=2.14.2') + 'oauth2client>=1.4.7', 'protobuf>=4.21.6', 'google-auth>=1.17.2', + 'requests>=2.14.2') if not PY3: INSTALL_REQUIRES += ('futures>=2.2.0', 'enum34>=1.0.4') diff --git a/src/python/grpcio_tests/tests/csds/BUILD.bazel b/src/python/grpcio_tests/tests/csds/BUILD.bazel index cc9fbbded52..07b684007c9 100644 --- a/src/python/grpcio_tests/tests/csds/BUILD.bazel +++ b/src/python/grpcio_tests/tests/csds/BUILD.bazel @@ -21,6 +21,5 @@ py_test( deps = [ "//src/python/grpcio/grpc:grpcio", "//src/python/grpcio_csds/grpc_csds", - "@six", ], ) diff --git a/src/python/grpcio_tests/tests/unit/BUILD.bazel b/src/python/grpcio_tests/tests/unit/BUILD.bazel index 2d2a246ed47..400db0fb55b 100644 --- a/src/python/grpcio_tests/tests/unit/BUILD.bazel +++ b/src/python/grpcio_tests/tests/unit/BUILD.bazel @@ -131,7 +131,6 @@ py_library( "//src/python/grpcio/grpc:grpcio", "//src/python/grpcio_tests/tests/testing", "//src/python/grpcio_tests/tests/unit/framework/common", - "@six", ], ) for test_file_name in GRPCIO_TESTS_UNIT @@ -152,6 +151,5 @@ internal_py_grpc_test( "//src/python/grpcio/grpc:grpcio", "//src/python/grpcio_tests/tests/testing", "//tools/distrib/python/grpcio_tools:grpc_tools", - "@six", ], ) diff --git a/src/python/grpcio_tests/tests_aio/unit/BUILD.bazel b/src/python/grpcio_tests/tests_aio/unit/BUILD.bazel index 1847e9cff6e..580cfca60f3 100644 --- a/src/python/grpcio_tests/tests_aio/unit/BUILD.bazel +++ b/src/python/grpcio_tests/tests_aio/unit/BUILD.bazel @@ -79,7 +79,6 @@ _FLAKY_TESTS = [ "//src/python/grpcio/grpc:grpcio", "//src/python/grpcio_tests/tests/unit:resources", "//src/python/grpcio_tests/tests/unit/framework/common", - "@six", ], ) for test_file_name in GRPC_ASYNC_TESTS diff --git a/src/python/grpcio_tests/tests_py3_only/unit/BUILD.bazel b/src/python/grpcio_tests/tests_py3_only/unit/BUILD.bazel index 81b66ddc116..86b4b02c429 100644 --- a/src/python/grpcio_tests/tests_py3_only/unit/BUILD.bazel +++ b/src/python/grpcio_tests/tests_py3_only/unit/BUILD.bazel @@ -34,7 +34,6 @@ GRPCIO_PY3_ONLY_TESTS_UNIT = glob([ "//src/python/grpcio_tests/tests/unit:resources", "//src/python/grpcio_tests/tests/unit:test_common", "//src/python/grpcio_tests/tests/unit/framework/common", - "@six", ], ) for test_file_name in GRPCIO_PY3_ONLY_TESTS_UNIT diff --git a/tools/internal_ci/helper_scripts/prepare_build_linux_rc b/tools/internal_ci/helper_scripts/prepare_build_linux_rc index d544f17cb74..8542fcf905e 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_linux_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_linux_rc @@ -41,8 +41,6 @@ export DOCKERHUB_ORGANIZATION=grpctesting git submodule update --init -python3 -m pip install six - # check whether /tmpfs is mounted correctly (mount | grep -q 'on /tmpfs ') || (mount; echo 'BAD KOKORO WORKER WARNING: it seems that /tmpfs volume with scratch disk is not mounted in the kokoro worker. This can result in unexpected "out of disk space" errors.') diff --git a/tools/internal_ci/helper_scripts/prepare_build_macos_rc b/tools/internal_ci/helper_scripts/prepare_build_macos_rc index 971beb9202c..1b09ce55244 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_macos_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_macos_rc @@ -48,7 +48,7 @@ export HOMEBREW_NO_AUTO_UPDATE=1 brew config # Add GCP credentials for BQ access -pip install --user google-api-python-client oauth2client six==1.16.0 +pip install --user google-api-python-client oauth2client export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" diff --git a/tools/internal_ci/helper_scripts/prepare_build_windows.bat b/tools/internal_ci/helper_scripts/prepare_build_windows.bat index 2a4ab062eec..9fcb6abd368 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_windows.bat +++ b/tools/internal_ci/helper_scripts/prepare_build_windows.bat @@ -85,7 +85,7 @@ If "%PREPARE_BUILD_INSTALL_DEPS_PYTHON%" == "true" ( ) @rem Needed for uploading test results to bigquery -python -m pip install google-api-python-client oauth2client six==1.16.0 || goto :error +python -m pip install google-api-python-client oauth2client || goto :error git submodule update --init || goto :error