Skip to content
This repository was archived by the owner on May 16, 2026. It is now read-only.

feat: remove python 3.8 support - #1215

Merged
chalmerlowe merged 9 commits into
mainfrom
remove-python-3.8
Jul 24, 2025
Merged

feat: remove python 3.8 support#1215
chalmerlowe merged 9 commits into
mainfrom
remove-python-3.8

Conversation

@chalmerlowe

@chalmerlowechalmerlowe commented Jul 21, 2025

Copy link
Copy Markdown
Contributor
  • Removes Python 3.8 support because 3.8 is End of Life.
  • Includes minor edits to support this change in configs and in the code

Also adds several minor tweaks that were useful for debugging some of the mods to this PR (and are useful in general for all future debugging efforts), such as:

  • pip freeze to display what dependencies have been installed
    * UPDATE: removed upon request: @calculate_duration decorator to confirm the total time to execute a nox session.

@chalmerlowe
chalmerlowe requested a review from a team as a code ownerJuly 21, 2025 14:09
@product-auto-labelproduct-auto-labelBot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/python-bigquery-sqlalchemy API. samples Issues that are directly related to samples. labels Jul 21, 2025
@chalmerlowechalmerlowe added the kokoro:run Add this label to force Kokoro to re-run the tests. label Jul 23, 2025
@yoshi-kokoroyoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Jul 23, 2025
@chalmerlowe
chalmerlowe requested a review from LinchinJuly 23, 2025 16:44
@chalmerlowechalmerlowe added the automerge Merge the pull request once unit tests and other checks pass. label Jul 23, 2025
Comment threadnoxfile.py
"tests",
]
UNIT_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {
"3.8": [

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.

Do we want to change this to 3.9 instead?

@chalmerlowechalmerloweJul 24, 2025

Copy link
Copy Markdown
ContributorAuthor

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%]

Comment threadCONTRIBUTING.rst Outdated
.. 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.12, and 3.13.

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.

Need to add 3.9 here

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Good catch, thanks! Fixed.

Comment threadnoxfile.py
constraints_path,
)
if session.python == "3.8":
extras = "[tests,alembic]"

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.

I wonder if we still need coverage for alembic?

Copy link
Copy Markdown
ContributorAuthor

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.

Comment threadowlbot.py
# ----------------------------------------------------------------------------
extras = ["tests"]
extras_by_python = {
"3.8": ["tests", "alembic", "bqstorage"],

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.

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

Copy link
Copy Markdown
ContributorAuthor

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.

Comment threadnoxfile.py Outdated
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()


def _calculate_duration(func):

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.

If this is not necessary to the 3.8 removal and is a "would be nice", please split into a second PR - I'm happy to be a reviewer for it!

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I removed this code.

Comment threadsetup.py
"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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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.

@chalmerlowe
chalmerlowe merged commit 632d6ef into mainJul 24, 2025
15 checks passed
@chalmerlowe
chalmerlowe deleted the remove-python-3.8 branch July 24, 2025 18:22
@release-pleaserelease-pleaseBot mentioned this pull request Jul 24, 2025
parthea pushed a commit that referenced this pull request Nov 6, 2025
🤖 I have created a release *beep* *boop*
---
##
[1.16.0](v1.15.0...v1.16.0)
(2025-11-05)
### Features
* Add support for Python 3.14
([#1278](#1278))
([c09a009](c09a009))
* Remove python 3.8 support
([#1215](#1215))
([632d6ef](632d6ef))
---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit to googleapis/google-cloud-python that referenced this pull request Nov 24, 2025
🤖 I have created a release *beep* *boop*
---
##
[1.16.0](googleapis/python-bigquery-sqlalchemy@v1.15.0...v1.16.0)
(2025-11-05)
### Features
* Add support for Python 3.14
([#1278](googleapis/python-bigquery-sqlalchemy#1278))
([c09a009](googleapis/python-bigquery-sqlalchemy@c09a009))
* Remove python 3.8 support
([#1215](googleapis/python-bigquery-sqlalchemy#1215))
([632d6ef](googleapis/python-bigquery-sqlalchemy@632d6ef))
---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: bigqueryIssues related to the googleapis/python-bigquery-sqlalchemy API.automergeMerge the pull request once unit tests and other checks pass.samplesIssues that are directly related to samples.size: mPull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@chalmerlowe@leahecole@Linchin@logachev@yoshi-kokoro