Skip to content

chore: Remove deprecated Python versions from CI #447

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

Merged
merged 3 commits into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
61 changes: 0 additions & 61 deletions .github/workflows/ci_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,6 @@ on:
- cron: '0 0 * * *'

jobs:
# Hypothesis no longer supports Python 2 and
# there is a bug that appears with our slow tests
# only on Python 2.
# Until we also drop Python 2 support,
# the workaround is just that we don't run the slow tests
# on Python 2.
py2-tests:
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: true
matrix:
platform:
- os: ubuntu-latest
architecture: x64
- os: windows-latest
architecture: x64
# x86 builds are only meaningful for Windows
- os: windows-latest
architecture: x86
- os: macos-latest
architecture: x64
category:
- local-fast
# These require credentials.
# Enable them once we sort how to provide them.
# - integ-fast
# - examples
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 2.7
architecture: ${{ matrix.platform.architecture }}
- run: |
python -m pip install --upgrade pip
pip install --upgrade -r ci-requirements.txt
- name: run test
env:
TOXENV: ${{ matrix.category }}
run: tox -- -vv
tests:
runs-on: ${{ matrix.platform.os }}
strategy:
Expand All @@ -65,8 +25,6 @@ jobs:
- os: macos-latest
architecture: x64
python:
- 3.5
- 3.6
- 3.7
- 3.8
- 3.9
Expand Down Expand Up @@ -111,22 +69,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
6 changes: 0 additions & 6 deletions buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ version: 0.2
batch:
fast-fail: false
build-list:
- identifier: python2_7
buildspec: codebuild/python2.7.yml
- identifier: python3_5
buildspec: codebuild/python3.5.yml
- identifier: python3_6
buildspec: codebuild/python3.6.yml
- identifier: python3_7
buildspec: codebuild/python3.7.yml
- identifier: python3_8
Expand Down
20 changes: 0 additions & 20 deletions codebuild/python2.7.yml

This file was deleted.

32 changes: 0 additions & 32 deletions codebuild/python3.5.yml

This file was deleted.

20 changes: 0 additions & 20 deletions codebuild/python3.6.yml

This file was deleted.

14 changes: 7 additions & 7 deletions dev_requirements/linter-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
bandit==1.7.0
black==21.12b0
bandit==1.7.2
black==22.3.0
doc8==0.10.1
flake8==4.0.1
flake8-bugbear==21.11.29
flake8-docstrings==1.6.0
flake8-isort==4.1.1
# https://github.com/JBKahn/flake8-print/pull/30
flake8-print==4.0.0
isort==5.10.1
pydocstyle==3.0.0
pyflakes==2.4.0
pylint==2.12.2
readme_renderer==32.0
pyflakes==2.4.0
# https://github.com/PyCQA/pydocstyle/issues/375
pydocstyle==3.0.0
readme_renderer==34.0
seed-isort-config==2.2.0
vulture==2.3
sphinx==4.4.0
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_version():
return _release


project = u"dynamodb-encryption-sdk-python" # pylint: disable=redundant-u-string-prefix
project = "dynamodb-encryption-sdk-python"
version = get_version()
release = get_release()

Expand All @@ -53,7 +53,7 @@ def get_version():
source_suffix = ".rst" # The suffix of source filenames.
master_doc = "index" # The master toctree document.

copyright = u"%s, Amazon" % datetime.now().year # pylint: disable=redefined-builtin,redundant-u-string-prefix
copyright = "%s, Amazon" % datetime.now().year # pylint: disable=redefined-builtin

# List of directories, relative to source directory, that shouldn't be searched
# for source files.
Expand Down
1 change: 1 addition & 0 deletions examples/src/pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
disable =
duplicate-code, # these examples often feature similar code
too-many-locals, # for these examples, we prioritize keeping everything together for simple readability
consider-using-f-string, # Not supported in Python 3.5

