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

feat: Py310 & Runtime Python Verison Check #368

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci_decrypt-oracle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: actions/setup-python@v2
with:
# The oracle runs in a Python 3.6 Lamba
python-version: 3.6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_static-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- isort-check
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: actions/setup-python@v2
with:
python-version: 3.8
- run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_test-vector-handler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
aws-secret-access-key: ${{ secrets.INTEG_AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.architecture }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
architecture: x86
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: actions/setup-python@v2
texastony marked this conversation as resolved.
Show resolved Hide resolved
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.architecture }}
Expand Down
8 changes: 8 additions & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ batch:
buildspec: codebuild/py39/examples.yml
- identifier: py39_awses_latest

- identifier: py310_integ
buildspec: codebuild/py310/integ.yml
- identifier: py310_examples
buildspec: codebuild/py310/examples.yml
- identifier: py310_awses_latest
buildspec: codebuild/py310/awses_local.yml


- identifier: code_coverage
buildspec: codebuild/coverage/coverage.yml

Expand Down
27 changes: 27 additions & 0 deletions codebuild/py310/awses_local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: 0.2

env:
variables:
TOXENV: "py310-awses_local"
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID: >-
arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID_2: >-
arn:aws:kms:eu-central-1:658956600833:key/75414c93-5285-4b57-99c9-30c1cf0a22c2
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_1: >-
arn:aws:kms:us-west-2:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_2: >-
arn:aws:kms:us-east-1:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
AWS_ENCRYPTION_SDK_PYTHON_DECRYPT_ORACLE_API_DEPLOYMENT_ID: "xi1mwx3ttb"
AWS_ENCRYPTION_SDK_PYTHON_DECRYPT_ORACLE_REGION: "us-west-2"

phases:
install:
runtime-versions:
python: latest
build:
commands:
- pyenv install 3.10.0
- pyenv local 3.10.0
- pip install tox tox-pyenv
- cd test_vector_handlers
- tox
24 changes: 24 additions & 0 deletions codebuild/py310/examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: 0.2

env:
variables:
TOXENV: "py310-examples"
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID: >-
arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID_2: >-
arn:aws:kms:eu-central-1:658956600833:key/75414c93-5285-4b57-99c9-30c1cf0a22c2
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_1: >-
arn:aws:kms:us-west-2:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_2: >-
arn:aws:kms:us-east-1:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7

phases:
install:
runtime-versions:
python: latest
build:
commands:
- pyenv install 3.10.0
- pyenv local 3.10.0
- pip install tox tox-pyenv
- tox
24 changes: 24 additions & 0 deletions codebuild/py310/integ.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: 0.2

env:
variables:
TOXENV: "py310-integ"
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID: >-
arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID_2: >-
arn:aws:kms:eu-central-1:658956600833:key/75414c93-5285-4b57-99c9-30c1cf0a22c2
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_1: >-
arn:aws:kms:us-west-2:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_2: >-
arn:aws:kms:us-east-1:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7

