Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
4 changes: 0 additions & 4 deletions .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ branchProtectionRules:
- 'Kokoro - Against Pub/Sub Lite samples'
- 'cla/google'
- 'Samples - Lint'
- 'Samples - Python 3.7'
- 'Samples - Python 3.8'
- 'Samples - Python 3.9'
- 'Samples - Python 3.10'
- 'Samples - Python 3.11'
Expand All @@ -21,8 +19,6 @@ branchProtectionRules:
- 'docs'
- 'docfx'
- 'lint'
- 'unit (3.7)'
- 'unit (3.8)'
- 'unit (3.9)'
- 'unit (3.10)'
- 'unit (3.11)'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
Expand All @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
python: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .kokoro/samples/python3.7/common.cfg
Comment thread
abbrowne126 marked this conversation as resolved.
Outdated
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ action {
# Specify which tests to run
env_vars: {
key: "RUN_TESTS_SESSION"
value: "py-3.7"
value: "py-3.14"
}

# Declare build specific Cloud project.
Expand All @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"

# Use the trampoline script to run in docker.
build_file: "python-pubsub/.kokoro/trampoline_v2.sh"
build_file: "python-pubsub/.kokoro/trampoline_v2.sh"
4 changes: 2 additions & 2 deletions .kokoro/samples/python3.8/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ action {
# Specify which tests to run
env_vars: {
key: "RUN_TESTS_SESSION"
value: "py-3.8"
value: "py-3.14"
}

# Declare build specific Cloud project.
Expand All @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"

# Use the trampoline script to run in docker.
build_file: "python-pubsub/.kokoro/trampoline_v2.sh"
build_file: "python-pubsub/.kokoro/trampoline_v2.sh"
2 changes: 1 addition & 1 deletion .librarian/generator-input/librarian.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@
if count < 1:
raise Exception(".coveragerc replacement failed.")

s.move([library], excludes=["noxfile.py", "README.rst", "docs/**/*", "setup.py", "testing/constraints-3.7.txt", "testing/constraints-3.8.txt"])
s.move([library], excludes=["noxfile.py", "README.rst", "docs/**/*", "setup.py"])
s.remove_staging_dirs()

# ----------------------------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions .librarian/generator-input/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
DEFAULT_PYTHON_VERSION = "3.14"

UNIT_TEST_PYTHON_VERSIONS: List[str] = [
"3.7",
"3.8",
"3.9",
"3.10",
"3.11",
Expand Down
10 changes: 3 additions & 7 deletions .librarian/generator-input/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@
"protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
"grpc-google-iam-v1 >= 0.12.4, < 1.0.0",
"grpcio-status >= 1.33.2",
"opentelemetry-api <= 1.22.0; python_version<='3.7'",
"opentelemetry-api >= 1.27.0; python_version>='3.8'",
"opentelemetry-sdk <= 1.22.0; python_version<='3.7'",
"opentelemetry-sdk >= 1.27.0; python_version>='3.8'",
"opentelemetry-api >= 1.27.0",
"opentelemetry-sdk >= 1.27.0",
]
extras = {"libcst": "libcst >= 0.3.10"}
url = "https://github.com/googleapis/python-pubsub"
Expand Down Expand Up @@ -82,8 +80,6 @@
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -97,7 +93,7 @@
packages=packages,
install_requires=dependencies,
extras_require=extras,
python_requires=">=3.7",
python_requires=">=3.9",
include_package_data=True,
zip_safe=False,
)
10 changes: 3 additions & 7 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,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 @@ -195,11 +195,11 @@ configure them just like the System Tests.

# Run all tests in a folder
$ cd samples/snippets
$ nox -s py-3.8
$ nox -s py-3.14

# Run a single sample test
$ cd samples/snippets
$ nox -s py-3.8 -- -k <name of test>
$ nox -s py-3.14 -- -k <name of test>

********************************************
Note About ``README`` as it pertains to PyPI
Expand All @@ -221,17 +221,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
12 changes: 7 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Python Client for Google Cloud Pub / Sub
========================================

|GA| |pypi| |versions|
|GA| |pypi| |versions|

`Google Cloud Pub / Sub`_ is a fully-managed real-time messaging service that
allows you to send and receive messages between independent applications. You
Expand Down Expand Up @@ -60,11 +60,13 @@ dependencies.

Supported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^
Python >= 3.7
Python >= 3.9

Deprecated Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^^
Python <= 3.6.
Python < 3.9

The last version of this library compatible with Python 3.7 and 3.8 is google-cloud-pubsub==2.34.0.

The last version of this library compatible with Python 2.7 is google-cloud-pubsub==1.7.0.

Expand Down Expand Up @@ -146,7 +148,7 @@ the topic, and subscribe to that, passing a callback function.

with pubsub_v1.SubscriberClient() as subscriber:
subscriber.create_subscription(
name=subscription_name, topic=topic_name)
name=subscription_name, topic=topic_name)
future = subscriber.subscribe(subscription_name, callback)