[BASIC]
# Allow function names up to 50 characters
Expand Down
7 changes: 6 additions & 1 deletion examples/test/examples_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@
os.environ["AWS_ENCRYPTION_SDK_EXAMPLES_TESTING"] = "yes"
sys.path.extend([os.sep.join([os.path.dirname(__file__), "..", "..", "test", "integration"])])

from integration_test_utils import cmk_arn, cmk_mrk_arn, ddb_table_name, second_cmk_mrk_arn # noqa pylint: disable=unused-import
from integration_test_utils import ( # noqa pylint: disable=unused-import
cmk_arn,
cmk_mrk_arn,
ddb_table_name,
second_cmk_mrk_arn,
)
7 changes: 6 additions & 1 deletion examples/test/test_aws_kms_encrypted_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
aws_kms_multi_region_key,
)

from .examples_test_utils import cmk_arn, cmk_mrk_arn, ddb_table_name, second_cmk_mrk_arn # noqa pylint: disable=unused-import
from .examples_test_utils import ( # noqa pylint: disable=unused-import
cmk_arn,
cmk_mrk_arn,
ddb_table_name,
second_cmk_mrk_arn,
)

pytestmark = [pytest.mark.examples]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@
pass


__all__ = (
"CachingMostRecentProvider",
)
__all__ = ("CachingMostRecentProvider",)
_LOGGER = logging.getLogger(LOGGER_NAME)
#: Grace period during which we will return the latest local materials. This allows multiple
#: threads to be using this same provider without risking lock contention or many threads
Expand Down
3 changes: 1 addition & 2 deletions src/pylintrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
[MESSAGES CONTROL]
# Disabling messages that we either don't care about for tests or are necessary to break for tests.
disable =
bad-continuation, # we let black handle this
ungrouped-imports, # we let isort handle this
duplicate-code, # causes lots of problems with implementations of common interfaces
# All below are disabled because we need to support Python 2
useless-object-inheritance,
raise-missing-from,
super-with-arguments,
consider-using-f-string
consider-using-f-string,

