Skip to content
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

chore: Remove support for Python 3.6 #1354

Merged
merged 10 commits into from
Aug 23, 2023
Prev Previous commit
Next Next commit
Add deprecation notice for 3.6 and 3.7.
clundin25 committed Aug 16, 2023
commit fb6b619899db0229ffaf5d7889af0470cda35095
39 changes: 39 additions & 0 deletions google/auth/__init__.py
Original file line number Diff line number Diff line change
@@ -15,6 +15,8 @@
"""Google Auth Library for Python."""

import logging
import sys
import warnings

from google.auth import version as google_auth_version
from google.auth._default import (
@@ -29,5 +31,42 @@

__all__ = ["default", "load_credentials_from_file", "load_credentials_from_dict"]

class Python37DeprecationWarning(DeprecationWarning):
"""
Deprecation warning raised when Python 3.7 runtime is detected.
Python 3.7 support will be dropped after October 1, 2023. See
https://cloud.google.com/python/docs/python37-sunset/ for more information.
"""
pass

class Python36DeprecationWarning(DeprecationWarning):
"""
Deprecation warning raised when Python 3.6 runtime is detected.
Python 3.6 support will be dropped after October 1, 2023.
"""
pass

# Checks if the current runtime is Python 3.7.
if sys.version_info.major == 3 and sys.version_info.minor == 7:
message = (
"After October 1, 2023, new releases of this library will drop support "
"for Python 3.7. More details about Python 3.7 support for Client Libraries "
"can be found at https://cloud.google.com/python/docs/python37-sunset/"
)
# Configure the Python37DeprecationWarning warning so that it is only emitted once.
warnings.simplefilter('once', Python37DeprecationWarning)
warnings.warn(message, Python37DeprecationWarning)

# Checks if the current runtime is Python 3.6.
if sys.version_info.major == 3 and sys.version_info.minor == 6:
message = (
"After October 1, 2023, new releases of this library will drop support "
"for Python 3.6."
)
# Configure the Python36DeprecationWarning warning so that it is only emitted once.
warnings.simplefilter('once', Python36DeprecationWarning)
warnings.warn(message, Python36DeprecationWarning)


# Set default logging handler to avoid "No handler found" warnings.
logging.getLogger(__name__).addHandler(logging.NullHandler())
39 changes: 39 additions & 0 deletions google/oauth2/__init__.py
Original file line number Diff line number Diff line change
@@ -13,3 +13,42 @@
# limitations under the License.

"""Google OAuth 2.0 Library for Python."""

import sys
import warnings

class Python37DeprecationWarning(DeprecationWarning):
"""
Deprecation warning raised when Python 3.7 runtime is detected.
Python 3.7 support will be dropped after October 1, 2023. See
https://cloud.google.com/python/docs/python37-sunset/ for more information.
"""
pass

class Python36DeprecationWarning(DeprecationWarning):
"""
Deprecation warning raised when Python 3.6 runtime is detected.
Python 3.6 support will be dropped after October 1, 2023.
"""
pass

# Checks if the current runtime is Python 3.7.
if sys.version_info.major == 3 and sys.version_info.minor == 7:
message = (
"After October 1, 2023, new releases of this library will drop support "
"for Python 3.7. More details about Python 3.7 support for Client Libraries "
"can be found at https://cloud.google.com/python/docs/python37-sunset/"
)
# Configure the Python37DeprecationWarning warning so that it is only emitted once.
warnings.simplefilter('once', Python37DeprecationWarning)
warnings.warn(message, Python37DeprecationWarning)

# Checks if the current runtime is Python 3.6.
if sys.version_info.major == 3 and sys.version_info.minor == 6:
message = (
"After October 1, 2023, new releases of this library will drop support "
"for Python 3.6."
)
# Configure the Python36DeprecationWarning warning so that it is only emitted once.
warnings.simplefilter('once', Python36DeprecationWarning)
warnings.warn(message, Python36DeprecationWarning)