Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
345ed00
chore: remove support for Python 3.7 and 3.8
vchudnov-g Dec 4, 2025
e7d5849
chore: format
vchudnov-g Dec 4, 2025
00bacfc
fix `nox -s prerelease_deps` by adding dependencies to noxfile
vchudnov-g Dec 5, 2025
d91d4b1
chore: Use async mock in async test
vchudnov-g Dec 5, 2025
063991a
chore: Simplify code intended for Python 3.9+
vchudnov-g Dec 5, 2025
e6ab415
chore: remove unused import
vchudnov-g Dec 5, 2025
fa50b6a
chore:remove unused import; cosmetic
vchudnov-g Dec 5, 2025
02bdd5d
exclude coverage calculations on some exceptional lines
vchudnov-g Dec 5, 2025
e420f47
fix coverage: runder under proto 4.x
vchudnov-g Dec 5, 2025
6c2206c
test(proto-4.25.8): Fix to run on supported Python version (3.11)
vchudnov-g Dec 5, 2025
f9f4e7f
Have nox run the legacy protobuf test
vchudnov-g Dec 5, 2025
cf8c92a
fix coverage file names
vchudnov-g Dec 5, 2025
90cff72
don't worry about covering unit test
vchudnov-g Dec 5, 2025
39992e3
Cover legacy protobuf tests
vchudnov-g Dec 5, 2025
fb410f4
fix session skip in test
vchudnov-g Dec 5, 2025
371d27e
chore: require protobuf ≥ 4.25.8
vchudnov-g Dec 5, 2025
f9ce257
feat: warn users of upcoming minimum protobuf 5.0.0 requirement
vchudnov-g Dec 5, 2025
2a57035
chore: Pin depencies to lower bounds in constraints for lowest Python…
vchudnov-g Dec 8, 2025
0f9589e
chore: bumpgoogleapis-common-protos to vbersion supporting protobuf 4.x
vchudnov-g Dec 8, 2025
f4decd5
chjore: Update minimum version of google-auth to 2.35.0
vchudnov-g Dec 8, 2025
c506726
chore: require requests ≥ 2.20.0
vchudnov-g Dec 8, 2025
5ebe08d
chore: try removing NO COVER pragmas
vchudnov-g Dec 8, 2025
fe43df7
restore one NO COVER pragma
vchudnov-g Dec 8, 2025
b1b5822
clean up removed pragmas
vchudnov-g Dec 8, 2025
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
Prev Previous commit
Next Next commit
chore: require protobuf ≥ 4.25.8
  • Loading branch information
vchudnov-g committed Dec 5, 2025
commit 371d27e52588482c3ce34f77c29b0ca70260a3b4
37 changes: 2 additions & 35 deletions google/api_core/grpc_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,7 @@

from google.api_core import exceptions, general_helpers

PROTOBUF_VERSION = google.protobuf.__version__

# The grpcio-gcp package only has support for protobuf < 4
if PROTOBUF_VERSION[0:2] == "3.": # pragma: NO COVER
try:
import grpc_gcp

warnings.warn(
"""Support for grpcio-gcp is deprecated. This feature will be
removed from `google-api-core` after January 1, 2024. If you need to
continue to use this feature, please pin to a specific version of
`google-api-core`.""",
DeprecationWarning,
)
HAS_GRPC_GCP = True
except ImportError:
HAS_GRPC_GCP = False
else:
HAS_GRPC_GCP = False
HAS_GRPC_GCP = False