[BASIC]
# Allow function names up to 50 characters
Expand Down
6 changes: 3 additions & 3 deletions test/acceptance/acceptance_test_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def load_scenarios(online):
into a shared method.
"""
# pylint: disable=too-many-locals
with open(_SCENARIO_FILE) as f:
with open(_SCENARIO_FILE, encoding="utf-8") as f:
scenarios = json.load(f)
keys_file = _filename_from_uri(scenarios["keys"])
keys = _load_keys(keys_file)
Expand Down Expand Up @@ -128,7 +128,7 @@ def _generate(materials_provider, table_data, ciphertext_file, metastore_info):
if table:
table.delete()

with open(ciphertext_file, "w") as outfile:
with open(ciphertext_file, "w", encoding="utf-8") as outfile:
json.dump(data_table_output, outfile, indent=4)

if metatable:
Expand All @@ -137,7 +137,7 @@ def _generate(materials_provider, table_data, ciphertext_file, metastore_info):
metastore_output[metastore_info["table_name"]].append(ddb_to_json(wrapping_key))

metastore_ciphertext_file = _filename_from_uri(metastore_info["ciphertext"])
with open(metastore_ciphertext_file, "w") as outfile:
with open(metastore_ciphertext_file, "w", encoding="utf-8") as outfile:
json.dump(metastore_output, outfile, indent=4)

metatable.delete()
Expand Down
10 changes: 5 additions & 5 deletions test/acceptance/acceptance_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _decode_item(item):

def _build_plaintext_items(plaintext_file, version):
# pylint: disable=too-many-locals
with open(plaintext_file) as f:
with open(plaintext_file, encoding="utf-8") as f:
plaintext_data = json.load(f)

actions = {}
Expand Down Expand Up @@ -92,7 +92,7 @@ def _build_plaintext_items(plaintext_file, version):


def _load_ciphertext_items(ciphertext_file):
with open(ciphertext_file) as f:
with open(ciphertext_file, encoding="utf-8") as f:
ciphertexts = json.load(f)

for _table, items in ciphertexts.items():
Expand All @@ -103,7 +103,7 @@ def _load_ciphertext_items(ciphertext_file):


def _load_keys(keys_file):
with open(keys_file) as f:
with open(keys_file, encoding="utf-8") as f:
return json.load(f)


Expand Down Expand Up @@ -165,7 +165,7 @@ def _meta_table_prep(table_name, items_filename):
table = boto3.resource("dynamodb", region_name="us-west-2").Table(table_name)
table.wait_until_exists()
try:
with open(_filename_from_uri(items_filename)) as f:
with open(_filename_from_uri(items_filename), encoding="utf-8") as f:
table_data = json.load(f)
request_items = {}

Expand Down Expand Up @@ -255,7 +255,7 @@ def _expand_items(ciphertext_items, plaintext_items):

def load_scenarios(online):
# pylint: disable=too-many-locals
with open(_SCENARIO_FILE) as f:
with open(_SCENARIO_FILE, encoding="utf-8") as f:
scenarios = json.load(f)
keys_file = _filename_from_uri(scenarios["keys"])
keys = _load_keys(keys_file)
Expand Down
6 changes: 3 additions & 3 deletions test/functional/functional_test_vector_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ def _decode_complex_value(_value):

def attribute_test_vectors(mode):
filepath = _ATTRIBUTE_TEST_VECTOR_FILE_TEMPLATE.format(mode=mode)
with open(filepath) as f:
with open(filepath, encoding="utf-8") as f:
vectors = json.load(f)
for vector in vectors:
yield (decode_value(vector["attribute"]), base64.b64decode(codecs.encode(vector["serialized"], "utf-8")))


def material_description_test_vectors():
with open(_MATERIAL_DESCRIPTION_TEST_VECTORS_FILE) as f:
with open(_MATERIAL_DESCRIPTION_TEST_VECTORS_FILE, encoding="utf-8") as f:
vectors = json.load(f)
for vector in vectors:
yield (vector["material_description"], decode_value({"B": codecs.encode(vector["serialized"], "utf-8")}))
Expand All @@ -125,7 +125,7 @@ def material_description_test_vectors():


def string_to_sign_test_vectors():
with open(_STRING_TO_SIGN_TEST_VECTORS_FILE) as f:
with open(_STRING_TO_SIGN_TEST_VECTORS_FILE, encoding="utf-8") as f:
vectors = json.load(f)
for vector in vectors:
item = {key: decode_value(value["value"]) for key, value in vector["item"].items()}
Expand Down
1 change: 1 addition & 0 deletions test/functional/hypothesis_strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
hypothesis.HealthCheck.too_slow,
hypothesis.HealthCheck.data_too_large,
hypothesis.HealthCheck.large_base_example,
hypothesis.HealthCheck.function_scoped_fixture,
),
deadline=None,
)
Expand Down
8 changes: 4 additions & 4 deletions test/functional/internal/test_str_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
(
("asdf", "asdf"),
(b"asdf", "asdf"),
(codecs.encode(u"Предисловие", "utf-8"), u"Предисловие"),
(u"Предисловие", u"Предисловие"),
(codecs.encode("Предисловие", "utf-8"), "Предисловие"),
("Предисловие", "Предисловие"),
),
)
def test_to_str(data, expected_output):
Expand All @@ -41,8 +41,8 @@ def test_to_str(data, expected_output):
("asdf", b"asdf"),
(b"asdf", b"asdf"),
(b"\x3a\x00\x99", b"\x3a\x00\x99"),
(u"Предисловие", codecs.encode(u"Предисловие", "utf-8")),
(codecs.encode(u"Предисловие", "utf-8"), codecs.encode(u"Предисловие", "utf-8")),
("Предисловие", codecs.encode("Предисловие", "utf-8")),
(codecs.encode("Предисловие", "utf-8"), codecs.encode("Предисловие", "utf-8")),
),
)
def test_to_bytes(data, expected_output):
Expand Down
Loading