fix(api-core): drop support for Python 3.9#16980
Conversation
There was a problem hiding this comment.
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.
| requests==2.33.0 | ||
| grpcio==1.80.0 | ||
| grpcio-status==1.33.2 | ||
| proto-plus==1.22.3 |
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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", | |||
There was a problem hiding this comment.
Does the minimum version here need to be updated as well (since we updated constraints)?
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:
Fixes internal issue: http://b/482126936 🦕