From 2449ab2bdcd7843fb59804baac1d609a1204c692 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 1 Oct 2024 14:34:50 +0000 Subject: [PATCH 1/3] chore: adds deprecation warnings related to Python 3.7 3.8 --- noxfile.py | 5 +++++ pandas_gbq/__init__.py | 13 +++++++++++++ pandas_gbq/_versions_helpers.py | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 pandas_gbq/_versions_helpers.py diff --git a/noxfile.py b/noxfile.py index 02cd052d..461b761c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -208,6 +208,7 @@ def default(session): session.run( "py.test", "--quiet", + "-W default::PendingDeprecationWarning", f"--junitxml=unit_{session.python}_sponge_log.xml", "--cov=pandas_gbq", "--cov=tests/unit", @@ -290,6 +291,7 @@ def system(session): session.run( "py.test", "--quiet", + "-W default::PendingDeprecationWarning", f"--junitxml=system_{session.python}_sponge_log.xml", system_test_path, *session.posargs, @@ -298,6 +300,7 @@ def system(session): session.run( "py.test", "--quiet", + "-W default::PendingDeprecationWarning", f"--junitxml=system_{session.python}_sponge_log.xml", system_test_folder_path, *session.posargs, @@ -372,6 +375,7 @@ def prerelease(session): session.run( "py.test", "--quiet", + "-W default::PendingDeprecationWarning", f"--junitxml=prerelease_unit_{session.python}_sponge_log.xml", os.path.join("tests", "unit"), *session.posargs, @@ -380,6 +384,7 @@ def prerelease(session): session.run( "py.test", "--quiet", + "-W default::PendingDeprecationWarning", f"--junitxml=prerelease_system_{session.python}_sponge_log.xml", os.path.join("tests", "system"), *session.posargs, diff --git a/pandas_gbq/__init__.py b/pandas_gbq/__init__.py index 6d92bfa2..2cc0ee5d 100644 --- a/pandas_gbq/__init__.py +++ b/pandas_gbq/__init__.py @@ -6,6 +6,19 @@ from .gbq import Context, context, read_gbq, to_gbq # noqa +from . import _versions_helpers + +sys_major, sys_minor, sys_micro = _versions_helpers.extract_runtime_version() +if sys_major == 3 and sys_minor in (7, 8): + warnings.warn( + "The python-bigquery library will stop supporting Python 3.7 " + "and Python 3.8 in a future major release expected in Q4 2024. " + f"Your Python version is {sys_major}.{sys_minor}.{sys_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)", + PendingDeprecationWarning, + ) + __version__ = pandas_gbq_version.__version__ __all__ = [ diff --git a/pandas_gbq/_versions_helpers.py b/pandas_gbq/_versions_helpers.py new file mode 100644 index 00000000..37247c45 --- /dev/null +++ b/pandas_gbq/_versions_helpers.py @@ -0,0 +1,32 @@ +# 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 842212db78a82c22b75d92f7a991c9354a518ce6 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 1 Oct 2024 14:37:58 +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 --- pandas_gbq/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandas_gbq/__init__.py b/pandas_gbq/__init__.py index 2cc0ee5d..a6d7e91e 100644 --- a/pandas_gbq/__init__.py +++ b/pandas_gbq/__init__.py @@ -4,9 +4,8 @@ from pandas_gbq import version as pandas_gbq_version -from .gbq import Context, context, read_gbq, to_gbq # noqa - from . import _versions_helpers +from .gbq import Context, context, read_gbq, to_gbq # noqa sys_major, sys_minor, sys_micro = _versions_helpers.extract_runtime_version() if sys_major == 3 and sys_minor in (7, 8): From fbb22ba4cd768bee0446437f54f58f3d71123ef6 Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Tue, 1 Oct 2024 10:41:39 -0400 Subject: [PATCH 3/3] Update pandas_gbq/__init__.py --- pandas_gbq/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandas_gbq/__init__.py b/pandas_gbq/__init__.py index a6d7e91e..76c33d60 100644 --- a/pandas_gbq/__init__.py +++ b/pandas_gbq/__init__.py @@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. +import warnings + from pandas_gbq import version as pandas_gbq_version from . import _versions_helpers