# The list of gRPC Callable interfaces that return iterators.
Expand Down Expand Up @@ -366,8 +348,7 @@ def create_channel(
result in `ValueError` as this combination is not yet supported.

kwargs: Additional key-word args passed to
:func:`grpc_gcp.secure_channel` or :func:`grpc.secure_channel`.
Note: `grpc_gcp` is only supported in environments with protobuf < 4.0.0.
:func:`grpc.secure_channel`.

Returns:
grpc.Channel: The created channel.
Expand All @@ -393,20 +374,6 @@ def create_channel(
default_host=default_host,
)

# Note that grpcio-gcp is deprecated
if HAS_GRPC_GCP: # pragma: NO COVER
if compression is not None and compression != grpc.Compression.NoCompression:
warnings.warn(
"The `compression` argument is ignored for grpc_gcp.secure_channel creation.",
DeprecationWarning,
)
if attempt_direct_path:
warnings.warn(
"""The `attempt_direct_path` argument is ignored for grpc_gcp.secure_channel creation.""",
DeprecationWarning,
)
return grpc_gcp.secure_channel(target, composite_credentials, **kwargs)

if attempt_direct_path:
target = _modify_target_for_direct_path(target)

Expand Down
23 changes: 5 additions & 18 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,29 +221,16 @@ def default(session, install_grpc=True, prerelease=False, install_async_rest=Fal

@nox.session(python=PYTHON_VERSIONS)
@nox.parametrize(
["install_grpc_gcp", "install_grpc", "install_async_rest"],
["install_grpc", "install_async_rest"],
[
(False, True, False), # Run unit tests with grpcio installed
(True, True, False), # Run unit tests with grpcio/grpcio-gcp installed
(False, False, False), # Run unit tests without grpcio installed
(False, True, True), # Run unit tests with grpcio and async rest installed
(True, False), # Run unit tests with grpcio installed
(False, False), # Run unit tests without grpcio installed
(True, True), # Run unit tests with grpcio and async rest installed
],
)
def unit(session, install_grpc_gcp, install_grpc, install_async_rest):
def unit(session, install_grpc, install_async_rest):
"""Run the unit test suite."""

# `grpcio-gcp` doesn't support protobuf 4+.
# Remove extra `grpcgcp` when protobuf 3.x is dropped.
# https://github.com/googleapis/python-api-core/issues/594
if install_grpc_gcp:
constraints_path = str(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
)
# Install grpcio-gcp
session.install("-e", ".[grpcgcp]", "-c", constraints_path)
# Install protobuf < 4.0.0
session.install("protobuf<4.0.0")

default(
session=session,
install_grpc=install_grpc,
Expand Down
11 changes: 3 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ classifiers = [
]
dependencies = [
"googleapis-common-protos >= 1.56.2, < 2.0.0",
"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",
"protobuf >= 4.25.8, < 7.0.0",
"proto-plus >= 1.22.3, < 2.0.0",
"proto-plus >= 1.25.0, < 2.0.0; python_version >= '3.13'",
"google-auth >= 2.14.1, < 3.0.0",
Expand All @@ -67,8 +67,7 @@ grpc = [
"grpcio-status >= 1.49.1, < 2.0.0; python_version >= '3.11'",
"grpcio-status >= 1.75.1, < 2.0.0; python_version >= '3.14'",
]
grpcgcp = ["grpcio-gcp >= 0.2.2, < 1.0.0"]
grpcio-gcp = ["grpcio-gcp >= 0.2.2, < 1.0.0"]


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

# Remove once support for grpcio-gcp is deprecated
# See https://github.com/googleapis/python-api-core/blob/42e8b6e6f426cab749b34906529e8aaf3f133d75/google/api_core/grpc_helpers.py#L39-L45
"ignore:.*Support for grpcio-gcp is deprecated:DeprecationWarning",
"ignore: The `compression` argument is ignored for grpc_gcp.secure_channel creation:DeprecationWarning",
"ignore:The `attempt_direct_path` argument is ignored for grpc_gcp.secure_channel creation:DeprecationWarning",

# Remove once the minimum supported version of googleapis-common-protos is 1.62.0
"ignore:.*pkg_resources.declare_namespace:DeprecationWarning",
"ignore:.*pkg_resources is deprecated as an API:DeprecationWarning",
Expand Down
Loading