Skip to content
Open
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
10 changes: 5 additions & 5 deletions packages/sqlalchemy-bigquery/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ In order to add a feature:
documentation.

- The feature must work fully on the following CPython versions:
3.10, 3.11, 3.12, 3.13 and 3.14 on both UNIX and Windows.
3.11, 3.12, 3.13, 3.14 and 3.15 on both UNIX and Windows.

- The feature must not add unnecessary dependencies (where
"unnecessary" is of course subjective, but new dependencies should
Expand Down Expand Up @@ -195,11 +195,11 @@ configure them just like the System Tests.

# Run all tests in a folder
$ cd samples/snippets
$ nox -s py-3.10
$ nox -s py-3.14

# Run a single sample test
$ cd samples/snippets
$ nox -s py-3.10 -- -k <name of test>
$ nox -s py-3.14 -- -k <name of test>

********************************************
Note About ``README`` as it pertains to PyPI
Expand All @@ -221,17 +221,17 @@ Supported Python Versions

We support:

- `Python 3.10`_
- `Python 3.11`_
- `Python 3.12`_
- `Python 3.13`_
- `Python 3.14`_
- `Python 3.15`_

.. _Python 3.10: https://docs.python.org/3.10/
.. _Python 3.11: https://docs.python.org/3.11/
.. _Python 3.12: https://docs.python.org/3.12/
.. _Python 3.13: https://docs.python.org/3.13/
.. _Python 3.14: https://docs.python.org/3.14/
.. _Python 3.15: https://docs.python.org/3.15/


Supported versions can be found in our ``noxfile.py`` `config`_.
Expand Down
4 changes: 2 additions & 2 deletions packages/sqlalchemy-bigquery/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ dependencies.

Supported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^
Python >= 3.10, <= 3.14
Python >= 3.11, <= 3.15

Unsupported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Python <= 3.9
Python <= 3.10


Mac/Linux
Expand Down
4 changes: 2 additions & 2 deletions packages/sqlalchemy-bigquery/docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ dependencies.

Supported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^
Python >= 3.10, <= 3.14
Python >= 3.11, <= 3.15

Unsupported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Python <= 3.9
Python <= 3.10


Mac/Linux
Expand Down
32 changes: 19 additions & 13 deletions packages/sqlalchemy-bigquery/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,21 @@

DEFAULT_PYTHON_VERSION = "3.14"

UNIT_TEST_PYTHON_VERSIONS: List[str] = [
ALL_PYTHON: List[str] = [
"3.10",
"3.11",
"3.12",
"3.13",
"3.14",
"3.15",
]
ALL_PYTHON = list(UNIT_TEST_PYTHON_VERSIONS)
UNIT_TEST_PYTHON_VERSIONS: List[str] = [
"3.11",
"3.12",
"3.13",
"3.14",
"3.15",
]
Comment on lines +47 to +61

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since support for Python 3.10 is being dropped, "3.10" should be removed from ALL_PYTHON as well. Keeping it in ALL_PYTHON causes sessions like system_noextras (which uses ALL_PYTHON) to be parameterized for Python 3.10, only to be skipped immediately. Unifying UNIT_TEST_PYTHON_VERSIONS and ALL_PYTHON simplifies the configuration. Additionally, ensure that the project's metadata in setup.py or pyproject.toml is also updated to reflect the same minimum version (Python 3.11) in python_requires and Trove classifiers.

Suggested change
ALL_PYTHON: List[str] = [
"3.10",
"3.11",
"3.12",
"3.13",
"3.14",
"3.15",
]
ALL_PYTHON = list(UNIT_TEST_PYTHON_VERSIONS)
UNIT_TEST_PYTHON_VERSIONS: List[str] = [
"3.11",
"3.12",
"3.13",
"3.14",
"3.15",
]
ALL_PYTHON: List[str] = [
"3.11",
"3.12",
"3.13",
"3.14",
"3.15",
]
UNIT_TEST_PYTHON_VERSIONS: List[str] = ALL_PYTHON
References
  1. When updating the minimum supported Python version in runtime checks (e.g., 'sys.version_info' checks), ensure that the project's metadata in 'setup.py' or 'pyproject.toml' is also updated to reflect the same minimum version in 'python_requires' and Trove classifiers.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that would break GitHub Actions.

UNIT_TEST_STANDARD_DEPENDENCIES = [
"mock",
"asyncmock",
Expand Down Expand Up @@ -94,7 +100,7 @@
],
}

SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ALL_PYTHON
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = UNIT_TEST_PYTHON_VERSIONS
SYSTEM_TEST_STANDARD_DEPENDENCIES: List[str] = [
"mock",
"pytest",
Expand Down Expand Up @@ -302,16 +308,16 @@ def install_unittest_dependencies(session, *constraints):
@_calculate_duration
def unit(session, protobuf_implementation, install_extras=True):
# Install all test dependencies, then install this package in-place.
if session.python not in UNIT_TEST_PYTHON_VERSIONS:
session.skip(f"Python {session.python} is not supported.")

constraints_path = str(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
)
install_unittest_dependencies(session, "-c", constraints_path)

if install_extras and session.python in ["3.11", "3.12", "3.13", "3.14", "3.15"]:
if install_extras:
install_target = ".[geography,alembic,tests,bqstorage]"
elif install_extras:
install_target = ".[all]"
else:
install_target = "."
session.install("-e", install_target, "-c", constraints_path)
Expand Down Expand Up @@ -372,6 +378,9 @@ def install_systemtest_dependencies(session, use_extras=True, *constraints):

def _run_system_test_logic(session, test_type):
"""Shared logic for system, system_noextras, and compliance tests."""
if session.python not in SYSTEM_TEST_PYTHON_VERSIONS:
session.skip(f"Python {session.python} is not supported.")

constraints_path = str(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
)
Expand Down Expand Up @@ -466,7 +475,7 @@ def system(session, test_type):
_run_system_test_logic(session, test_type)


@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS, venv_backend=VENV_BACKEND)
@nox.session(python=ALL_PYTHON, venv_backend=VENV_BACKEND)
@_calculate_duration
def system_noextras(session):
"""Run the system test suite without extras."""
Expand Down Expand Up @@ -494,7 +503,7 @@ def cover(session):
session.run("coverage", "erase")


@nox.session(python="3.10", venv_backend=VENV_BACKEND)
@nox.session(python="3.11")
@_calculate_duration
def docs(session):
"""Build the docs for this library."""
Expand Down Expand Up @@ -532,7 +541,7 @@ def docs(session):
)


