Skip to content

Commit 150143c

Browse files
chalmerlowegcf-owl-bot[bot]Linchin
authored
chore: adds Python 3.7/3.8 EOL pending deprecation warning (#1123)
* Adds deprecation warning regarding Python 3.7 3.8 * removes no warnings plugin and tweaks settings * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Lingqing Gan <[email protected]>
1 parent a8e81fb commit 150143c

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ requirement_cls=sqlalchemy_bigquery.requirements:Requirements
2323
profile_file=.sqlalchemy_dialect_compliance-profiles.txt
2424

2525
[tool:pytest]
26-
addopts= --tb native -v -r fxX -p no:warnings
26+
addopts= --tb native -v -r fxX
2727
python_files=tests/*test_*.py

sqlalchemy_bigquery/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
SQLAlchemy dialect for Google BigQuery
2121
"""
2222

23+
import warnings
24+
2325
from .version import __version__
2426

2527
from .base import BigQueryDialect, dialect
@@ -43,6 +45,20 @@
4345
TIMESTAMP,
4446
)
4547

48+
from . import _versions_helpers
49+
50+
sys_major, sys_minor, sys_micro = _versions_helpers.extract_runtime_version()
51+
if sys_major == 3 and sys_minor in (7, 8):
52+
warnings.warn(
53+
"The python-bigquery library will stop supporting Python 3.7 "
54+
"and Python 3.8 in a future major release expected in Q4 2024. "
55+
f"Your Python version is {sys_major}.{sys_minor}.{sys_micro}. We "
56+
"recommend that you update soon to ensure ongoing support. For "
57+
"more details, see: [Google Cloud Client Libraries Supported Python Versions policy](https://cloud.google.com/python/docs/supported-python-versions)",
58+
PendingDeprecationWarning,
59+
)
60+
61+
4662
__all__ = [
4763
"__version__",
4864
"dialect",
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

0 commit comments

Comments
 (0)