Skip to content

Commit af514f3

Browse files
committed
chore: Require protobuf >4.25.8
1 parent fb410f4 commit af514f3

File tree

3 files changed

+9
-60
lines changed

3 files changed

+9
-60
lines changed

google/api_core/grpc_helpers.py

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,7 @@
2727

2828
from google.api_core import exceptions, general_helpers
2929

30-
PROTOBUF_VERSION = google.protobuf.__version__
31-
32-
# The grpcio-gcp package only has support for protobuf < 4
33-
if PROTOBUF_VERSION[0:2] == "3.": # pragma: NO COVER
34-
try:
35-
import grpc_gcp
36-
37-
warnings.warn(
38-
"""Support for grpcio-gcp is deprecated. This feature will be
39-
removed from `google-api-core` after January 1, 2024. If you need to
40-
continue to use this feature, please pin to a specific version of
41-
`google-api-core`.""",
42-
DeprecationWarning,
43-
)
44-
HAS_GRPC_GCP = True
45-
except ImportError:
46-
HAS_GRPC_GCP = False
47-
else:
48-
HAS_GRPC_GCP = False
30+
HAS_GRPC_GCP = False
4931

5032

5133
# The list of gRPC Callable interfaces that return iterators.
@@ -366,8 +348,7 @@ def create_channel(
366348
result in `ValueError` as this combination is not yet supported.
367349
368350
kwargs: Additional key-word args passed to
369-
:func:`grpc_gcp.secure_channel` or :func:`grpc.secure_channel`.
370-
Note: `grpc_gcp` is only supported in environments with protobuf < 4.0.0.
351+
:func:`grpc.secure_channel`.
371352
372353
Returns:
373354
grpc.Channel: The created channel.
@@ -393,20 +374,6 @@ def create_channel(
393374
default_host=default_host,
394375
)
395376

396-
# Note that grpcio-gcp is deprecated
397-
if HAS_GRPC_GCP: # pragma: NO COVER
398-
if compression is not None and compression != grpc.Compression.NoCompression:
399-
warnings.warn(
400-
"The `compression` argument is ignored for grpc_gcp.secure_channel creation.",
401-
DeprecationWarning,
402-
)
403-
if attempt_direct_path:
404-
warnings.warn(
405-
"""The `attempt_direct_path` argument is ignored for grpc_gcp.secure_channel creation.""",
406-
DeprecationWarning,
407-
)
408-
return grpc_gcp.secure_channel(target, composite_credentials, **kwargs)
409-
410377
if attempt_direct_path:
411378
target = _modify_target_for_direct_path(target)
412379

noxfile.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -221,29 +221,16 @@ def default(session, install_grpc=True, prerelease=False, install_async_rest=Fal
221221

222222
@nox.session(python=PYTHON_VERSIONS)
223223
@nox.parametrize(
224-
["install_grpc_gcp", "install_grpc", "install_async_rest"],
224+
["install_grpc", "install_async_rest"],
225225
[
226-
(False, True, False), # Run unit tests with grpcio installed
227-
(True, True, False), # Run unit tests with grpcio/grpcio-gcp installed
228-
(False, False, False), # Run unit tests without grpcio installed
229-
(False, True, True), # Run unit tests with grpcio and async rest installed
226+
(True, False), # Run unit tests with grpcio installed
227+
(False, False), # Run unit tests without grpcio installed
228+
(True, True), # Run unit tests with grpcio and async rest installed
230229
],
231230
)
232231
def unit(session, install_grpc_gcp, install_grpc, install_async_rest):
233232
"""Run the unit test suite."""
234233

235-
# `grpcio-gcp` doesn't support protobuf 4+.
236-
# Remove extra `grpcgcp` when protobuf 3.x is dropped.
237-
# https://github.com/googleapis/python-api-core/issues/594
238-
if install_grpc_gcp:
239-
constraints_path = str(
240-
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
241-
)
242-
# Install grpcio-gcp
243-
session.install("-e", ".[grpcgcp]", "-c", constraints_path)
244-
# Install protobuf < 4.0.0
245-
session.install("protobuf<4.0.0")
246-
247234
default(
248235
session=session,
249236
install_grpc=install_grpc,

pyproject.toml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ classifiers = [
4545
]
4646
dependencies = [
4747
"googleapis-common-protos >= 1.56.2, < 2.0.0",
48-
"protobuf >= 3.19.5, < 7.0.0, != 3.20.0, != 3.20.1, != 4.21.0, != 4.21.1, != 4.21.2, != 4.21.3, != 4.21.4, != 4.21.5",
48+
"protobuf >= 4.25.8, < 7.0.0",
4949
"proto-plus >= 1.22.3, < 2.0.0",
5050
"proto-plus >= 1.25.0, < 2.0.0; python_version >= '3.13'",
5151
"google-auth >= 2.14.1, < 3.0.0",
@@ -67,8 +67,7 @@ grpc = [
6767
"grpcio-status >= 1.49.1, < 2.0.0; python_version >= '3.11'",
6868
"grpcio-status >= 1.75.1, < 2.0.0; python_version >= '3.14'",
6969
]
70-
grpcgcp = ["grpcio-gcp >= 0.2.2, < 1.0.0"]
71-
grpcio-gcp = ["grpcio-gcp >= 0.2.2, < 1.0.0"]
70+
7271

7372
[tool.setuptools.dynamic]
7473
version = { attr = "google.api_core.version.__version__" }
@@ -94,11 +93,7 @@ filterwarnings = [
9493
# Remove once https://github.com/protocolbuffers/protobuf/issues/12186 is fixed
9594
"ignore:.*custom tp_new.*in Python 3.14:DeprecationWarning",
9695

97-
# Remove once support for grpcio-gcp is deprecated
98-
# See https://github.com/googleapis/python-api-core/blob/42e8b6e6f426cab749b34906529e8aaf3f133d75/google/api_core/grpc_helpers.py#L39-L45
99-
"ignore:.*Support for grpcio-gcp is deprecated:DeprecationWarning",
100-
"ignore: The `compression` argument is ignored for grpc_gcp.secure_channel creation:DeprecationWarning",
101-
"ignore:The `attempt_direct_path` argument is ignored for grpc_gcp.secure_channel creation:DeprecationWarning",
96+
10297
# Remove once the minimum supported version of googleapis-common-protos is 1.62.0
10398
"ignore:.*pkg_resources.declare_namespace:DeprecationWarning",
10499
"ignore:.*pkg_resources is deprecated as an API:DeprecationWarning",

0 commit comments

Comments
 (0)