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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: require python >= 3.6 #139

Merged
merged 7 commits into from Jan 28, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 1 addition & 5 deletions README.rst
Expand Up @@ -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
24 changes: 0 additions & 24 deletions google/__init__.py

This file was deleted.

4 changes: 3 additions & 1 deletion google/api_core/future/polling.py
Expand Up @@ -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
Expand Down
10 changes: 3 additions & 7 deletions google/api_core/gapic_v1/__init__.py
Expand Up @@ -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"]
5 changes: 0 additions & 5 deletions google/api_core/gapic_v1/routing_header.py
Expand Up @@ -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"
Expand All @@ -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.
Expand Down
7 changes: 1 addition & 6 deletions google/api_core/iam.py
Expand Up @@ -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"
Expand Down
8 changes: 2 additions & 6 deletions google/api_core/operations_v1/__init__.py
Expand Up @@ -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"]
6 changes: 1 addition & 5 deletions google/api_core/protobuf_helpers.py
Expand Up @@ -15,18 +15,14 @@
"""Helpers for :mod:`protobuf`."""

import collections
from collections import abc as collections_abc
import copy
import inspect

from google.protobuf import field_mask_pb2
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 = (
Expand Down
2 changes: 1 addition & 1 deletion google/api_core/version.py
Expand Up @@ -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"
4 changes: 2 additions & 2 deletions noxfile.py
Expand Up @@ -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(
Expand Down
19 changes: 5 additions & 14 deletions setup.py
Expand Up @@ -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",
Expand All @@ -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,
Expand All @@ -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",
Expand All @@ -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,
)