Skip to content
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

Fix: Update Python versions (drop 3.7, 3.8 and add 3.13) #2104

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
12 changes: 6 additions & 6 deletions .kokoro/docker/docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#
# pip-compile --allow-unsafe --generate-hashes synthtool/gcp/templates/python_library/.kokoro/docker/docs/requirements.in
#
argcomplete==3.5.3 \
--hash=sha256:2ab2c4a215c59fd6caaff41a869480a23e8f6a5f910b266c1808037f4e375b61 \
--hash=sha256:c12bf50eded8aebb298c7b7da7a5ff3ee24dffd9f5281867dfe1424b58c55392
argcomplete==3.5.2 \
--hash=sha256:036d020d79048a5d525bc63880d7a4b8d1668566b8a76daf1144c0bbe0f63472 \
--hash=sha256:23146ed7ac4403b70bd6026402468942ceba34a6732255b9edf5b7354f68a6bb
# via nox
colorlog==6.9.0 \
--hash=sha256:5906e71acd67cb07a71e779c47c4bcb45fb8c2993eebe9e5adcd6a6f1b283eff \
Expand Down Expand Up @@ -66,7 +66,7 @@ tomli==2.2.1 \
--hash=sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a \
--hash=sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7
# via nox
virtualenv==20.28.1 \
--hash=sha256:412773c85d4dab0409b83ec36f7a6499e72eaf08c80e81e9576bca61831c71cb \
--hash=sha256:5d34ab240fdb5d21549b76f9e8ff3af28252f5499fb6d6f031adac4e5a8c5329
virtualenv==20.28.0 \
--hash=sha256:23eae1b4516ecd610481eda647f3a7c09aea295055337331bb4e6892ecce47b0 \
--hash=sha256:2c9c3262bb8e7b87ea801d715fae4495e6032450c71d2309be9550e7364049aa
# via nox
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ dependencies.

Supported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^
Python >= 3.7
Python >= 3.9

Unsupported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Python == 2.7, Python == 3.5, Python == 3.6.
Python == 2.7, Python == 3.5, Python == 3.6, Python == 3.7, Python == 3.8.

The last version of this library compatible with Python 2.7 and 3.5 is
`google-cloud-bigquery==1.28.0`.
Expand Down
5 changes: 5 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,14 @@
"grpc": ("https://grpc.github.io/grpc/python/", None),
"proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None),
"protobuf": ("https://googleapis.dev/python/protobuf/latest/", None),

"dateutil": ("https://dateutil.readthedocs.io/en/latest/", None),

"geopandas": ("https://geopandas.org/", None),

"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),


}


Expand Down
6 changes: 3 additions & 3 deletions google/cloud/bigquery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@

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. "
"The python-bigquery library no longer supports Python 3.7 "
"and Python 3.8. "
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,
DeprecationWarning,
)

__all__ = [
Expand Down
17 changes: 12 additions & 5 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@
"setup.py",
)

DEFAULT_PYTHON_VERSION = "3.8"
SYSTEM_TEST_PYTHON_VERSIONS = ["3.8", "3.11", "3.12"]
UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.12"]
DEFAULT_PYTHON_VERSION = "3.9"
SYSTEM_TEST_PYTHON_VERSIONS = [
"3.9",
"3.12",
"3.13",
] # Two highest, one lowest versions
UNIT_TEST_PYTHON_VERSIONS = ["3.9", "3.12", "3.13"] # Two highest, one lowest versions
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()


Expand Down Expand Up @@ -103,7 +107,8 @@ def default(session, install_extras=True):
constraints_path,
)

if install_extras and session.python in ["3.11", "3.12"]:
# Testing two highest versions with extras
if install_extras and session.python in UNIT_TEST_PYTHON_VERSIONS[-2:]:
install_target = ".[bqstorage,ipywidgets,pandas,tqdm,opentelemetry]"
elif install_extras:
install_target = ".[all]"
Expand Down Expand Up @@ -136,6 +141,7 @@ def unit(session):
default(session)


# Testing lowest and highest with no extras
@nox.session(python=[UNIT_TEST_PYTHON_VERSIONS[0], UNIT_TEST_PYTHON_VERSIONS[-1]])
@_calculate_duration
def unit_noextras(session):
Expand Down Expand Up @@ -288,7 +294,8 @@ def snippets(session):
session.install("google-cloud-storage", "-c", constraints_path)
session.install("grpcio", "-c", constraints_path)

if session.python in ["3.11", "3.12"]:
# Testing snippets against two most recent versions
if session.python in UNIT_TEST_PYTHON_VERSIONS[-2:]:
extras = "[bqstorage,ipywidgets,pandas,tqdm,opentelemetry]"
else:
extras = "[all]"
Expand Down
9 changes: 1 addition & 8 deletions samples/desktopapp/user_credentials_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import os
import sys
from typing import Iterator, Union
from unittest import mock

Expand All @@ -24,13 +23,7 @@

PROJECT = os.environ["GOOGLE_CLOUD_PROJECT"]


if sys.version_info >= (3, 8):
# Python 3.8+ has an AsyncMock attribute in unittest.mock, but 3.7 does not
MockType = Union[mock.MagicMock, mock.AsyncMock]
else:
# Other definitions and imports
MockType = Union[mock.MagicMock]
MockType = Union[mock.MagicMock, mock.AsyncMock]


@pytest.fixture
Expand Down
Loading