-
Notifications
You must be signed in to change notification settings - Fork 346
chore: remove Python 3.7 support #1919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
9757c79
0447128
a439b11
fd79ff5
66b9985
d7d4380
6e34ed7
08312f5
0c69825
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,15 +35,16 @@ Note that the extras pyopenssl and enterprise_cert should not be used together b | |
|
|
||
| Supported Python Versions | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| Python >= 3.7 | ||
| Python >= 3.8 | ||
|
|
||
| **NOTE**: | ||
| Python 3.7 was marked as `unsupported`_ by the python community in June 2023. | ||
| We recommend that all developers upgrade to Python 3.8 and newer as soon as | ||
| they can. Support for Python 3.7 will be removed from this library after | ||
| January 1 2024. Previous releases that support Python 3.7 will continue to be available | ||
| for download, but releases after January 1 2024 will only target Python 3.8 and | ||
| newer. | ||
| Python 3.8 and Python 3.9 were marked as `unsupported`_ by the python community in | ||
| October 2024 and October 2025 respectively. | ||
daniel-sanche marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| We recommend that all developers upgrade to Python 3.10 and newer as soon as | ||
| they can. Support for end-of-life Python runtimes will be removed from this | ||
| library in future updates. | ||
| Previous releases that support end-of-life Python versions will continue to be available | ||
| for download, but future releases will only target supported versions. | ||
|
|
||
| .. _unsupported: https://devguide.python.org/versions/#unsupported-versions | ||
|
|
||
|
|
@@ -58,6 +59,10 @@ Unsupported Python Versions | |
| - Python 3.6: The last version of this library with support for Python 3.6 | ||
| was `google.auth == 2.22.0`. | ||
|
|
||
| - Python 3.7: The last version of this library with support for Python 3.7 | ||
| was `google.auth == 2.45.0`. | ||
|
|
||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| Documentation | ||
| ------------- | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,10 +27,14 @@ class Python37DeprecationWarning(DeprecationWarning): # pragma: NO COVER | |
| pass | ||
|
|
||
|
|
||
| # Checks if the current runtime is Python 3.7. | ||
| if sys.version_info.major == 3 and sys.version_info.minor == 7: # pragma: NO COVER | ||
| message = ( | ||
| "After January 1, 2024, new releases of this library will drop support " | ||
| "for Python 3.7." | ||
| ) | ||
| warnings.warn(message, Python37DeprecationWarning) | ||
| # Raise warnings for deprecated versions | ||
| eol_message = """ | ||
| You are using a Python version {} past its end of life. Google will update | ||
| google-auth with critical bug fixes on a best-effort basis, but not | ||
| with any other fixes or features. Please upgrade your Python version, | ||
| and then update google-auth. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do google/auth and google/oauth2 get released as part of the same PyPI package? In that case, could we re-use this check rather than duplicating it? If not, should this message say "google-oauth2"?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe it's all released as a single package I worry a bit about complications importing from one package to the other, or adding shared logic to the root I can try to look into it a bit more, but we do need something working today, since this is blocking a release
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, it looks like:
These lines are meant to be temporary, and will be replaced by your more robust version check system soon. I opened a bug to track that work. Let me know what you think
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sgtm. (I'd make the bug a p2 chore, but we can discuss that separately.) |
||
| """ | ||
| if sys.version_info.major == 3 and sys.version_info.minor == 8: # pragma: NO COVER | ||
| warnings.warn(eol_message.format("3.8"), FutureWarning) | ||
| elif sys.version_info.major == 3 and sys.version_info.minor == 9: # pragma: NO COVER | ||
| warnings.warn(eol_message.format("3.9"), FutureWarning) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # Copyright 2026 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| import importlib | ||
| import sys | ||
| from unittest import mock | ||
| import warnings | ||
|
|
||
| import pytest | ||
|
|
||
| import google.auth | ||
| import google.oauth2 | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("module", [google.auth, google.oauth2]) | ||
| @pytest.mark.parametrize( | ||
| "version, expected_warning", | ||
| [ | ||
| ((3, 8), True), | ||
| ((3, 9), True), | ||
| ((3, 10), False), | ||
| ((3, 13), False), | ||
| ], | ||
| ) | ||
| def test_python_version_warnings(module, version, expected_warning): | ||
| # Mock sys.version_info | ||
| # We use a MagicMock that has major and minor attributes | ||
| mock_version = mock.Mock() | ||
| mock_version.major = version[0] | ||
| mock_version.minor = version[1] | ||
|
|
||
| with mock.patch.object(sys, "version_info", mock_version): | ||
| with warnings.catch_warnings(record=True) as caught_warnings: | ||
| warnings.simplefilter("always") | ||
| importlib.reload(module) | ||
|
|
||
| future_warnings = [ | ||
| w | ||
| for w in caught_warnings | ||
| if issubclass(w.category, FutureWarning) | ||
| and "past its end of life" in str(w.message) | ||
| ] | ||
|
|
||
| if expected_warning: | ||
| assert ( | ||
| len(future_warnings) > 0 | ||
| ), f"Expected FutureWarning for Python {version} in {module.__name__}" | ||
| assert str(version[1]) in str(future_warnings[0].message) | ||
| else: | ||
| assert ( | ||
| len(future_warnings) == 0 | ||
| ), f"Did not expect FutureWarning for Python {version} in {module.__name__}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line break occurs in the middle of a phrase, which can be slightly awkward to read in the raw RST file. For better readability, it would be best to have this sentence on a single line.