phases:
install:
runtime-versions:
python: latest
build:
commands:
- pyenv install 3.10.0
- pyenv local 3.10.0
- pip install tox tox-pyenv
- tox
4 changes: 2 additions & 2 deletions codebuild/py35/awses_local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ phases:
python: latest
build:
commands:
- pyenv install 3.5.9
- pyenv local 3.5.9
- pyenv install 3.5.10
- pyenv local 3.5.10
- pip install tox tox-pyenv
- cd test_vector_handlers
- tox
4 changes: 2 additions & 2 deletions codebuild/py35/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ phases:
python: latest
build:
commands:
- pyenv install 3.5.9
- pyenv local 3.5.9
- pyenv install 3.5.10
- pyenv local 3.5.10
- pip install tox tox-pyenv
- tox
4 changes: 2 additions & 2 deletions codebuild/py35/integ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ phases:
python: latest
build:
commands:
- pyenv install 3.5.9
- pyenv local 3.5.9
- pyenv install 3.5.10
- pyenv local 3.5.10
- pip install tox tox-pyenv
- tox
4 changes: 3 additions & 1 deletion codebuild/py36/awses_local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ phases:
python: latest
build:
commands:
- pip install tox
- pyenv install 3.6.15
- pyenv local 3.6.15
- pip install tox tox-pyenv
- cd test_vector_handlers
- tox
4 changes: 3 additions & 1 deletion codebuild/py36/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ phases:
python: latest
build:
commands:
- pip install tox
- pyenv install 3.6.15
- pyenv local 3.6.15
- pip install tox tox-pyenv
- tox
4 changes: 3 additions & 1 deletion codebuild/py36/integ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ phases:
python: latest
build:
commands:
- pip install tox
- pyenv install 3.6.15
- pyenv local 3.6.15
- pip install tox tox-pyenv
- tox
4 changes: 2 additions & 2 deletions codebuild/py37/awses_local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ phases:
python: latest
build:
commands:
- pyenv install 3.7.9
- pyenv local 3.7.9
- pyenv install 3.7.12
- pyenv local 3.7.12
- pip install tox tox-pyenv
- cd test_vector_handlers
- tox
4 changes: 2 additions & 2 deletions codebuild/py37/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ phases:
python: latest
build:
commands:
- pyenv install 3.7.9
- pyenv local 3.7.9
- pyenv install 3.7.12
- pyenv local 3.7.12
- pip install tox tox-pyenv
- tox
4 changes: 2 additions & 2 deletions codebuild/py37/integ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ phases:
python: latest
build:
commands:
- pyenv install 3.7.9
- pyenv local 3.7.9
- pyenv install 3.7.12
- pyenv local 3.7.12
- pip install tox tox-pyenv
- tox
4 changes: 2 additions & 2 deletions codebuild/py38/awses_local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ phases:
python: latest
build:
commands:
- pyenv install 3.8.6
- pyenv local 3.8.6
- pyenv install 3.8.12
- pyenv local 3.8.12
- pip install tox tox-pyenv
- cd test_vector_handlers
- tox
4 changes: 2 additions & 2 deletions codebuild/py38/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ phases:
python: latest
build:
commands:
- pyenv install 3.8.6
- pyenv local 3.8.6
- pyenv install 3.8.12
- pyenv local 3.8.12
- pip install tox tox-pyenv
- tox
4 changes: 2 additions & 2 deletions codebuild/py38/integ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ phases:
python: latest
build:
commands:
- pyenv install 3.8.6
- pyenv local 3.8.6
- pyenv install 3.8.12
- pyenv local 3.8.12
- pip install tox tox-pyenv
- tox
4 changes: 2 additions & 2 deletions codebuild/py39/awses_1.7.1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ phases:
python: latest
build:
commands:
- pyenv install 3.9.0
- pyenv local 3.9.0
- pyenv install 3.9.7
- pyenv local 3.9.7
- pip install tox tox-pyenv
- cd test_vector_handlers
- tox
4 changes: 2 additions & 2 deletions codebuild/py39/awses_2.0.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ phases:
python: latest
build:
commands:
- pyenv install 3.9.0
- pyenv local 3.9.0
- pyenv install 3.9.7
- pyenv local 3.9.7
- pip install tox tox-pyenv
- cd test_vector_handlers
- tox
4 changes: 2 additions & 2 deletions codebuild/py39/awses_latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ phases:
python: latest
build:
commands:
- pyenv install 3.9.0
- pyenv local 3.9.0
- pyenv install 3.9.7
- pyenv local 3.9.7
- pip install tox tox-pyenv
- cd test_vector_handlers
- tox
4 changes: 2 additions & 2 deletions codebuild/py39/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ phases:
python: latest
build:
commands:
- pyenv install 3.9.0
- pyenv local 3.9.0
- pyenv install 3.9.7
- pyenv local 3.9.7
- pip install tox tox-pyenv
- tox
4 changes: 2 additions & 2 deletions codebuild/py39/integ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ phases:
python: latest
build:
commands:
- pyenv install 3.9.0
- pyenv local 3.9.0
- pyenv install 3.9.7
- pyenv local 3.9.7
- pip install tox tox-pyenv
- tox
1 change: 1 addition & 0 deletions decrypt_oracle/src/pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
disable =
bad-continuation, # we let black handle this
ungrouped-imports, # we let isort handle this
consider-using-f-string # disable until 2022-05-05; 6 months after 3.5 deprecation

[FORMAT]
max-line-length = 120
Expand Down
1 change: 1 addition & 0 deletions decrypt_oracle/test/pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ disable =
missing-docstring, # we don't write docstrings for tests
bad-continuation, # we let black handle this
ungrouped-imports, # we let isort handle this
consider-using-f-string # disable until 2022-05-05; 6 months after 3.5 deprecation

[FORMAT]
max-line-length = 120
Expand Down
1 change: 1 addition & 0 deletions examples/src/pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ disable =
attribute-defined-outside-init, # breaks with attrs_post_init
abstract-method, # throws false positives on io.BaseIO grandchildren
redefined-outer-name, # we do this on purpose in multiple places
consider-using-f-string # disable until 2022-05-05; 6 months after 3.5 deprecation

[BASIC]
# Allow function names up to 50 characters
Expand Down
1 change: 1 addition & 0 deletions examples/test/pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ disable =
# unknown modules as non-standard-library. flake8 tests for this as well
# and does treat them properly
duplicate-code, # tests for similar things tend to be similar
consider-using-f-string # disable until 2022-05-05; 6 months after 3.5 deprecation

[VARIABLES]
additional-builtins = raw_input
Expand Down
5 changes: 3 additions & 2 deletions src/aws_encryption_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
# language governing permissions and limitations under the License.
"""High level AWS Encryption SDK client functions."""
# Below are imported for ease of use by implementors

import warnings

import attr

from aws_encryption_sdk.caches.local import LocalCryptoMaterialsCache # noqa
from aws_encryption_sdk.caches.null import NullCryptoMaterialsCache # noqa
from aws_encryption_sdk.exceptions import AWSEncryptionSDKClientError # noqa
from aws_encryption_sdk.identifiers import Algorithm, CommitmentPolicy, __version__ # noqa
from aws_encryption_sdk.identifiers import Algorithm, CommitmentPolicy, __version__, check_python_version # noqa
from aws_encryption_sdk.internal.utils.signature import SignaturePolicy # noqa
from aws_encryption_sdk.key_providers.kms import ( # noqa
DiscoveryAwsKmsMasterKeyProvider,
Expand All @@ -36,6 +35,8 @@
StreamEncryptor,
)

check_python_version()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@farleyb-amazon I do not know how to force a Runtime Check, but I think this will work.
Do you know of another way?
I fear that this could run multiple times in an application if they load the library multiple times; but I guess I am willing to allow that to happen.
I also assume that __init__ will ALWAYS be parsed if any part of this library is used. I think that assumption is accurate... but I cannot swear it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By my understanding __init__ will run anytime the module is imported, so this should be good. As you said it might run multiple times, but I don't mind that either.



@attr.s(hash=True)
class EncryptionSDKClientConfig(object):
Expand Down
Loading