The future returned by the call to ``subscriber.subscribe`` can be used to
Expand Down Expand Up @@ -190,7 +192,7 @@ For example, to use JSON Web Tokens, provide a `google.auth.jwt.Credentials`_ in

# The same for the publisher, except that the "audience" claim needs to be adjusted
publisher_audience = "https://pubsub.googleapis.com/google.pubsub.v1.Publisher"
credentials_pub = credentials.with_claims(audience=publisher_audience)
credentials_pub = credentials.with_claims(audience=publisher_audience)
publisher = pubsub_v1.PublisherClient(credentials=credentials_pub)

.. _Credentials: https://google-auth.readthedocs.io/en/latest/reference/google.auth.credentials.html#google.auth.credentials.Credentials
Expand Down
14 changes: 11 additions & 3 deletions librarian.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,15 @@
if count < 1:
raise Exception(".coveragerc replacement failed.")

s.move([library], excludes=["noxfile.py", "README.rst", "docs/**/*", "setup.py", "testing/constraints-3.7.txt", "testing/constraints-3.8.txt"])
s.move(
[library],
excludes=[
"noxfile.py",
"README.rst",
"docs/**/*",
"setup.py",
],
)
s.remove_staging_dirs()

# ----------------------------------------------------------------------------
Expand All @@ -338,10 +346,10 @@
samples=True,
cov_level=99,
versions=gcp.common.detect_versions(path="./google", default_first=True),
unit_test_python_versions=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"],
unit_test_python_versions=["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"],
unit_test_dependencies=["flaky"],
system_test_python_versions=["3.12"],
system_test_external_dependencies=["psutil","flaky"],
system_test_external_dependencies=["psutil", "flaky"],
)
s.move(templated_files, excludes=[".coveragerc", ".github/**", "README.rst", "docs/**", ".kokoro/**"])

Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[mypy]
python_version = 3.7
python_version = 3.14
namespace_packages = True
2 changes: 0 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
DEFAULT_PYTHON_VERSION = "3.14"

UNIT_TEST_PYTHON_VERSIONS: List[str] = [
"3.7",
"3.8",
"3.9",
"3.10",
"3.11",
Expand Down
14 changes: 2 additions & 12 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ filterwarnings =
ignore:.*custom tp_new.*in Python 3.14:DeprecationWarning
# Remove once https://github.com/grpc/grpc/issues/35086 is fixed
ignore:There is no current event loop:DeprecationWarning:grpc.aio._channel
# Remove after support for Python 3.7 is dropped
ignore:After January 1, 2024, new releases of this library will drop support for Python 3.7:DeprecationWarning
# Remove warning once https://github.com/googleapis/gapic-generator-python/issues/1938 is fixed
ignore:The return_immediately flag is deprecated and should be set to False.:DeprecationWarning
# Remove warning once https://github.com/googleapis/gapic-generator-python/issues/1939 is fixed
Expand All @@ -26,13 +24,5 @@ filterwarnings =
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
ignore:You are using a Python version \(([\d\.]+)\) past its end of life\. Google will update google\.api_core.*:FutureWarning
# Remove after support for Python 3.7 is dropped
ignore:You are using a non-supported Python version \(3\.7:FutureWarning
# Remove after support for Python 3.8 is dropped
ignore:You are using a non-supported Python version \(3\.8:DeprecationWarning
ignore:You are using a non-supported Python version \(3\.8:FutureWarning
# Remove after support for Python 3.9 is dropped
ignore:You are using a Python version \(3\.9:FutureWarning
# Remove after support for Python 3.10 is dropped
ignore:.*You are using a Python version \(3\.10:FutureWarning
# These google library EOL warnings for Python versions don't matter for the purposes of a test.
ignore::FutureWarning:google.*:
3 changes: 1 addition & 2 deletions samples/snippets/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ def get_pytest_env_vars() -> Dict[str, str]:
return ret


# DO NOT EDIT - automatically generated.
# All versions used to test samples.
ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
ALL_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]

# Any default versions that should be ignored.
IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]
Expand Down
7 changes: 2 additions & 5 deletions samples/snippets/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
backoff==2.2.1
pytest===7.4.4; python_version == '3.7'
pytest===8.3.5; python_version == '3.8'
pytest==8.4.2; python_version >= '3.9'
pytest==8.4.2
mock==5.2.0
flaky==3.8.1
google-cloud-bigquery===3.30.0; python_version <= '3.8'
google-cloud-bigquery==3.38.0; python_version >= '3.9'
google-cloud-bigquery==3.38.0
google-cloud-storage==3.4.0
12 changes: 3 additions & 9 deletions samples/snippets/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
google-cloud-pubsub==2.31.1
avro==1.12.0
protobuf===4.24.4; python_version == '3.7'
protobuf===5.29.4; python_version == '3.8'
protobuf==6.32.1; python_version >= '3.9'
protobuf==6.32.1
avro==1.12.0
opentelemetry-api===1.22.0; python_version == '3.7'
opentelemetry-sdk===1.22.0; python_version == '3.7'
opentelemetry-api===1.33.1; python_version == '3.8'
opentelemetry-sdk===1.33.1; python_version == '3.8'
opentelemetry-api==1.37.0; python_version >= '3.9'
opentelemetry-sdk==1.37.0; python_version >= '3.9'
opentelemetry-api==1.37.0
opentelemetry-sdk==1.37.0
opentelemetry-exporter-gcp-trace==1.9.0
2 changes: 1 addition & 1 deletion scripts/readme-gen/templates/install_deps.tmpl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Install Dependencies
.. _Python Development Environment Setup Guide:
https://cloud.google.com/python/setup

#. Create a virtualenv. Samples are compatible with Python 3.7+.
#. Create a virtualenv. Samples are compatible with Python 3.9+.

.. code-block:: bash

Expand Down
10 changes: 3 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@
"protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
"grpc-google-iam-v1 >= 0.12.4, < 1.0.0",
"grpcio-status >= 1.33.2",
"opentelemetry-api <= 1.22.0; python_version<='3.7'",
"opentelemetry-api >= 1.27.0; python_version>='3.8'",
"opentelemetry-sdk <= 1.22.0; python_version<='3.7'",
"opentelemetry-sdk >= 1.27.0; python_version>='3.8'",
"opentelemetry-api >= 1.27.0",
"opentelemetry-sdk >= 1.27.0",
]
extras = {"libcst": "libcst >= 0.3.10"}
url = "https://github.com/googleapis/python-pubsub"
Expand Down Expand Up @@ -86,8 +84,6 @@
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -101,7 +97,7 @@
packages=packages,
install_requires=dependencies,
extras_require=extras,
python_requires=">=3.7",
python_requires=">=3.9",
include_package_data=True,
zip_safe=False,
)
12 changes: 6 additions & 6 deletions testing/constraints-3.10.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
# This constraints file is required for unit tests.
# List all library dependencies and extras in this file.
google-api-core
google-auth
grpcio
proto-plus
protobuf
grpc-google-iam-v1
google-api-core>=2
google-auth>=2
grpcio>=1
proto-plus>=1
protobuf>=6
grpc-google-iam-v1>=0
12 changes: 6 additions & 6 deletions testing/constraints-3.11.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
# This constraints file is required for unit tests.
# List all library dependencies and extras in this file.
google-api-core
google-auth
grpcio
proto-plus
protobuf
grpc-google-iam-v1
google-api-core>=2
google-auth>=2
grpcio>=1
proto-plus>=1
protobuf>=6
grpc-google-iam-v1>=0
Loading
Loading