diff --git a/README.rst b/README.rst index 244043ea..d4bffd57 100644 --- a/README.rst +++ b/README.rst @@ -16,8 +16,4 @@ common helpers used by all Google API clients. For more information, see the Supported Python Versions ------------------------- -Python >= 3.5 - -Deprecated Python Versions --------------------------- -Python == 2.7. Python 2.7 support will be removed on January 1, 2020. +Python >= 3.6 diff --git a/google/__init__.py b/google/__init__.py deleted file mode 100644 index 0d0a4c3a..00000000 --- a/google/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2016 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google namespace package.""" - -try: - import pkg_resources - - pkg_resources.declare_namespace(__name__) -except ImportError: - import pkgutil - - __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/google/api_core/future/polling.py b/google/api_core/future/polling.py index 6466838f..fa8f6d71 100644 --- a/google/api_core/future/polling.py +++ b/google/api_core/future/polling.py @@ -38,7 +38,9 @@ class _OperationNotComplete(Exception): DEFAULT_RETRY = retry.Retry(predicate=RETRY_PREDICATE) -class PollingFuture(base.Future): +# pytype incorrectly determines that this class is not abstract +# and errors on the @abstractmethod annotation on done(). +class PollingFuture(base.Future): # pytype: disable=ignored-abstractmethod """A Future that needs to poll some service to check its status. The :meth:`done` method should be implemented by subclasses. The polling diff --git a/google/api_core/gapic_v1/__init__.py b/google/api_core/gapic_v1/__init__.py index ed95da13..9becfc46 100644 --- a/google/api_core/gapic_v1/__init__.py +++ b/google/api_core/gapic_v1/__init__.py @@ -12,17 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys from google.api_core.gapic_v1 import client_info from google.api_core.gapic_v1 import config +from google.api_core.gapic_v1 import config_async from google.api_core.gapic_v1 import method +from google.api_core.gapic_v1 import method_async from google.api_core.gapic_v1 import routing_header -__all__ = ["client_info", "config", "method", "routing_header"] -if sys.version_info >= (3, 6): - from google.api_core.gapic_v1 import config_async # noqa: F401 - from google.api_core.gapic_v1 import method_async # noqa: F401 - __all__.append("config_async") - __all__.append("method_async") +__all__ = ["client_info", "config", "method", "routing_header", "config_async", "method_async"] diff --git a/google/api_core/gapic_v1/routing_header.py b/google/api_core/gapic_v1/routing_header.py index 3fb12a6f..21c86ec9 100644 --- a/google/api_core/gapic_v1/routing_header.py +++ b/google/api_core/gapic_v1/routing_header.py @@ -20,8 +20,6 @@ Generally, these headers are specified as gRPC metadata. """ -import sys - from six.moves.urllib.parse import urlencode ROUTING_METADATA_KEY = "x-goog-request-params" @@ -37,9 +35,6 @@ def to_routing_header(params): Returns: str: The routing header string. """ - if sys.version_info[0] < 3: - # Python 2 does not have the "safe" parameter for urlencode. - return urlencode(params).replace("%2F", "/") return urlencode( params, # Per Google API policy (go/api-url-encoding), / is not encoded. diff --git a/google/api_core/iam.py b/google/api_core/iam.py index f1309360..49c0334e 100644 --- a/google/api_core/iam.py +++ b/google/api_core/iam.py @@ -51,15 +51,10 @@ resource.set_iam_policy(policy) """ -import collections +from collections import abc as collections_abc import operator import warnings -try: - from collections import abc as collections_abc -except ImportError: # Python 2.7 - import collections as collections_abc - # Generic IAM roles OWNER_ROLE = "roles/owner" diff --git a/google/api_core/operations_v1/__init__.py b/google/api_core/operations_v1/__init__.py index bc9befcb..fd54b385 100644 --- a/google/api_core/operations_v1/__init__.py +++ b/google/api_core/operations_v1/__init__.py @@ -14,11 +14,7 @@ """Package for interacting with the google.longrunning.operations meta-API.""" -import sys - +from google.api_core.operations_v1.operations_async_client import OperationsAsyncClient from google.api_core.operations_v1.operations_client import OperationsClient -__all__ = ["OperationsClient"] -if sys.version_info >= (3, 6, 0): - from google.api_core.operations_v1.operations_async_client import OperationsAsyncClient # noqa: F401 - __all__.append("OperationsAsyncClient") +__all__ = ["OperationsClient", "OperationsAsyncClient"] diff --git a/google/api_core/protobuf_helpers.py b/google/api_core/protobuf_helpers.py index 365ef25c..33094ee6 100644 --- a/google/api_core/protobuf_helpers.py +++ b/google/api_core/protobuf_helpers.py @@ -15,6 +15,7 @@ """Helpers for :mod:`protobuf`.""" import collections +from collections import abc as collections_abc import copy import inspect @@ -22,11 +23,6 @@ from google.protobuf import message from google.protobuf import wrappers_pb2 -try: - from collections import abc as collections_abc -except ImportError: # Python 2.7 - import collections as collections_abc - _SENTINEL = object() _WRAPPER_TYPES = ( diff --git a/google/api_core/version.py b/google/api_core/version.py index 5966ec4e..258353a0 100644 --- a/google/api_core/version.py +++ b/google/api_core/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.25.1" +__version__ = "1.26.0dev1" diff --git a/noxfile.py b/noxfile.py index 650cef28..6f9e61d1 100644 --- a/noxfile.py +++ b/noxfile.py @@ -77,13 +77,13 @@ def default(session): session.run(*pytest_args) -@nox.session(python=["2.7", "3.6", "3.7", "3.8", "3.9"]) +@nox.session(python=["3.6", "3.7", "3.8", "3.9"]) def unit(session): """Run the unit test suite.""" default(session) -@nox.session(python=["2.7", "3.6", "3.7", "3.8", "3.9"]) +@nox.session(python=["3.6", "3.7", "3.8", "3.9"]) def unit_grpc_gcp(session): """Run the unit test suite with grpcio-gcp installed.""" constraints_path = str( diff --git a/setup.py b/setup.py index 30adb954..ab94ba16 100644 --- a/setup.py +++ b/setup.py @@ -31,12 +31,11 @@ dependencies = [ "googleapis-common-protos >= 1.6.0, < 2.0dev", "protobuf >= 3.12.0", - "google-auth >= 1.21.1, < 2.0dev", + "google-auth >= 1.21.1, < 3.0dev", "requests >= 2.18.0, < 3.0.0dev", "setuptools >= 40.3.0", "six >= 1.13.0", "pytz", - 'futures >= 3.2.0; python_version < "3.2"', ] extras = { "grpc": "grpcio >= 1.29.0, < 2.0dev", @@ -62,15 +61,11 @@ # Only include packages under the 'google' namespace. Do not include tests, # benchmarks, etc. packages = [ - package for package in setuptools.find_packages() if package.startswith("google") + package + for package in setuptools.PEP420PackageFinder.find() + if package.startswith("google") ] -# Determine which namespaces are needed. -namespaces = ["google"] -if "google.cloud" in packages: - namespaces.append("google.cloud") - - setuptools.setup( name=name, version=version, @@ -85,10 +80,7 @@ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", @@ -98,10 +90,9 @@ ], platforms="Posix; MacOS X; Windows", packages=packages, - namespace_packages=namespaces, install_requires=dependencies, extras_require=extras, - python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*", + python_requires=">=3.6", include_package_data=True, zip_safe=False, )