@nox.session(python="3.10", venv_backend=VENV_BACKEND)
@nox.session(python="3.11")
@_calculate_duration
def docfx(session):
"""Build the docfx yaml files for this library."""
Expand Down Expand Up @@ -721,10 +730,7 @@ def core_deps_from_source(session, protobuf_implementation):
install_unittest_dependencies(session, "-c", constraints_path)

# Mimic unit session install target
if session.python in ["3.11", "3.12", "3.13", "3.14", "3.15"]:
install_target = ".[geography,alembic,tests,bqstorage]"
else:
install_target = ".[all]"
install_target = ".[geography,alembic,tests,bqstorage]"
session.install("-e", install_target, "-c", constraints_path)

core_dependencies_from_source = [
Expand Down
11 changes: 5 additions & 6 deletions packages/sqlalchemy-bigquery/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def readme():

extras = {
"geography": ["GeoAlchemy2", "shapely"],
"alembic": ["alembic"],
"alembic": ["alembic >= 1.7.7"],
"tests": ["packaging", "pytz"],
# Keep the no-op bqstorage extra for backward compatibility.
# See: https://github.com/googleapis/python-bigquery/issues/757
Expand All @@ -63,7 +63,7 @@ def readme():
# https://github.com/grpc/grpc/pull/15254
"grpcio >= 1.59.0, < 2.0.0",
"grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'",
"pyarrow >= 6.0.0",
"pyarrow >= 10.0.1",
],
}

