Skip to content

Commit c97f82e

Browse files
committed
chore: Adds python eol deprecation warning
1 parent fc54e70 commit c97f82e

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

db_dtypes/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929

3030
from db_dtypes import core
3131
from db_dtypes.version import __version__
32+
from . import _versions_helpers
33+
3234

3335
date_dtype_name = "dbdate"
3436
time_dtype_name = "dbtime"
@@ -344,6 +346,18 @@ def __sub__(self, other):
344346
return super().__sub__(other)
345347

346348

349+
sys_major, sys_minor, _ = _versions_helpers.extract_runtime_version()
350+
if sys_major == 3 and sys_minor in (7, 8):
351+
warnings.warn(
352+
"The python-bigquery library will stop supporting Python 3.7 "
353+
"and Python 3.8 in a future major release expected in Q4 2024. "
354+
f"Your Python version is {sys_major}.{sys_minor}.{sys_micro}. We "
355+
"recommend that you update soon to ensure ongoing support. For "
356+
"more details, see: [Google Cloud Client Libraries Supported Python Versions policy](https://cloud.google.com/python/docs/supported-python-versions)",
357+
PendingDeprecationWarning,
358+
)
359+
360+
347361
if not JSONArray or not JSONDtype:
348362
__all__ = [
349363
"__version__",

db_dtypes/_versions_helpers.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""Shared helper functions for verifying versions of installed modules."""
16+
17+
18+
import sys
19+
from typing import Tuple
20+
21+
22+
def extract_runtime_version() -> Tuple[int, int, int]:
23+
# Retrieve the version information
24+
version_info = sys.version_info
25+
26+
# Extract the major, minor, and micro components
27+
major = version_info.major
28+
minor = version_info.minor
29+
micro = version_info.micro
30+
31+
# Display the version number in a clear format
32+
return major, minor, micro

noxfile.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ def default(session, tests_path):
173173
session.run(
174174
"py.test",
175175
"--quiet",
176+
"-W default::PendingDeprecationWarning",
176177
f"--junitxml={os.path.split(tests_path)[-1]}_{session.python}_sponge_log.xml",
177178
"--cov=db_dtypes",
178179
"--cov=tests/unit",
@@ -250,6 +251,7 @@ def prerelease(session, tests_path):
250251
session.run(
251252
"py.test",
252253
"--quiet",
254+
"-W default::PendingDeprecationWarning",
253255
f"--junitxml={os.path.split(tests_path)[-1]}_prerelease_{session.python}_sponge_log.xml",
254256
"--cov=db_dtypes",
255257
"--cov=tests/unit",
@@ -345,6 +347,7 @@ def system(session):
345347
session.run(
346348
"py.test",
347349
"--quiet",
350+
"-W default::PendingDeprecationWarning",
348351
f"--junitxml=system_{session.python}_sponge_log.xml",
349352
system_test_path,
350353
*session.posargs,
@@ -353,6 +356,7 @@ def system(session):
353356
session.run(
354357
"py.test",
355358
"--quiet",
359+
"-W default::PendingDeprecationWarning",
356360
f"--junitxml=system_{session.python}_sponge_log.xml",
357361
system_test_folder_path,
358362
*session.posargs,
@@ -529,6 +533,7 @@ def prerelease_deps(session):
529533
session.run(
530534
"py.test",
531535
"--verbose",
536+
"-W default::PendingDeprecationWarning",
532537
f"--junitxml=system_{session.python}_sponge_log.xml",
533538
system_test_path,
534539
*session.posargs,
@@ -537,6 +542,7 @@ def prerelease_deps(session):
537542
session.run(
538543
"py.test",
539544
"--verbose",
545+
"-W default::PendingDeprecationWarning",
540546
f"--junitxml=system_{session.python}_sponge_log.xml",
541547
system_test_folder_path,
542548
*session.posargs,

0 commit comments

Comments
 (0)