From 00431c3afccda1361e4b6d11a02d80059082e5c0 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Wed, 6 May 2026 09:55:45 -0400 Subject: [PATCH 1/6] feat(db-dtypes): update setup.py metadata and python_requires --- packages/db-dtypes/setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/db-dtypes/setup.py b/packages/db-dtypes/setup.py index 20efac6f3aa4..b0008988d01d 100644 --- a/packages/db-dtypes/setup.py +++ b/packages/db-dtypes/setup.py @@ -64,7 +64,6 @@ def readme(): "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -75,6 +74,6 @@ def readme(): ], platforms="Posix; MacOS X; Windows", install_requires=dependencies, - python_requires=">=3.9", + python_requires=">=3.10", tests_require=["pytest"], ) From 2f2acc9d300c72a65e1f075e534165dbd3f14c23 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Wed, 6 May 2026 09:55:47 -0400 Subject: [PATCH 2/6] feat(db-dtypes): update Nox sessions to remove old versions --- packages/db-dtypes/noxfile.py | 3 +-- packages/db-dtypes/testing/constraints-3.9.txt | 11 ----------- 2 files changed, 1 insertion(+), 13 deletions(-) delete mode 100644 packages/db-dtypes/testing/constraints-3.9.txt diff --git a/packages/db-dtypes/noxfile.py b/packages/db-dtypes/noxfile.py index 381ab96b5f37..d3cffaffc22f 100644 --- a/packages/db-dtypes/noxfile.py +++ b/packages/db-dtypes/noxfile.py @@ -37,7 +37,6 @@ LINT_PYTHON_VERSION = "3.10" UNIT_TEST_PYTHON_VERSIONS: List[str] = [ - "3.9", "3.10", "3.11", "3.12", @@ -58,7 +57,7 @@ UNIT_TEST_EXTRAS: List[str] = [] UNIT_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {} -SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.9"] +SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.10"] SYSTEM_TEST_STANDARD_DEPENDENCIES: List[str] = [ "mock", "pytest", diff --git a/packages/db-dtypes/testing/constraints-3.9.txt b/packages/db-dtypes/testing/constraints-3.9.txt deleted file mode 100644 index 63898869bb8b..000000000000 --- a/packages/db-dtypes/testing/constraints-3.9.txt +++ /dev/null @@ -1,11 +0,0 @@ -# This constraints file is used to check that lower bounds -# are correct in setup.py -# List *all* library dependencies and extras in this file. -# Pin the version to the lower bound. -# -# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", -# Then this file should have foo==1.14.0 -numpy==1.24.0 -packaging==24.2.0 -pandas==1.5.3 -pyarrow==13.0.0 From c90bc6e513256759bad5957b7833564089350f50 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Wed, 6 May 2026 09:55:49 -0400 Subject: [PATCH 3/6] docs(db-dtypes): update README and CONTRIBUTING documentation --- packages/db-dtypes/CONTRIBUTING.rst | 19 +++---------------- packages/db-dtypes/README.rst | 4 ++-- packages/db-dtypes/docs/README.rst | 4 ++-- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/packages/db-dtypes/CONTRIBUTING.rst b/packages/db-dtypes/CONTRIBUTING.rst index 6135934e161e..24eb87c69da9 100644 --- a/packages/db-dtypes/CONTRIBUTING.rst +++ b/packages/db-dtypes/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 @@ -143,13 +143,12 @@ Running System Tests $ nox -s system # Run a single system test - $ nox -s system-3.9 -- -k + $ nox -s system-3.10 -- -k .. note:: - System tests are only configured to run under Python 3.9. - For expediency, we do not run them in older versions of Python 3. + System tests are only configured to run under Python 3.10. This alone will not run the tests. You'll need to change some local auth settings and change some configuration in your project to @@ -198,14 +197,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/ @@ -218,17 +215,7 @@ Supported versions can be found in our ``noxfile.py`` `config`_. .. _config: https://github.com/googleapis/google-cloud-python/blob/main/packages/db-dtypes/noxfile.py -We also explicitly decided to support Python 3 beginning with version 3.9. -Reasons for this include: -- Encouraging use of newest versions of Python 3 -- Taking the lead of `prominent`_ open-source `projects`_ -- `Unicode literal support`_ which allows for a cleaner codebase that - works in both Python 2 and Python 3 - -.. _prominent: https://docs.djangoproject.com/en/1.9/faq/install/#what-python-version-can-i-use-with-django -.. _projects: http://flask.pocoo.org/docs/0.10/python3/ -.. _Unicode literal support: https://www.python.org/dev/peps/pep-0414/ ********** Versioning diff --git a/packages/db-dtypes/README.rst b/packages/db-dtypes/README.rst index eab2705e2487..495e7378455a 100644 --- a/packages/db-dtypes/README.rst +++ b/packages/db-dtypes/README.rst @@ -34,11 +34,11 @@ dependencies. Supported Python Versions ^^^^^^^^^^^^^^^^^^^^^^^^^ -Python >= 3.9 +Python >= 3.10 Unsupported Python Versions ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Python <= 3.8. +Python <= 3.9 Mac/Linux diff --git a/packages/db-dtypes/docs/README.rst b/packages/db-dtypes/docs/README.rst index eab2705e2487..495e7378455a 100644 --- a/packages/db-dtypes/docs/README.rst +++ b/packages/db-dtypes/docs/README.rst @@ -34,11 +34,11 @@ dependencies. Supported Python Versions ^^^^^^^^^^^^^^^^^^^^^^^^^ -Python >= 3.9 +Python >= 3.10 Unsupported Python Versions ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Python <= 3.8. +Python <= 3.9 Mac/Linux From 062913c1c1f73f5230680b53e4e51f116c60b5e2 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Wed, 6 May 2026 09:55:52 -0400 Subject: [PATCH 4/6] feat(db-dtypes): remove extract_runtime_version and helper file --- packages/db-dtypes/db_dtypes/__init__.py | 10 +++--- .../db-dtypes/db_dtypes/_versions_helpers.py | 32 ------------------- 2 files changed, 5 insertions(+), 37 deletions(-) delete mode 100644 packages/db-dtypes/db_dtypes/_versions_helpers.py diff --git a/packages/db-dtypes/db_dtypes/__init__.py b/packages/db-dtypes/db_dtypes/__init__.py index a45dff80081f..bdd8264df5dc 100644 --- a/packages/db-dtypes/db_dtypes/__init__.py +++ b/packages/db-dtypes/db_dtypes/__init__.py @@ -30,7 +30,6 @@ from db_dtypes import core from db_dtypes.json import JSONArray, JSONArrowType, JSONDtype # noqa: F401 -from . import _versions_helpers date_dtype_name = "dbdate" time_dtype_name = "dbtime" @@ -341,12 +340,13 @@ def __sub__(self, other): def _check_python_version(): """Checks the runtime Python version and issues a warning if needed.""" - sys_major, sys_minor, sys_micro = _versions_helpers.extract_runtime_version() - if sys_major == 3 and sys_minor in (7, 8): + import sys + + if sys.version_info < (3, 10): warnings.warn( "The python-bigquery library as well as the python-db-dtypes-pandas library no " - "longer supports Python 3.7 and Python 3.8. " - f"Your Python version is {sys_major}.{sys_minor}.{sys_micro}. We " + "longer supports Python 3.7, 3.8, and 3.9. " + f"Your Python version is {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}. We " "recommend that you update soon to ensure ongoing support. For " "more details, see: [Google Cloud Client Libraries Supported Python Versions policy](https://cloud.google.com/python/docs/supported-python-versions)", FutureWarning, diff --git a/packages/db-dtypes/db_dtypes/_versions_helpers.py b/packages/db-dtypes/db_dtypes/_versions_helpers.py deleted file mode 100644 index 37247c456d81..000000000000 --- a/packages/db-dtypes/db_dtypes/_versions_helpers.py +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Shared helper functions for verifying versions of installed modules.""" - - -import sys -from typing import Tuple - - -def extract_runtime_version() -> Tuple[int, int, int]: - # Retrieve the version information - version_info = sys.version_info - - # Extract the major, minor, and micro components - major = version_info.major - minor = version_info.minor - micro = version_info.micro - - # Display the version number in a clear format - return major, minor, micro From be6c2fb1fe4abef35f8ce418a1b43cab872a6f05 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Wed, 6 May 2026 09:55:54 -0400 Subject: [PATCH 5/6] test(db-dtypes): update tests to mock sys.version_info --- packages/db-dtypes/tests/unit/test__init__.py | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/packages/db-dtypes/tests/unit/test__init__.py b/packages/db-dtypes/tests/unit/test__init__.py index 4b86d5458315..7fa02fe779e0 100644 --- a/packages/db-dtypes/tests/unit/test__init__.py +++ b/packages/db-dtypes/tests/unit/test__init__.py @@ -12,16 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +from collections import namedtuple from unittest import mock import pytest # Module paths used for mocking MODULE_PATH = "db_dtypes" -HELPER_MODULE_PATH = f"{MODULE_PATH}._versions_helpers" -MOCK_EXTRACT_VERSION = f"{HELPER_MODULE_PATH}.extract_runtime_version" MOCK_WARN = "warnings.warn" # Target the standard warnings module +VersionInfo = namedtuple("VersionInfo", ["major", "minor", "micro"]) + @pytest.mark.parametrize( "mock_version_tuple, version_str", @@ -30,17 +31,20 @@ ((3, 7, 0), "3.7.0"), ((3, 8, 5), "3.8.5"), ((3, 8, 12), "3.8.12"), + ((3, 9, 5), "3.9.5"), ], ) def test_check_python_version_warns_on_unsupported(mock_version_tuple, version_str): """ - Test that _check_python_version issues a FutureWarning for Python 3.7/3.8. + Test that _check_python_version issues a FutureWarning for Python 3.7/3.8/3.9. """ from db_dtypes import _check_python_version - # Mock the helper function it calls and the warnings.warn function - with mock.patch(MOCK_EXTRACT_VERSION, return_value=mock_version_tuple), mock.patch( + mock_version = VersionInfo(*mock_version_tuple) + + # Mock sys.version_info and warnings.warn + with mock.patch("sys.version_info", new=mock_version), mock.patch( MOCK_WARN ) as mock_warn_call: _check_python_version() # Call the function @@ -55,17 +59,18 @@ def test_check_python_version_warns_on_unsupported(mock_version_tuple, version_s warning_category = args[1] if len(args) > 1 else kwargs.get("category") # Verify message content and category - assert "longer supports Python 3.7 and Python 3.8" in warning_message + assert "longer supports Python 3.7, 3.8, and 3.9" in warning_message assert warning_category == FutureWarning @pytest.mark.parametrize( "mock_version_tuple", [ - (3, 9, 1), (3, 10, 0), (3, 11, 2), (3, 12, 0), + (3, 13, 0), + (3, 14, 0), ], ) def test_check_python_version_does_not_warn_on_supported(mock_version_tuple): @@ -75,8 +80,10 @@ def test_check_python_version_does_not_warn_on_supported(mock_version_tuple): from db_dtypes import _check_python_version - # Mock the helper function it calls and the warnings.warn function - with mock.patch(MOCK_EXTRACT_VERSION, return_value=mock_version_tuple), mock.patch( + mock_version = VersionInfo(*mock_version_tuple) + + # Mock sys.version_info and warnings.warn + with mock.patch("sys.version_info", new=mock_version), mock.patch( MOCK_WARN ) as mock_warn_call: _check_python_version() From 72f755aa02b0f000e6cfa38af7e36184440922f7 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Wed, 6 May 2026 12:49:38 -0400 Subject: [PATCH 6/6] feat(db-dtypes): update constraints-3.10.txt for lowest runtime --- packages/db-dtypes/testing/constraints-3.10.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/db-dtypes/testing/constraints-3.10.txt b/packages/db-dtypes/testing/constraints-3.10.txt index e69de29bb2d1..16148120aacf 100644 --- a/packages/db-dtypes/testing/constraints-3.10.txt +++ b/packages/db-dtypes/testing/constraints-3.10.txt @@ -0,0 +1,4 @@ +numpy==1.24.0 +packaging==24.2.0 +pandas==1.5.3 +pyarrow==13.0.0