Expand Down Expand Up @@ -100,7 +100,6 @@ def readme():
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
Expand All @@ -113,12 +112,12 @@ def readme():
install_requires=[
"google-api-core >= 2.25.0, <3.0.0",
"google-auth>=2.14.1,<3.0.0",
"google-cloud-bigquery>=3.20.0,<4.0.0",
"google-cloud-bigquery>=3.20.1,<4.0.0",
"packaging",
"sqlalchemy>=1.4.16,<3.0.0",
"sqlalchemy>=1.4.41,<3.0.0",
],
extras_require=extras,
python_requires=">=3.10",
python_requires=">=3.11",
tests_require=["packaging", "pytz"],
entry_points={
"sqlalchemy.dialects": ["bigquery = sqlalchemy_bigquery:BigQueryDialect"]
Expand Down
16 changes: 0 additions & 16 deletions packages/sqlalchemy-bigquery/sqlalchemy_bigquery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
SQLAlchemy dialect for Google BigQuery
"""

import sys
import warnings

from ._types import (
ARRAY,
BIGNUMERIC,
Expand All @@ -45,19 +42,6 @@
from .base import BigQueryDialect, SafeCast, dialect, safe_cast
from .version import __version__

# Now that support for Python 3.7, 3.8 and 3.9 has been removed, we don't expect the
# following check to succeed. The warning is only included for robustness.
if sys.version_info < (3, 10): # pragma: NO COVER
warnings.warn(
"The python-bigquery-sqlalchemy library no longer supports Python 3.7, "
"3.8 and 3.9. "
f"Your Python version is {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.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)",
FutureWarning,
)


__all__ = [
"__version__",
"dialect",
Expand Down
9 changes: 1 addition & 8 deletions packages/sqlalchemy-bigquery/sqlalchemy_bigquery/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from typing import Any

import google.api_core.exceptions
import packaging.version
import sqlalchemy
import sqlalchemy.sql.expression
import sqlalchemy.sql.functions
Expand Down Expand Up @@ -368,14 +367,10 @@ def group_by_clause(self, select, **kw):
# no way to tell sqlalchemy that, so it works harder than
# necessary and makes us do the same.

__sqlalchemy_version_info = packaging.version.parse(sqlalchemy.__version__)

__expanding_text = "POSTCOMPILE"

# https://github.com/sqlalchemy/sqlalchemy/commit/f79df12bd6d99b8f6f09d4bf07722638c4b4c159
__expanding_conflict = (
"" if __sqlalchemy_version_info < packaging.version.parse("1.4.27") else "__"
)
__expanding_conflict = "__"

__in_expanding_bind = _helpers.substitute_string_re_method(
rf"""
Expand Down Expand Up @@ -553,8 +548,6 @@ def visit_bindparam(

if bindparam.expanding: # pragma: NO COVER
assert_(self.__expanded_param(param), f"Unexpected param: {param}")
if self.__sqlalchemy_version_info < packaging.version.parse("1.4.27"):
param = param.replace(")", f":{bq_type})")

else:
m = self.__placeholder(param)
Expand Down
15 changes: 0 additions & 15 deletions packages/sqlalchemy-bigquery/testing/constraints-3.10.txt

This file was deleted.

16 changes: 15 additions & 1 deletion packages/sqlalchemy-bigquery/testing/constraints-3.11.txt
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
numpy>=1.23
# This constraints file is used to check that lower bounds
# are correct in setup.py
# List *all* library dependencies and extras in this file.
# Pin the version to the lower bound.
#
# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev",
sqlalchemy==1.4.41
google-auth==2.14.1
google-cloud-bigquery==3.20.1
google-cloud-bigquery-storage==2.29.0
google-api-core==2.25.0
grpcio==1.59.0
numpy==1.26.4
alembic==1.7.7
pyarrow==10.0.1
6 changes: 0 additions & 6 deletions packages/sqlalchemy-bigquery/tests/system/test__struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

import datetime

import packaging.version
import pytest
import sqlalchemy

import sqlalchemy_bigquery
Expand Down Expand Up @@ -127,10 +125,6 @@ def test_complex_literals_pr_67(engine, bigquery_dataset, metadata):
# test_unnest_and_struct_access_233 below :)


@pytest.mark.skipif(
packaging.version.parse(sqlalchemy.__version__) < packaging.version.parse("1.4"),
reason="unnest (and other table-valued-function) support required version 1.4",
)
def test_unnest_and_struct_access_233(engine, bigquery_dataset, metadata):
# https://github.com/googleapis/python-bigquery-sqlalchemy/issues/233

Expand Down
Loading
Loading