From 60b54a6970dcdac0489a4e51b04b0d9fa4132313 Mon Sep 17 00:00:00 2001 From: Benjamin Farley Date: Thu, 1 Jul 2021 11:50:06 -0600 Subject: [PATCH 1/2] chore: Remove support for py2 --- README.rst | 7 +----- buildspec.yml | 7 ------ codebuild/py27/awses_local.yml | 25 ------------------- codebuild/py27/examples.yml | 22 ---------------- codebuild/py27/integ.yml | 22 ---------------- .../internal/crypto/elliptic_curve.py | 5 ++-- tox.ini | 19 +------------- 7 files changed, 4 insertions(+), 103 deletions(-) delete mode 100644 codebuild/py27/awses_local.yml delete mode 100644 codebuild/py27/examples.yml delete mode 100644 codebuild/py27/integ.yml diff --git a/README.rst b/README.rst index 821cb4209..b6feff4da 100644 --- a/README.rst +++ b/README.rst @@ -34,12 +34,7 @@ Getting Started Required Prerequisites ====================== -* Python 2.7+ or 3.4+ - - **NOTE: 2.x is the last major version of this library that will - support Python 2. Future major versions will begin to adopt changes - known to break Python 2. Python 3.4 support will also be removed - in future major versions; Python 3.5+ will be required.** +* Python 3.5+ * cryptography >= 2.5.0 * boto3 >= 1.10.0 * attrs diff --git a/buildspec.yml b/buildspec.yml index c1ccff093..461d4e0d2 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -3,13 +3,6 @@ version: 0.2 batch: fast-fail: false build-list: - - identifier: py27_integ - buildspec: codebuild/py27/integ.yml - - identifier: py27_examples - buildspec: codebuild/py27/examples.yml - - identifier: py27_awses_local - buildspec: codebuild/py27/awses_local.yml - - identifier: py35_integ buildspec: codebuild/py35/integ.yml - identifier: py35_examples diff --git a/codebuild/py27/awses_local.yml b/codebuild/py27/awses_local.yml deleted file mode 100644 index 4087f588a..000000000 --- a/codebuild/py27/awses_local.yml +++ /dev/null @@ -1,25 +0,0 @@ -version: 0.2 - -env: - variables: - TOXENV: "py27-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: - - pip install tox - - cd test_vector_handlers - - tox diff --git a/codebuild/py27/examples.yml b/codebuild/py27/examples.yml deleted file mode 100644 index 50570869d..000000000 --- a/codebuild/py27/examples.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: 0.2 - -env: - variables: - TOXENV: "py27-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: - - pip install tox - - tox diff --git a/codebuild/py27/integ.yml b/codebuild/py27/integ.yml deleted file mode 100644 index 82d264aa0..000000000 --- a/codebuild/py27/integ.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: 0.2 - -env: - variables: - TOXENV: "py27-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: - - pip install tox - - tox diff --git a/src/aws_encryption_sdk/internal/crypto/elliptic_curve.py b/src/aws_encryption_sdk/internal/crypto/elliptic_curve.py index fd96abf6f..0febe7cc8 100644 --- a/src/aws_encryption_sdk/internal/crypto/elliptic_curve.py +++ b/src/aws_encryption_sdk/internal/crypto/elliptic_curve.py @@ -18,7 +18,7 @@ from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric import ec from cryptography.hazmat.primitives.asymmetric.utils import Prehashed, decode_dss_signature, encode_dss_signature -from cryptography.utils import InterfaceNotImplemented, int_from_bytes, int_to_bytes, verify_interface +from cryptography.utils import InterfaceNotImplemented, int_to_bytes, verify_interface from ...exceptions import NotSupportedError from ..str_ops import to_bytes @@ -123,8 +123,7 @@ def _ecc_decode_compressed_point(curve, compressed_point): y_order_map = {b"\x02": 0, b"\x03": 1} raw_x = compressed_point[1:] raw_x = to_bytes(raw_x) - # pylint gives a false positive that int_from_bytes is not callable - x = int_from_bytes(raw_x, "big") # pylint: disable=not-callable + x = int.from_bytes(raw_x, "big") raw_y = compressed_point[0] # In Python3, bytes index calls return int values rather than strings if isinstance(raw_y, six.integer_types): diff --git a/tox.ini b/tox.ini index b0221eee2..110ae7263 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{27,34,35,36,37,38,39}-{local,integ,accept,examples}, nocmk, + py{35,36,37,38,39}-{local,integ,accept,examples}, nocmk, bandit, doc8, readme, docs, {flake8,pylint}{,-tests,-examples}, isort-check, black-check, @@ -94,15 +94,6 @@ recreate = True deps = commands = {toxinidir}/test/freeze-upstream-requirements.sh -# Freeze for Python 2.7 -[testenv:freeze-upstream-requirements-py27] -basepython = python2.7 -sitepackages = {[testenv:freeze-upstream-requirements-base]sitepackages} -skip_install = {[testenv:freeze-upstream-requirements-base]skip_install} -recreate = {[testenv:freeze-upstream-requirements-base]recreate} -deps = {[testenv:freeze-upstream-requirements-base]deps} -commands = {[testenv:freeze-upstream-requirements-base]commands} test/upstream-requirements-py27.txt - # Freeze for Python 3.7 [testenv:freeze-upstream-requirements-py37] basepython = python3.7 @@ -118,14 +109,6 @@ sitepackages = False recreate = True commands = {[testenv:base-command]commands} test/ -m local -# Test frozen upstream requirements for Python 2.7 -[testenv:test-upstream-requirements-py27] -basepython = python2.7 -deps = -rtest/upstream-requirements-py27.txt -sitepackages = {[testenv:test-upstream-requirements-base]sitepackages} -recreate = {[testenv:test-upstream-requirements-base]recreate} -commands = {[testenv:test-upstream-requirements-base]commands} - # Test frozen upstream requirements for Python 3.7 [testenv:test-upstream-requirements-py37] basepython = python3.7 From b011cbf2784e3f062cb51943fe90c42cd3a7c320 Mon Sep 17 00:00:00 2001 From: Benjamin Farley Date: Thu, 1 Jul 2021 13:23:26 -0600 Subject: [PATCH 2/2] Update submodules as well --- .github/workflows/ci_tests.yaml | 20 -------------------- decrypt_oracle/setup.py | 3 +++ decrypt_oracle/tox.ini | 2 +- test_vector_handlers/setup.py | 5 ++--- test_vector_handlers/tox.ini | 14 +------------- 5 files changed, 7 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index a58bdb332..0926e60ad 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -28,7 +28,6 @@ jobs: - windows-latest - macos-latest python: - - 2.7 - 3.5 - 3.6 - 3.7 @@ -84,22 +83,3 @@ jobs: env: TOXENV: ${{ matrix.category }} run: tox -- -vv - upstream-py2: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - category: - - test-upstream-requirements-py27 - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v1 - with: - python-version: 2.7 - - run: | - python -m pip install --upgrade pip - pip install --upgrade -r ci-requirements.txt - - name: run test - env: - TOXENV: ${{ matrix.category }} - run: tox -- -vv diff --git a/decrypt_oracle/setup.py b/decrypt_oracle/setup.py index 3a5579ad3..72c56dd04 100644 --- a/decrypt_oracle/setup.py +++ b/decrypt_oracle/setup.py @@ -46,6 +46,9 @@ def get_requirements(): "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Security", "Topic :: Security :: Cryptography", diff --git a/decrypt_oracle/tox.ini b/decrypt_oracle/tox.ini index 31ef18772..ef39c65d2 100644 --- a/decrypt_oracle/tox.ini +++ b/decrypt_oracle/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{27,34,35,36,37}-{local,integ}, + py{35,36,37,38,39}-{local,integ}, bandit, doc8, readme, docs, {flake8,pylint}{,-tests}, # prone to false positives diff --git a/test_vector_handlers/setup.py b/test_vector_handlers/setup.py index 3fbb5907e..661ea722c 100644 --- a/test_vector_handlers/setup.py +++ b/test_vector_handlers/setup.py @@ -45,13 +45,12 @@ def get_requirements(): "Natural Language :: English", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Security", "Topic :: Security :: Cryptography", diff --git a/test_vector_handlers/tox.ini b/test_vector_handlers/tox.ini index 8aebe09da..41920d76d 100644 --- a/test_vector_handlers/tox.ini +++ b/test_vector_handlers/tox.ini @@ -2,7 +2,7 @@ envlist = # The test vectors depend on new features now, # so until release we can only effectively test the local version of the ESDK. - py{27,34,35,36,37}-awses_local, + py{35,36,37,38,39}-awses_local, # 1.2.0 and 1.2.max are being difficult because of attrs bandit, doc8, readme, docs, {flake8,pylint}{,-tests}, @@ -102,18 +102,6 @@ commands = {posargs} {[testenv:mypy-coverage]commands} -[testenv:mypy-py2] -# We only test 2.7, please upgrade -basepython = python2.7 -deps = {[testenv:mypy-common]deps} -commands = - python -m mypy \ - --py2 \ - --linecoverage-report build \ - src/awses_test_vectors/ \ - {posargs} - {[testenv:mypy-coverage]commands} - # Linters [testenv:flake8] basepython = python3