diff --git a/.librarian/generator-input/client-post-processing/pubsub-integration.yaml b/.librarian/generator-input/client-post-processing/pubsub-integration.yaml index f91859f425ec..f3d96f5c7a19 100644 --- a/.librarian/generator-input/client-post-processing/pubsub-integration.yaml +++ b/.librarian/generator-input/client-post-processing/pubsub-integration.yaml @@ -528,10 +528,32 @@ replacements: after: 'grpcio==1.51.3' count: 1 + - paths: - - "packages/google-cloud-pubsub/setup.py" - before: '"grpcio-status >= 1\.44\.0",' - after: '"grpcio-status >= 1.51.3",' + - "packages/google-cloud-pubsub/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py" + before: "try:\\s*\\n\\s*from collections\\.abc import KeysView[\\s\\S]*?from typing import KeysView" + after: "from collections.abc import KeysView" + count: 1 + + - paths: + - "packages/google-cloud-pubsub/CONTRIBUTING.rst" + before: "- The feature must work fully on the following CPython versions:\n 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14 on both UNIX and Windows." + after: "- The feature must work fully on the following CPython versions:\n 3.10, 3.11, 3.12, 3.13 and 3.14 on both UNIX and Windows." + count: 1 + + - paths: + - "packages/google-cloud-pubsub/CONTRIBUTING.rst" + before: "We support:\n\n- `Python 3.9`_\n- `Python 3.10`_\n- `Python 3.11`_\n- `Python 3.12`_\n- `Python 3.13`_\n- `Python 3.14`_\n\n.. _Python 3.9: https://docs.python.org/3.9/\n.. _Python 3.10: https://docs.python.org/3.10/" + after: "We support:\n\n- `Python 3.10`_\n- `Python 3.11`_\n- `Python 3.12`_\n- `Python 3.13`_\n- `Python 3.14`_\n\n.. _Python 3.10: https://docs.python.org/3.10/" + count: 1 + + - paths: + - "packages/google-cloud-pubsub/CONTRIBUTING.rst" + before: "We also explicitly decided to support Python 3 beginning with version 3.7." + after: "We also explicitly decided to support Python 3 beginning with version 3.10." count: 1 + + + diff --git a/librarian.yaml b/librarian.yaml index 9a2d5f09fcd5..44462843dbe3 100644 --- a/librarian.yaml +++ b/librarian.yaml @@ -1659,7 +1659,7 @@ libraries: version: 2.38.0 apis: - path: google/pubsub/v1 - skip_generate: true + python: library_type: GAPIC_COMBO opt_args_by_api: diff --git a/packages/google-cloud-pubsub/CONTRIBUTING.rst b/packages/google-cloud-pubsub/CONTRIBUTING.rst index 4e926536bf26..a20f9343b398 100644 --- a/packages/google-cloud-pubsub/CONTRIBUTING.rst +++ b/packages/google-cloud-pubsub/CONTRIBUTING.rst @@ -22,7 +22,7 @@ In order to add a feature: documentation. - The feature must work fully on the following CPython versions: - 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14 on both UNIX and Windows. + 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 @@ -221,14 +221,12 @@ Supported Python Versions We support: -- `Python 3.9`_ - `Python 3.10`_ - `Python 3.11`_ - `Python 3.12`_ - `Python 3.13`_ - `Python 3.14`_ -.. _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/ .. _Python 3.12: https://docs.python.org/3.12/ @@ -241,7 +239,7 @@ Supported versions can be found in our ``noxfile.py`` `config`_. .. _config: https://github.com/googleapis/python-pubsub/blob/main/noxfile.py -We also explicitly decided to support Python 3 beginning with version 3.7. +We also explicitly decided to support Python 3 beginning with version 3.10. Reasons for this include: - Encouraging use of newest versions of Python 3 diff --git a/packages/google-cloud-pubsub/README.rst b/packages/google-cloud-pubsub/README.rst index 46618a5f0417..7717a22044c4 100644 --- a/packages/google-cloud-pubsub/README.rst +++ b/packages/google-cloud-pubsub/README.rst @@ -62,14 +62,15 @@ Supported Python Versions Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of Python. -Python >= 3.9, including 3.14 +Python >= 3.10, including 3.14 .. _active: https://devguide.python.org/devcycle/#in-development-main-branch .. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches Unsupported Python Versions ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Python <= 3.8 +Python <= 3.9 + If you are using an `end-of-life`_ version of Python, we recommend that you update as soon as possible to an actively supported version. diff --git a/packages/google-cloud-pubsub/docs/README.rst b/packages/google-cloud-pubsub/docs/README.rst index 46618a5f0417..7717a22044c4 100644 --- a/packages/google-cloud-pubsub/docs/README.rst +++ b/packages/google-cloud-pubsub/docs/README.rst @@ -62,14 +62,15 @@ Supported Python Versions Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of Python. -Python >= 3.9, including 3.14 +Python >= 3.10, including 3.14 .. _active: https://devguide.python.org/devcycle/#in-development-main-branch .. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches Unsupported Python Versions ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Python <= 3.8 +Python <= 3.9 + If you are using an `end-of-life`_ version of Python, we recommend that you update as soon as possible to an actively supported version. diff --git a/packages/google-cloud-pubsub/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py b/packages/google-cloud-pubsub/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py index 879dcc4faef3..2f9a8ac20d02 100644 --- a/packages/google-cloud-pubsub/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py +++ b/packages/google-cloud-pubsub/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py @@ -20,22 +20,14 @@ import threading import time import typing +from collections.abc import KeysView from typing import Dict, Iterable, Optional, Union from google.cloud.pubsub_v1.open_telemetry.subscribe_opentelemetry import ( SubscribeOpenTelemetry, ) -from google.cloud.pubsub_v1.subscriber._protocol.dispatcher import _MAX_BATCH_LATENCY - -try: - from collections.abc import KeysView - - KeysView[None] # KeysView is only subscriptable in Python 3.9+ -except TypeError: - # Deprecated since Python 3.9, thus only use as a fallback in older Python versions - from typing import KeysView - from google.cloud.pubsub_v1.subscriber._protocol import requests +from google.cloud.pubsub_v1.subscriber._protocol.dispatcher import _MAX_BATCH_LATENCY if typing.TYPE_CHECKING: # pragma: NO COVER from google.cloud.pubsub_v1.subscriber._protocol.streaming_pull_manager import ( diff --git a/packages/google-cloud-pubsub/pytest.ini b/packages/google-cloud-pubsub/pytest.ini index 41cad40d640b..375b37a37ba5 100644 --- a/packages/google-cloud-pubsub/pytest.ini +++ b/packages/google-cloud-pubsub/pytest.ini @@ -17,12 +17,9 @@ filterwarnings = ignore:.*pkg_resources.declare_namespace:DeprecationWarning ignore:.*pkg_resources is deprecated as an API:DeprecationWarning # Remove once https://github.com/googleapis/gapic-generator-python/issues/2303 is fixed - ignore:The python-bigquery library will stop supporting Python 3.7:PendingDeprecationWarning - # Remove once we move off credential files https://github.com/googleapis/google-auth-library-python/pull/1812 - # Note that these are used in tests only - ignore:Your config file at [/home/kbuilder/.docker/config.json] contains these credential helper entries:DeprecationWarning + # Remove once opentelemetry stops triggering SelectableGroups DeprecationWarning on Python 3.11+ + ignore:.*SelectableGroups dict interface is deprecated.*:DeprecationWarning + # Remove once credentials_file is completely removed ignore:The `credentials_file` argument is deprecated because of a potential security risk:DeprecationWarning - ignore:You are using a Python version.*which Google will stop supporting in new releases of google\.api_core.*:FutureWarning - ignore:You are using a non-supported Python version \(([\d\.]+)\)\. Google will not post any further updates to google\.api_core.*:FutureWarning # These google library EOL warnings for Python versions don't matter for the purposes of a test. ignore::FutureWarning:google.*: