From 7b895816667c2defdc3e62c378e8d7085446d0c6 Mon Sep 17 00:00:00 2001 From: ohmayr Date: Fri, 19 Jun 2026 03:08:21 +0000 Subject: [PATCH 1/3] chore: drop support for Python 3.7-3.9 --- .github/blunderbuss.yml | 4 ++-- .kokoro/trampoline_v2.sh | 4 ++-- CONTRIBUTING.rst | 20 ++++++++----------- README.md | 6 +++--- UPGRADING.md | 2 +- noxfile.py | 4 +--- owlbot.py | 5 +---- samples/compute/noxfile.py | 2 +- samples/compute/requirements-test.txt | 3 +-- .../templates/install_deps.tmpl.rst | 2 +- setup.py | 9 +++------ tests/test_discovery.py | 4 +--- 12 files changed, 25 insertions(+), 40 deletions(-) diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml index 990b311467..1a3af889b5 100644 --- a/.github/blunderbuss.yml +++ b/.github/blunderbuss.yml @@ -5,7 +5,7 @@ # team, please update `codeowner_team` in `.repo-metadata.json`. assign_issues: - - googleapis/python-core-client-libraries + - googleapis/cloud-sdk-python-team assign_issues_by: - labels: @@ -14,4 +14,4 @@ assign_issues_by: - googleapis/python-samples-reviewers assign_prs: - - googleapis/python-core-client-libraries + - googleapis/cloud-sdk-python-team diff --git a/.kokoro/trampoline_v2.sh b/.kokoro/trampoline_v2.sh index 35fa529231..d03f92dfc4 100755 --- a/.kokoro/trampoline_v2.sh +++ b/.kokoro/trampoline_v2.sh @@ -26,8 +26,8 @@ # To run this script, first download few files from gcs to /dev/shm. # (/dev/shm is passed into the container as KOKORO_GFILE_DIR). # -# gsutil cp gs://cloud-devrel-kokoro-resources/python-docs-samples/secrets_viewer_service_account.json /dev/shm -# gsutil cp gs://cloud-devrel-kokoro-resources/python-docs-samples/automl_secrets.txt /dev/shm +# gcloud storage cp gs://cloud-devrel-kokoro-resources/python-docs-samples/secrets_viewer_service_account.json /dev/shm +# gcloud storage cp gs://cloud-devrel-kokoro-resources/python-docs-samples/automl_secrets.txt /dev/shm # # Then run the script. # .kokoro/trampoline_v2.sh diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index c8cf83eae8..2f800676eb 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -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.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 @@ -143,12 +143,12 @@ Running System Tests $ nox -s system # Run a single system test - $ nox -s system-3.8 -- -k + $ nox -s system-3.10 -- -k .. note:: - System tests are only configured to run under Python 3.8. + System tests are only configured to run under Python 3.10. For expediency, we do not run them in older versions of Python 3. This alone will not run the tests. You'll need to change some local @@ -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.10 # Run a single sample test $ cd samples/snippets - $ nox -s py-3.8 -- -k + $ nox -s py-3.10 -- -k ******************************************** Note About ``README`` as it pertains to PyPI @@ -221,18 +221,14 @@ 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/ .. _Python 3.12: https://docs.python.org/3.12/ @@ -245,7 +241,7 @@ Supported versions can be found in our ``noxfile.py`` `config`_. .. _config: https://github.com/googleapis/google-api-python-client/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/README.md b/README.md index d531ca1f79..b2ac480a40 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ The 2.0 release of `google-api-python-client` includes a substantial reliability improvement, compared with 1.x, as discovery documents are now cached in the library rather than fetched dynamically. It is highly recommended to upgrade from v1.x to v2.x. -Only python 3.7 and newer is supported. If you are not able to upgrade python, then +Only python 3.10 and newer is supported. If you are not able to upgrade python, then please continue to use version 1.x as we will continue supporting python 2.7+ in [v1](https://github.com/googleapis/google-api-python-client/tree/v1). @@ -97,11 +97,11 @@ virtualenv ## Supported Python Versions -Python 3.7, 3.8, 3.9, 3.10, 3.11, 3.12 and 3.13, 3.14 are fully supported and tested. This library may work on later versions of 3, but we do not currently run tests against those versions. +Python 3.10, 3.11, 3.12, 3.13, and 3.14 are fully supported and tested. This library may work on later versions of 3, but we do not currently run tests against those versions. ## Unsupported Python Versions -Python < 3.7 +Python < 3.10 ## Third Party Libraries and Dependencies diff --git a/UPGRADING.md b/UPGRADING.md index facde263fb..72788d396a 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -4,7 +4,7 @@ The 2.0 release of `google-api-python-client` includes a substantial reliability improvement, compared with 1.x, as discovery documents are now cached in the library rather than fetched dynamically. It is highly recommended to upgrade from v1.x to v2.x. -Only python 3.7 and newer is supported. If you are not able to upgrade python, then +Only python 3.10 and newer is supported. If you are not able to upgrade python, then please continue to use version 1.x as we will continue supporting python 2.7+ in [v1](https://github.com/googleapis/google-api-python-client/tree/v1). diff --git a/noxfile.py b/noxfile.py index 450ce2d691..5869a83136 100644 --- a/noxfile.py +++ b/noxfile.py @@ -48,8 +48,6 @@ ] nox.options.sessions = [ - # TODO(https://github.com/googleapis/google-api-python-client/issues/2622): - # Remove or restore testing for Python 3.7/3.8/3.9 "unit-3.10", "unit-3.11", "unit-3.12", @@ -98,7 +96,7 @@ def format(session): ) -@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]) +@nox.session(python=["3.10", "3.11", "3.12", "3.13", "3.14"]) @nox.parametrize( "oauth2client", [ diff --git a/owlbot.py b/owlbot.py index 7ee3d49cf8..9c914e1acd 100644 --- a/owlbot.py +++ b/owlbot.py @@ -25,9 +25,6 @@ # ---------------------------------------------------------------------------- templated_files = common.py_library( unit_test_python_versions=[ - "3.7", - "3.8", - "3.9", "3.10", "3.11", "3.12", @@ -59,7 +56,7 @@ # Samples templates # ---------------------------------------------------------------------------- -python.py_samples(skip_readmes=True) +python.py_samples(skip_readmes=True, files_to_exclude=["noxfile.py", "requirements-test.txt"]) for noxfile in Path(".").glob("**/noxfile.py"): s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False) diff --git a/samples/compute/noxfile.py b/samples/compute/noxfile.py index 782da04329..1430172d52 100644 --- a/samples/compute/noxfile.py +++ b/samples/compute/noxfile.py @@ -88,7 +88,7 @@ def get_pytest_env_vars() -> Dict[str, str]: # 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.10", "3.11", "3.12", "3.13", "3.14"] # Any default versions that should be ignored. IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"] diff --git a/samples/compute/requirements-test.txt b/samples/compute/requirements-test.txt index 5027d2b4b6..a6b8542e1a 100644 --- a/samples/compute/requirements-test.txt +++ b/samples/compute/requirements-test.txt @@ -1,4 +1,3 @@ -pytest==7.4.4; python_version == '3.7' -pytest==8.2.2; python_version >= '3.8' +pytest==8.2.2 flaky==3.8.1 diff --git a/scripts/readme-gen/templates/install_deps.tmpl.rst b/scripts/readme-gen/templates/install_deps.tmpl.rst index 6f069c6c87..49fcc14101 100644 --- a/scripts/readme-gen/templates/install_deps.tmpl.rst +++ b/scripts/readme-gen/templates/install_deps.tmpl.rst @@ -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.10+. .. code-block:: bash diff --git a/setup.py b/setup.py index 10fcc41255..c680bd43ef 100644 --- a/setup.py +++ b/setup.py @@ -21,8 +21,8 @@ import sys -if sys.version_info < (3, 7): - print("google-api-python-client requires python3 version >= 3.7.", file=sys.stderr) +if sys.version_info < (3, 10): + print("google-api-python-client requires python3 version >= 3.10.", file=sys.stderr) sys.exit(1) import io @@ -69,16 +69,13 @@ author_email="googleapis-packages@google.com", url="https://github.com/googleapis/google-api-python-client/", install_requires=install_requires, - python_requires=">=3.7", + python_requires=">=3.10", packages=packages, package_data={"googleapiclient": ["discovery_cache/documents/*.json"]}, license="Apache 2.0", keywords="google api client", classifiers=[ "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", "Programming Language :: Python :: 3.12", diff --git a/tests/test_discovery.py b/tests/test_discovery.py index 2d74ce6dfc..5571d77dc7 100644 --- a/tests/test_discovery.py +++ b/tests/test_discovery.py @@ -1418,9 +1418,7 @@ def import_mock(name, *args, **kwargs): return self.mocked_api return self.orig_import(name, *args, **kwargs) - import_fullname = "__builtin__.__import__" - if sys.version_info[0] >= 3: - import_fullname = "builtins.__import__" + import_fullname = "builtins.__import__" with mock.patch(import_fullname, side_effect=import_mock): namespace = "google-api-client" From b84d20bf071f90c5088b9bacfbbdc4a053bf6967 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 19 Jun 2026 03:12:01 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .github/blunderbuss.yml | 4 ++-- .kokoro/trampoline_v2.sh | 4 ++-- owlbot.py | 4 +++- samples/compute/noxfile.py | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml index 1a3af889b5..990b311467 100644 --- a/.github/blunderbuss.yml +++ b/.github/blunderbuss.yml @@ -5,7 +5,7 @@ # team, please update `codeowner_team` in `.repo-metadata.json`. assign_issues: - - googleapis/cloud-sdk-python-team + - googleapis/python-core-client-libraries assign_issues_by: - labels: @@ -14,4 +14,4 @@ assign_issues_by: - googleapis/python-samples-reviewers assign_prs: - - googleapis/cloud-sdk-python-team + - googleapis/python-core-client-libraries diff --git a/.kokoro/trampoline_v2.sh b/.kokoro/trampoline_v2.sh index d03f92dfc4..35fa529231 100755 --- a/.kokoro/trampoline_v2.sh +++ b/.kokoro/trampoline_v2.sh @@ -26,8 +26,8 @@ # To run this script, first download few files from gcs to /dev/shm. # (/dev/shm is passed into the container as KOKORO_GFILE_DIR). # -# gcloud storage cp gs://cloud-devrel-kokoro-resources/python-docs-samples/secrets_viewer_service_account.json /dev/shm -# gcloud storage cp gs://cloud-devrel-kokoro-resources/python-docs-samples/automl_secrets.txt /dev/shm +# gsutil cp gs://cloud-devrel-kokoro-resources/python-docs-samples/secrets_viewer_service_account.json /dev/shm +# gsutil cp gs://cloud-devrel-kokoro-resources/python-docs-samples/automl_secrets.txt /dev/shm # # Then run the script. # .kokoro/trampoline_v2.sh diff --git a/owlbot.py b/owlbot.py index 9c914e1acd..41101e8120 100644 --- a/owlbot.py +++ b/owlbot.py @@ -56,7 +56,9 @@ # Samples templates # ---------------------------------------------------------------------------- -python.py_samples(skip_readmes=True, files_to_exclude=["noxfile.py", "requirements-test.txt"]) +python.py_samples( + skip_readmes=True, files_to_exclude=["noxfile.py", "requirements-test.txt"] +) for noxfile in Path(".").glob("**/noxfile.py"): s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False) diff --git a/samples/compute/noxfile.py b/samples/compute/noxfile.py index 1430172d52..782da04329 100644 --- a/samples/compute/noxfile.py +++ b/samples/compute/noxfile.py @@ -88,7 +88,7 @@ def get_pytest_env_vars() -> Dict[str, str]: # DO NOT EDIT - automatically generated. # All versions used to test samples. -ALL_VERSIONS = ["3.10", "3.11", "3.12", "3.13", "3.14"] +ALL_VERSIONS = ["3.7", "3.8", "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"] From 9e2f67aaf8391a608b1961195cfaf95e053d6a02 Mon Sep 17 00:00:00 2001 From: ohmayr Date: Fri, 19 Jun 2026 07:01:46 +0000 Subject: [PATCH 3/3] force owlbot to ignore changes --- owlbot.py | 2 +- samples/compute/noxfile.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/owlbot.py b/owlbot.py index 41101e8120..323bed9fb3 100644 --- a/owlbot.py +++ b/owlbot.py @@ -57,7 +57,7 @@ # ---------------------------------------------------------------------------- python.py_samples( - skip_readmes=True, files_to_exclude=["noxfile.py", "requirements-test.txt"] + skip_readmes=True, files_to_exclude=["**/noxfile.py", "**/requirements-test.txt"] ) for noxfile in Path(".").glob("**/noxfile.py"): diff --git a/samples/compute/noxfile.py b/samples/compute/noxfile.py index 782da04329..1be564b3c4 100644 --- a/samples/compute/noxfile.py +++ b/samples/compute/noxfile.py @@ -86,9 +86,7 @@ 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.10", "3.11", "3.12", "3.13", "3.14"] # Any default versions that should be ignored. IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]