Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
1 change: 0 additions & 1 deletion .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ branchProtectionRules:
- 'OwlBot Post Processor'
- 'Kokoro'
- 'Samples - Lint'
- 'Samples - Python 3.8'
- 'Samples - Python 3.9'
- 'Samples - Python 3.10'
- 'Samples - Python 3.11'
Expand Down
12 changes: 5 additions & 7 deletions 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.8, 3.9, 3.10, 3.11, 3.12, and 3.13 on both UNIX and Windows.
3.9, 3.10, 3.11, 3.12, and 3.13 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 @@ -148,7 +148,7 @@ Running System Tests

.. note::

System tests are only configured to run under Python 3.8, 3.12, and 3.13.
System tests are only configured to run under Python 3.9, 3.12, and 3.13.
For expediency, we do not run them in older versions of Python 3.

This alone will not run the tests. You'll need to change some local
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.8
$ nox -s py-3.9

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

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

We support:

- `Python 3.8`_
- `Python 3.9`_
- `Python 3.10`_
- `Python 3.11`_
- `Python 3.12`_
- `Python 3.13`_

.. _Python 3.8: https://docs.python.org/3.8/
.. _Python 3.9: https://docs.python.org/3.9/
.. _Python 3.10: https://docs.python.org/3.10/
.. _Python 3.11: https://docs.python.org/3.11/
Expand All @@ -241,7 +239,7 @@ Supported versions can be found in our ``noxfile.py`` `config`_.
.. _config: https://github.com/googleapis/python-bigquery-sqlalchemy/blob/main/noxfile.py


We also explicitly decided to support Python 3 beginning with version 3.8.
We also explicitly decided to support Python 3 beginning with version 3.9.
Reasons for this include:

- Encouraging use of newest versions of Python 3
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ dependencies.

Supported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^
Python >= 3.8, <3.14
Python >= 3.9, <3.14

Unsupported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
22 changes: 5 additions & 17 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
"setup.py",
]

DEFAULT_PYTHON_VERSION = "3.8"
DEFAULT_PYTHON_VERSION = "3.10"

UNIT_TEST_PYTHON_VERSIONS: List[str] = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
UNIT_TEST_PYTHON_VERSIONS: List[str] = ["3.9", "3.10", "3.11", "3.12", "3.13"]
UNIT_TEST_STANDARD_DEPENDENCIES = [
"mock",
"asyncmock",
Expand All @@ -56,11 +56,6 @@
"tests",
]
UNIT_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {
"3.8": [
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to change this to 3.9 instead?

Copy link
Collaborator Author

@chalmerlowe chalmerlowe Jul 24, 2025

Choose a reason for hiding this comment

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

Broadly, the unit & system test extras are not handled well in this (and likely all our noxfiles). As I will show below, we do fully test this library during unit tests, but I think it could be cleaned up (determine which extras need to be done with which Python versions, why, provide comments to clarify the why, and ensure that the logic across the setup.py, owlbot.py, noxfile.py are all in sync, etc.). I recommend that the clean up be a separate Issue as out of scope for the focus of this PR.

For unit tests, our noxfile currently overrides the effect of the variable
UNIT_TEST_EXTRAS_BY_PYTHON. UNIT_TEST_EXTRAS_BY_PYTHON is used in the function install_unittest_dependencies().

In the unit session there is another snippet that also selects extras to be installed. As can be seen below, for any Python version from 3.11-3.13 we test against alembic. But we see that for any Python version outside of 3.11-3.13 we test against all extras, which by definition in setup.py includes alembic.

if install_extras and session.python in ["3.11", "3.12", "3.13"]:
    install_target = ".[geography,alembic,tests,bqstorage]"
elif install_extras:
    install_target = ".[all]"
else:
    install_target = "."
session.install("-e", install_target, "-c", constraints_path)

The truthfulness of this can be see in the Kokoro CI/CD results which show:

  • the install command: [all] versus [geography,alembic,tests,bqstorage] based on the Python version
  • the actual install results from pip freeze (which includes alembic in every case)
  • the successful run for the alembic tests (in every case)
  • NOTE: I only show two versions, but I hand-checked every version.

3.9 (shortened for space reasons):

nox > Running session unit-3.9(protobuf_implementation='cpp')
...
nox > python -m pip install -e '.[all]' -c /tmpfs/src/github/python-bigquery-sqlalchemy/testing/constraints-3.9.txt
...
nox > python -m pip freeze
alembic==1.16.4
asyncmock==0.4.2
...
tests/unit/test__types.py ...........                                    [  9%]
tests/unit/test_alembic.py ..                                            [ 10%]
tests/unit/test_catalog_functions.py ................................... [ 21%]

3.13 (shortened for space reasons):

nox > Running session unit-3.13(protobuf_implementation='upb')
...
nox > python -m pip install -e '.[geography,alembic,tests,bqstorage]' -c /tmpfs/src/github/python-bigquery-sqlalchemy/testing/constraints-3.13.txt
nox > python -m pip freeze
alembic==1.16.4
asyncmock==0.4.2
...
tests/unit/test_alembic.py ..                                            [ 10%]
tests/unit/test_catalog_functions.py ................................... [ 21%]

"tests",
"alembic",
"bqstorage",
],
"3.11": [
"tests",
"geography",
Expand All @@ -78,7 +73,7 @@
],
}

SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.8", "3.12", "3.13"]
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.9", "3.12", "3.13"]
SYSTEM_TEST_STANDARD_DEPENDENCIES: List[str] = [
"mock",
"pytest",
Expand All @@ -91,11 +86,6 @@
"tests",
]
SYSTEM_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {
"3.8": [
"tests",
"alembic",
"bqstorage",
],
"3.12": [
"tests",
"geography",
Expand Down Expand Up @@ -398,10 +388,8 @@ def compliance(session):
"-c",
constraints_path,
)
if session.python == "3.8":
extras = "[tests,alembic]"
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we still need coverage for alembic?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The compliance session selects extras slightly differently than the unit session.
I added alembic to this list of extras to account for that difference. DONE.

I assert that as part of the cleanup task discussed in another comment, all our noxfiles need to be checked to see when/why we choose to do some tests and not others. I suspect there was a historical reason that may OR may not apply.

elif session.python in ["3.12", "3.13"]:
extras = "[tests,geography]"
if session.python in ["3.12", "3.13"]:
extras = "[tests,geography,alembic]"
else:
extras = "[tests]"
session.install("-e", f".{extras}", "-c", constraints_path)
Expand Down
6 changes: 3 additions & 3 deletions owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
# ----------------------------------------------------------------------------
extras = ["tests"]
extras_by_python = {
"3.8": ["tests", "alembic", "bqstorage"],
Copy link
Contributor

Choose a reason for hiding this comment

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

It feels like we need to change this into 3.9 too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added 3.9 with alembic as a system test.

NOTE: there appear to be issues with how owlbot and noxfile, etc are interacting, much like described above for the unit tests. That should be looked into as part of a separate cleanup task.

"3.9": ["tests", "alembic", "bqstorage"],
"3.11": ["tests", "geography", "bqstorage"],
"3.12": ["tests", "geography", "bqstorage"],
"3.13": ["tests", "geography", "bqstorage"],
}
templated_files = common.py_library(
unit_test_python_versions=["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"],
system_test_python_versions=["3.8", "3.12", "3.13"],
unit_test_python_versions=["3.9", "3.10", "3.11", "3.12", "3.13"],
system_test_python_versions=["3.9", "3.12", "3.13"],
cov_level=100,
unit_test_extras=extras,
unit_test_extras_by_python=extras_by_python,
Expand Down
3 changes: 0 additions & 3 deletions samples/snippets/requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ google-auth==2.40.3
google-cloud-testutils==1.6.4
iniconfig==2.1.0
packaging==25.0
pluggy===1.5.0; python_version == '3.8'
pluggy==1.6.0; python_version >= '3.9'
py==1.11.0
pyasn1==0.6.1
pyasn1-modules==0.4.2
pyparsing===3.1.4; python_version == '3.8'
pyparsing==3.2.3; python_version >= '3.9'
pytest===6.2.5
rsa==4.9.1
six==1.17.0
toml==0.10.2
typing-extensions===4.13.0; python_version == '3.8'
typing-extensions==4.14.1; python_version >= '3.9'
13 changes: 0 additions & 13 deletions samples/snippets/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,37 +1,26 @@
alembic===1.14.0; python_version == '3.8'
alembic==1.16.4; python_version >= '3.9'
certifi==2025.7.14
charset-normalizer==3.4.2
geoalchemy2==0.17.1
google-api-core[grpc]==2.25.1
google-auth==2.40.3
google-cloud-bigquery===3.30.0; python_version == '3.8'
google-cloud-bigquery==3.35.0; python_version >= '3.9'
google-cloud-core==2.4.3
google-crc32c===1.5.0; python_version == '3.8'
google-crc32c==1.7.1; python_version >= '3.9'
google-resumable-media==2.7.2
googleapis-common-protos==1.70.0
greenlet===3.1.1; python_version == '3.8'
greenlet==3.2.3; python_version >= '3.9'
grpcio===1.68.0; python_version == '3.8'
grpcio==1.73.1; python_version >= '3.9'
grpcio-status===1.68.0; python_version == '3.8'
grpcio-status==1.73.1; python_version >= '3.9'
idna==3.10
importlib-resources===6.4.5; python_version == '3.8'
importlib-resources==6.5.2; python_version >= '3.9'
mako===1.3.5; python_version == '3.8'
mako==1.3.10; python_version >= '3.9'
markupsafe===2.1.5; python_version == '3.8'
markupsafe==3.0.2; python_version >= '3.9'
packaging==25.0
proto-plus==1.26.1
protobuf===5.28.3; python_version == '3.8'
protobuf==6.31.1; python_version >= '3.9'
pyasn1==0.6.1
pyasn1-modules==0.4.2
pyparsing===3.1.4; python_version == '3.8'
pyparsing==3.2.3; python_version >= '3.9'
python-dateutil==2.9.0.post0
pytz==2025.2
Expand All @@ -41,7 +30,5 @@ shapely===2.0.7; python_version <= '3.9'
shapely==2.1.1; python_version >= '3.10'
six==1.17.0
sqlalchemy===1.4.27
typing-extensions===4.13.0; python_version == '3.8'
typing-extensions==4.14.1; python_version >= '3.9'
urllib3===2.2.3; python_version == '3.8'
urllib3==2.5.0; python_version >= '3.9'
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def readme():
# https://github.com/grpc/grpc/pull/15254
"grpcio >= 1.47.0, < 2.0.0",
"grpcio >= 1.49.1, < 2.0.0; python_version>='3.11'",
"pyarrow >= 3.0.0",
"pyarrow >= 5.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Confirming - tests would fail if there were consequences to this +2 major version jump, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Tests will fail.
For context: the current version of pyarrow is 20.0
Why version 5.0?:

  • Version 5.0 came out in 2021.
  • Version 3.0 and version 4.0 do NOT run on Python 3.9.
  • Version 5.0 is the first and oldest version that ran on Python 3.9.

],
}

Expand Down
11 changes: 7 additions & 4 deletions sqlalchemy_bigquery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,17 @@
from . import _versions_helpers

sys_major, sys_minor, sys_micro = _versions_helpers.extract_runtime_version()
if sys_major == 3 and sys_minor in (7, 8):

# Now that support for Python 3.7 and 3.8 has been removed, we don't expect the
# following check to succeed. The warning is only included for robustness.
if sys_major == 3 and sys_minor in (7, 8): # pragma: NO COVER
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-sqlalchemy 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,
FutureWarning,
)


Expand Down
13 changes: 0 additions & 13 deletions testing/constraints-3.8.txt

This file was deleted.

13 changes: 13 additions & 0 deletions testing/constraints-3.9.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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.16
google-auth==1.25.0
google-cloud-bigquery==3.3.6
google-cloud-bigquery-storage==2.0.0
google-api-core==1.31.5
grpcio==1.47.0
numpy==1.26.4