Skip to content

chore: Adds python eol deprecation warning #292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 7, 2024
Merged
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
15 changes: 15 additions & 0 deletions db_dtypes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import datetime
import re
from typing import Optional, Union
import warnings

import numpy
import packaging.version
Expand All @@ -29,6 +30,8 @@

from db_dtypes import core
from db_dtypes.version import __version__
from . import _versions_helpers


date_dtype_name = "dbdate"
time_dtype_name = "dbtime"
Expand Down Expand Up @@ -344,6 +347,18 @@ def __sub__(self, other):
return super().__sub__(other)


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,
)


if not JSONArray or not JSONDtype:
__all__ = [
"__version__",
Expand Down
32 changes: 32 additions & 0 deletions db_dtypes/_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
6 changes: 6 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def default(session, tests_path):
session.run(
"py.test",
"--quiet",
"-W default::PendingDeprecationWarning",
f"--junitxml={os.path.split(tests_path)[-1]}_{session.python}_sponge_log.xml",
"--cov=db_dtypes",
"--cov=tests/unit",
Expand Down Expand Up @@ -250,6 +251,7 @@ def prerelease(session, tests_path):
session.run(
"py.test",
"--quiet",
"-W default::PendingDeprecationWarning",
f"--junitxml={os.path.split(tests_path)[-1]}_prerelease_{session.python}_sponge_log.xml",
"--cov=db_dtypes",
"--cov=tests/unit",
Expand Down Expand Up @@ -345,6 +347,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 @@ -353,6 +356,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 @@ -529,6 +533,7 @@ def prerelease_deps(session):
session.run(
"py.test",
"--verbose",
"-W default::PendingDeprecationWarning",
f"--junitxml=system_{session.python}_sponge_log.xml",
system_test_path,
*session.posargs,
Expand All @@ -537,6 +542,7 @@ def prerelease_deps(session):
session.run(
"py.test",
"--verbose",
"-W default::PendingDeprecationWarning",
f"--junitxml=system_{session.python}_sponge_log.xml",
system_test_folder_path,
*session.posargs,
Expand Down