Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 3 additions & 16 deletions packages/db-dtypes/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.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
Expand Down Expand Up @@ -143,13 +143,12 @@ Running System Tests
$ nox -s system

# Run a single system test
$ nox -s system-3.9 -- -k <name of test>
$ nox -s system-3.10 -- -k <name of test>


.. 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
Expand Down Expand Up @@ -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/
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/db-dtypes/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions packages/db-dtypes/db_dtypes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down
32 changes: 0 additions & 32 deletions packages/db-dtypes/db_dtypes/_versions_helpers.py

This file was deleted.

4 changes: 2 additions & 2 deletions packages/db-dtypes/docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions packages/db-dtypes/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
LINT_PYTHON_VERSION = "3.10"

UNIT_TEST_PYTHON_VERSIONS: List[str] = [
"3.9",
"3.10",
"3.11",
"3.12",
Expand All @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions packages/db-dtypes/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"],
)
4 changes: 4 additions & 0 deletions packages/db-dtypes/testing/constraints-3.10.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
numpy==1.24.0
packaging==24.2.0
pandas==1.5.3
pyarrow==13.0.0
11 changes: 0 additions & 11 deletions packages/db-dtypes/testing/constraints-3.9.txt

This file was deleted.

25 changes: 16 additions & 9 deletions packages/db-dtypes/tests/unit/test__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand All @@ -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):
Expand All @@ -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()
Expand Down
Loading