Skip to content

Commit

Permalink
chore: adds Python 3.7/3.8 EOL pending deprecation warning (#817)
Browse files Browse the repository at this point in the history
* chore: adds deprecation warnings related to Python 3.7 3.8

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* Update pandas_gbq/__init__.py

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
chalmerlowe and gcf-owl-bot[bot] authored Oct 7, 2024
1 parent 107bb40 commit b3faa0b
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
5 changes: 5 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
14 changes: 14 additions & 0 deletions pandas_gbq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,24 @@
# 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
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):
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__ = [
Expand Down
32 changes: 32 additions & 0 deletions pandas_gbq/_versions_helpers.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b3faa0b

Please sign in to comment.