Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
18 changes: 8 additions & 10 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,19 @@ jobs:
nox -s prerelease_deps
unit:
name: unit${{ matrix.option }}-${{ matrix.python }}
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
# Use ubuntu-22.04 until Python 3.7 is removed from the test matrix
# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
strategy:
matrix:
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
option:
- ""
- "_protobuf_4x"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -64,14 +62,14 @@ jobs:
python -m pip install nox
- name: Run unit tests
env:
COVERAGE_FILE: .coverage-${{matrix.python }}
COVERAGE_FILE: .coverage${{ matrix.option }}-${{matrix.python }}
run: |
nox -s unit-${{ matrix.python }}
nox -s unit${{ matrix.option }}-${{ matrix.python }}
- name: Upload coverage results
uses: actions/upload-artifact@v4
with:
name: coverage-artifact-${{ matrix.python }}
path: .coverage-${{ matrix.python }}
name: coverage-artifact-${{ matrix.option }}-${{ matrix.python }}
path: .coverage${{ matrix.option }}-${{ matrix.python }}
include-hidden-files: true

report-coverage:
Expand Down
40 changes: 0 additions & 40 deletions .kokoro/samples/python3.7/common.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions .kokoro/samples/python3.7/continuous.cfg

This file was deleted.

11 changes: 0 additions & 11 deletions .kokoro/samples/python3.7/periodic-head.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions .kokoro/samples/python3.7/periodic.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions .kokoro/samples/python3.7/presubmit.cfg

This file was deleted.

40 changes: 0 additions & 40 deletions .kokoro/samples/python3.8/common.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions .kokoro/samples/python3.8/continuous.cfg

This file was deleted.

11 changes: 0 additions & 11 deletions .kokoro/samples/python3.8/periodic-head.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions .kokoro/samples/python3.8/periodic.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions .kokoro/samples/python3.8/presubmit.cfg

This file was deleted.

3 changes: 1 addition & 2 deletions .kokoro/test-samples-impl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ export PYTHONUNBUFFERED=1
env | grep KOKORO

# Install nox
# `virtualenv==20.26.6` is added for Python 3.7 compatibility
python3.9 -m pip install --upgrade --quiet nox virtualenv==20.26.6
python3.9 -m pip install --upgrade --quiet nox

# Use secrets acessor service account to get secrets
if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then
Expand Down
6 changes: 1 addition & 5 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ In order to add a feature:
documentation.

- The feature must work fully on the following CPython versions:
3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14 on both UNIX and Windows.
3.9, 3.10, 3.11, 3.12, 3.13 and 3.14 on both UNIX and Windows.

- The feature must not add unnecessary dependencies (where
"unnecessary" is of course subjective, but new dependencies should
Expand Down Expand Up @@ -197,17 +197,13 @@ Supported Python Versions

We support:

- `Python 3.7`_
- `Python 3.8`_
- `Python 3.9`_
- `Python 3.10`_
- `Python 3.11`_
- `Python 3.12`_
- `Python 3.13`_
- `Python 3.14`_

.. _Python 3.7: https://docs.python.org/3.7/
.. _Python 3.8: https://docs.python.org/3.8/
.. _Python 3.9: https://docs.python.org/3.9/
.. _Python 3.10: https://docs.python.org/3.10/
.. _Python 3.11: https://docs.python.org/3.11/
Expand Down
13 changes: 3 additions & 10 deletions google/api_core/_python_package_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"""Code to check versions of dependencies used by Google Cloud Client Libraries."""

import warnings
import sys
from typing import Optional, Tuple

from collections import namedtuple
Expand All @@ -25,12 +24,7 @@
_get_distribution_and_import_packages,
)

if sys.version_info >= (3, 8):
from importlib import metadata
else:
# TODO(https://github.com/googleapis/python-api-core/issues/835): Remove
# this code path once we drop support for Python 3.7
import importlib_metadata as metadata
from importlib import metadata

ParsedVersion = Tuple[int, ...]

Expand All @@ -43,7 +37,7 @@
_PACKAGE_DEPENDENCY_WARNINGS = [
DependencyConstraint(
"google.protobuf",
minimum_fully_supported_version="4.25.8",
minimum_fully_supported_version="5.0.0",
recommended_version="6.x",
)
]
Expand Down Expand Up @@ -85,8 +79,7 @@ def get_dependency_version(
"""Get the parsed version of an installed package dependency.

This function checks for an installed package and returns its version
as a comparable tuple of integers object for safe comparison. It handles
both modern (Python 3.8+) and legacy (Python 3.7) environments.
as a comparable tuple of integers object for safe comparison.

Args:
dependency_name: The distribution name of the package (e.g., 'requests').
Expand Down
3 changes: 0 additions & 3 deletions google/api_core/gapic_v1/method.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
class _MethodDefault(enum.Enum):
# Uses enum so that pytype/mypy knows that this is the only possible value.
# https://stackoverflow.com/a/60605919/101923
#
# Literal[_DEFAULT_VALUE] is an alternative, but only added in Python 3.8.
# https://docs.python.org/3/library/typing.html#typing.Literal
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like this comment is saying an improvement is available to us now that we're dropping 3.7. Is that something we'd want to consider, or should we stick with the existing implementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at this and it didn't seem like a cleaner alternative. I'm not sure what I had in mind when I first wrote this comment, but I think the current implementation is clean.

_DEFAULT_VALUE = object()


Expand Down
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
2 changes: 1 addition & 1 deletion google/api_core/operations_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from google.api_core.operations_v1.operations_rest_client_async import AsyncOperationsRestClient

__all__ += ["AsyncOperationsRestClient", "AsyncOperationsRestTransport"]
except ImportError:
except ImportError: # pragma: NO COVER
# This import requires the `async_rest` extra.
# Don't raise an exception if `AsyncOperationsRestTransport` cannot be imported
# as other transports are still available.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
)

HAS_ASYNC_REST_DEPENDENCIES = True
except ImportError as e:
except ImportError as e: # pragma: NO COVER
HAS_ASYNC_REST_DEPENDENCIES = False
ASYNC_REST_EXCEPTION = e

Expand All @@ -51,7 +51,7 @@ class AbstractOperationsBaseClientMeta(type):

_transport_registry = OrderedDict() # type: Dict[str, Type[OperationsTransport]]
_transport_registry["rest"] = OperationsRestTransport
if HAS_ASYNC_REST_DEPENDENCIES:
if HAS_ASYNC_REST_DEPENDENCIES: # pragma: NO COVER
_transport_registry["rest_asyncio"] = AsyncOperationsRestTransport

def get_transport_class(
Expand Down
2 changes: 1 addition & 1 deletion google/api_core/operations_v1/transports/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
_transport_registry["rest_asyncio"] = cast(
OperationsTransport, AsyncOperationsRestTransport
)
except ImportError:
except ImportError: # pragma: NO COVER
# This import requires the `async_rest` extra.
# Don't raise an exception if `AsyncOperationsRestTransport` cannot be imported
# as other transports are still available.
Expand Down
Loading
Loading