Skip to content

fix(api-core): drop support for Python 3.9#16980

Open
chalmerlowe wants to merge 15 commits intomainfrom
feat/drop-python-3.7-3.9-google-api-core
Open

fix(api-core): drop support for Python 3.9#16980
chalmerlowe wants to merge 15 commits intomainfrom
feat/drop-python-3.7-3.9-google-api-core

Conversation

@chalmerlowe
Copy link
Copy Markdown
Contributor

This PR updates google-api-core to establish Python 3.10 as the minimum supported version, dropping support for Python 3.9 and below.

Changes

Configuration: Updated pyproject.toml and noxfile.py to require Python 3.10+ and remove references to Python 3.7, 3.8, and 3.9. Updated README.rst and CONTRIBUTING.rst to reflect the new support status.
Cleanup: Removed aiter and anext polyfills in test_bidi_async.py and removed Python < 3.10 polyfills in _python_version_support.py.
Constraints & Dependencies:

  • Created constraints-3.10.txt using the old 3.9 constraints as a baseline.
  • Bumped grpcio to 1.80.0 and requests to 2.33.0 to avoid issues with pkg_resources and six warnings on Python 3.10.
  • Bumped google-auth to 2.35.0 to satisfy async_rest requirements.
    Fixes internal issue: http://b/482126936 🦕

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request drops support for Python 3.9, updating documentation, metadata, and CI configurations to set the minimum requirement to Python 3.10. The changes include removing compatibility shims for older Python versions and refactoring logic to utilize features like match statements. Feedback indicates a potential regression in noxfile.py where the new match statement for legacy_proto does not explicitly handle False values, which could lead to assertion failures during testing.

Comment thread packages/google-api-core/noxfile.py
@chalmerlowe chalmerlowe added this to the Drop support for 3.7-3.9 milestone May 7, 2026
Comment thread packages/google-api-core/noxfile.py Outdated
requests==2.33.0
grpcio==1.80.0
grpcio-status==1.33.2
proto-plus==1.22.3
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.

How about

# Some tests import aiohttp to test async rest
# from google-auth[aiohttp]
#   google-auth[aiohttp] v2.39.0 is the first release that requires aiohttp 3.6.2
#   see - change: https://github.com/googleapis/google-auth-library-python/blame/9d5c0d81e8e69719a2b4cd034bf1ed5d128fdf0a/setup.py#L35
#       - release: https://github.com/googleapis/google-auth-library-python/commits/main/?after=9d5c0d81e8e69719a2b4cd034bf1ed5d128fdf0a+104
aiohttp==3.6.2

from packages/google-api-core/testing/constraints-async-rest-3.9.txt

We still need aiohttp right?


# TODO: remove this when droppping support for "Python 3.10" and below.
if sys.version_info < (3, 10): # type: ignore[operator]
if sys.version_info <= (3, 10): # type: ignore[operator]
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.

Before we had

# TODO: remove this when dropping support for "Python 3.10" and below.
if sys.version_info < (3, 10):  # type: ignore[operator]

It's not clear whether the original comment was wrong or the code was wrong. Can you add a comment with more context? What feature are we relying on that is only in 3.10?

@@ -49,7 +48,7 @@ dependencies = [
"proto-plus >= 1.22.3, < 2.0.0",
"proto-plus >= 1.25.0, < 2.0.0; python_version >= '3.13'",
"google-auth >= 2.14.1, < 3.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.

Does the minimum version here need to be updated as well (since we updated constraints)?

@parthea parthea changed the title feat(api-core): drop support for Python 3.7, 3.8, and 3.9 fix(api-core): drop support for Python 3.7, 3.8, and 3.9 May 7, 2026
@parthea parthea changed the title fix(api-core): drop support for Python 3.7, 3.8, and 3.9 fix(api-core): drop support for Python 3.9 May 7, 2026
@parthea parthea marked this pull request as ready for review May 7, 2026 18:56
@parthea parthea requested a review from a team as a code owner May 7, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants