File tree Expand file tree Collapse file tree 4 files changed +60
-0
lines changed
Expand file tree Collapse file tree 4 files changed +60
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,16 @@ Supported Python Versions
3737^^^^^^^^^^^^^^^^^^^^^^^^^
3838Python >= 3.7
3939
40+ **NOTE **:
41+ Python 3.7 was marked as `unsupported `_ by the python community in June 2023.
42+ We recommend that all developers upgrade to Python 3.8 and newer as soon as
43+ they can. Support for Python 3.7 will be removed from this library after
44+ January 1 2024. Previous releases that support Python 3.7 will continue to be available
45+ for download, but releases after January 1 2024 will only target Python 3.8 and
46+ newer.
47+
48+ .. _unsupported : https://devguide.python.org/versions/#unsupported-versions
49+
4050Unsupported Python Versions
4151^^^^^^^^^^^^^^^^^^^^^^^^^^^
4252- Python == 2.7: The last version of this library with support for Python 2.7
Original file line number Diff line number Diff line change 1515"""Google Auth Library for Python."""
1616
1717import logging
18+ import sys
19+ import warnings
1820
1921from google .auth import version as google_auth_version
2022from google .auth ._default import (
2931
3032__all__ = ["default" , "load_credentials_from_file" , "load_credentials_from_dict" ]
3133
34+
35+ class Python37DeprecationWarning (DeprecationWarning ): # pragma: NO COVER
36+ """
37+ Deprecation warning raised when Python 3.7 runtime is detected.
38+ Python 3.7 support will be dropped after January 1, 2024. See
39+ https://cloud.google.com/python/docs/python37-sunset/ for more information.
40+ """
41+
42+ pass
43+
44+
45+ # Checks if the current runtime is Python 3.7.
46+ if sys .version_info .major == 3 and sys .version_info .minor == 7 : # pragma: NO COVER
47+ message = (
48+ "After January 1, 2024, new releases of this library will drop support "
49+ "for Python 3.7. More details about Python 3.7 support "
50+ "can be found at https://cloud.google.com/python/docs/python37-sunset/"
51+ )
52+
53+ # Configure the Python37DeprecationWarning warning so that it is only emitted once.
54+ warnings .simplefilter ("once" , Python37DeprecationWarning )
55+ warnings .warn (message , Python37DeprecationWarning )
56+
3257# Set default logging handler to avoid "No handler found" warnings.
3358logging .getLogger (__name__ ).addHandler (logging .NullHandler ())
Original file line number Diff line number Diff line change 1313# limitations under the License.
1414
1515"""Google OAuth 2.0 Library for Python."""
16+
17+ import sys
18+ import warnings
19+
20+
21+ class Python37DeprecationWarning (DeprecationWarning ): # pragma: NO COVER
22+ """
23+ Deprecation warning raised when Python 3.7 runtime is detected.
24+ Python 3.7 support will be dropped after January 1, 2024. See
25+ https://cloud.google.com/python/docs/python37-sunset/ for more information.
26+ """
27+
28+ pass
29+
30+
31+ # Checks if the current runtime is Python 3.7.
32+ if sys .version_info .major == 3 and sys .version_info .minor == 7 : # pragma: NO COVER
33+ message = (
34+ "After January 1, 2024, new releases of this library will drop support "
35+ "for Python 3.7. More details about Python 3.7 support "
36+ "can be found at https://cloud.google.com/python/docs/python37-sunset/"
37+ )
38+ # Configure the Python37DeprecationWarning warning so that it is only emitted once.
39+ warnings .simplefilter ("once" , Python37DeprecationWarning )
40+ warnings .warn (message , Python37DeprecationWarning )
You can’t perform that action at this time.
0 commit comments