Skip to content

Commit

Permalink
Suppress warning from cryptography 37 about deprecated Python 3.6 sup…
Browse files Browse the repository at this point in the history
…port

Version 37 still works on Python 3.6 but the deprecation causes loud,
user-visible warnings when running any command.

Version 38 will likely drop support, leaving 37 as the highest available
version on 3.6.  This is more reason to drop 3.6 ourselves eventually as
we'll not want to be using an older and older cryptography release.  In
the meantime, however, squash the warning since it does no good for end
users.  Frustratingly, cryptography appears to have intentionally made
this a UserWarning instead of a DeprecationWarning because they wanted
to force its visibility.
  • Loading branch information
tsibley committed Jun 7, 2022
1 parent d101787 commit 3977fee
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions nextstrain/cli/aws/cognito/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@
AWS Cognito helpers.
"""
import boto3
import jwt
import jwt.exceptions
import warnings

# Ignore noisy warning from cryptography 37.0.0 about deprecated support for Python 3.6.
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
message = "Python 3\\.6 is no longer supported by the Python core team\\. Therefore, support for it is deprecated in cryptography and will be removed in a future release\\.",
category = UserWarning)

import jwt
import jwt.exceptions

from .srp import CognitoSRP, NewPasswordRequiredError

Expand Down

0 comments on commit 3977fee

Please sign in to comment.