Skip to content

Commit 2019002

Browse files
authored
chore: Remove deprecated Python versions from CI (#447)
1 parent 69ee2fd commit 2019002

20 files changed

+87
-272
lines changed

Diff for: .github/workflows/ci_tests.yaml

-61
Original file line numberDiff line numberDiff line change
@@ -9,46 +9,6 @@ on:
99
- cron: '0 0 * * *'
1010

1111
jobs:
12-
# Hypothesis no longer supports Python 2 and
13-
# there is a bug that appears with our slow tests
14-
# only on Python 2.
15-
# Until we also drop Python 2 support,
16-
# the workaround is just that we don't run the slow tests
17-
# on Python 2.
18-
py2-tests:
19-
runs-on: ${{ matrix.platform.os }}
20-
strategy:
21-
fail-fast: true
22-
matrix:
23-
platform:
24-
- os: ubuntu-latest
25-
architecture: x64
26-
- os: windows-latest
27-
architecture: x64
28-
# x86 builds are only meaningful for Windows
29-
- os: windows-latest
30-
architecture: x86
31-
- os: macos-latest
32-
architecture: x64
33-
category:
34-
- local-fast
35-
# These require credentials.
36-
# Enable them once we sort how to provide them.
37-
# - integ-fast
38-
# - examples
39-
steps:
40-
- uses: actions/checkout@v2
41-
- uses: actions/setup-python@v2
42-
with:
43-
python-version: 2.7
44-
architecture: ${{ matrix.platform.architecture }}
45-
- run: |
46-
python -m pip install --upgrade pip
47-
pip install --upgrade -r ci-requirements.txt
48-
- name: run test
49-
env:
50-
TOXENV: ${{ matrix.category }}
51-
run: tox -- -vv
5212
tests:
5313
runs-on: ${{ matrix.platform.os }}
5414
strategy:
@@ -65,8 +25,6 @@ jobs:
6525
- os: macos-latest
6626
architecture: x64
6727
python:
68-
- 3.5
69-
- 3.6
7028
- 3.7
7129
- 3.8
7230
- 3.9
@@ -111,22 +69,3 @@ jobs:
11169
env:
11270
TOXENV: ${{ matrix.category }}
11371
run: tox -- -vv
114-
upstream-py2:
115-
runs-on: ubuntu-latest
116-
strategy:
117-
fail-fast: true
118-
matrix:
119-
category:
120-
- test-upstream-requirements-py27
121-
steps:
122-
- uses: actions/checkout@v2
123-
- uses: actions/setup-python@v1
124-
with:
125-
python-version: 2.7
126-
- run: |
127-
python -m pip install --upgrade pip
128-
pip install --upgrade -r ci-requirements.txt
129-
- name: run test
130-
env:
131-
TOXENV: ${{ matrix.category }}
132-
run: tox -- -vv

Diff for: buildspec.yml

-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ version: 0.2
33
batch:
44
fast-fail: false
55
build-list:
6-
- identifier: python2_7
7-
buildspec: codebuild/python2.7.yml
8-
- identifier: python3_5
9-
buildspec: codebuild/python3.5.yml
10-
- identifier: python3_6
11-
buildspec: codebuild/python3.6.yml
126
- identifier: python3_7
137
buildspec: codebuild/python3.7.yml
148
- identifier: python3_8

Diff for: codebuild/python2.7.yml

-20
This file was deleted.

Diff for: codebuild/python3.5.yml

-32
This file was deleted.

Diff for: codebuild/python3.6.yml

-20
This file was deleted.

Diff for: dev_requirements/linter-requirements.txt

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
bandit==1.7.0
2-
black==21.12b0
1+
bandit==1.7.2
2+
black==22.3.0
33
doc8==0.10.1
44
flake8==4.0.1
5-
flake8-bugbear==21.11.29
65
flake8-docstrings==1.6.0
76
flake8-isort==4.1.1
7+
# https://github.com/JBKahn/flake8-print/pull/30
88
flake8-print==4.0.0
99
isort==5.10.1
10-
pydocstyle==3.0.0
11-
pyflakes==2.4.0
1210
pylint==2.12.2
13-
readme_renderer==32.0
11+
pyflakes==2.4.0
12+
# https://github.com/PyCQA/pydocstyle/issues/375
13+
pydocstyle==3.0.0
14+
readme_renderer==34.0
1415
seed-isort-config==2.2.0
1516
vulture==2.3
16-
sphinx==4.4.0

Diff for: doc/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def get_version():
2929
return _release
3030

3131

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

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

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

5858
# List of directories, relative to source directory, that shouldn't be searched
5959
# for source files.

Diff for: examples/src/pylintrc

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
disable =
44
duplicate-code, # these examples often feature similar code
55
too-many-locals, # for these examples, we prioritize keeping everything together for simple readability
6+
consider-using-f-string, # Not supported in Python 3.5
67

78
[BASIC]
89
# Allow function names up to 50 characters

Diff for: examples/test/examples_test_utils.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@
55
os.environ["AWS_ENCRYPTION_SDK_EXAMPLES_TESTING"] = "yes"
66
sys.path.extend([os.sep.join([os.path.dirname(__file__), "..", "..", "test", "integration"])])
77

8-
from integration_test_utils import cmk_arn, cmk_mrk_arn, ddb_table_name, second_cmk_mrk_arn # noqa pylint: disable=unused-import
8+
from integration_test_utils import ( # noqa pylint: disable=unused-import
9+
cmk_arn,
10+
cmk_mrk_arn,
11+
ddb_table_name,
12+
second_cmk_mrk_arn,
13+
)

Diff for: examples/test/test_aws_kms_encrypted_examples.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@
2020
aws_kms_multi_region_key,
2121
)
2222

23-
from .examples_test_utils import cmk_arn, cmk_mrk_arn, ddb_table_name, second_cmk_mrk_arn # noqa pylint: disable=unused-import
23+
from .examples_test_utils import ( # noqa pylint: disable=unused-import
24+
cmk_arn,
25+
cmk_mrk_arn,
26+
ddb_table_name,
27+
second_cmk_mrk_arn,
28+
)
2429

2530
pytestmark = [pytest.mark.examples]
2631

Diff for: src/dynamodb_encryption_sdk/material_providers/most_recent.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535
pass
3636

3737

38-
__all__ = (
39-
"CachingMostRecentProvider",
40-
)
38+
__all__ = ("CachingMostRecentProvider",)
4139
_LOGGER = logging.getLogger(LOGGER_NAME)
4240
#: Grace period during which we will return the latest local materials. This allows multiple
4341
#: threads to be using this same provider without risking lock contention or many threads

Diff for: src/pylintrc

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
[MESSAGES CONTROL]
22
# Disabling messages that we either don't care about for tests or are necessary to break for tests.
33
disable =
4-
bad-continuation, # we let black handle this
54
ungrouped-imports, # we let isort handle this
65
duplicate-code, # causes lots of problems with implementations of common interfaces
76
# All below are disabled because we need to support Python 2
87
useless-object-inheritance,
98
raise-missing-from,
109
super-with-arguments,
11-
consider-using-f-string
10+
consider-using-f-string,
1211

1312
[BASIC]
1413
# Allow function names up to 50 characters

Diff for: test/acceptance/acceptance_test_generators.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def load_scenarios(online):
4343
into a shared method.
4444
"""
4545
# pylint: disable=too-many-locals
46-
with open(_SCENARIO_FILE) as f:
46+
with open(_SCENARIO_FILE, encoding="utf-8") as f:
4747
scenarios = json.load(f)
4848
keys_file = _filename_from_uri(scenarios["keys"])
4949
keys = _load_keys(keys_file)
@@ -128,7 +128,7 @@ def _generate(materials_provider, table_data, ciphertext_file, metastore_info):
128128
if table:
129129
table.delete()
130130

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

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

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

143143
metatable.delete()

Diff for: test/acceptance/acceptance_test_utils.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def _decode_item(item):
6161

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

6767
actions = {}
@@ -92,7 +92,7 @@ def _build_plaintext_items(plaintext_file, version):
9292

9393

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

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

104104

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

109109

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

@@ -255,7 +255,7 @@ def _expand_items(ciphertext_items, plaintext_items):
255255

256256
def load_scenarios(online):
257257
# pylint: disable=too-many-locals
258-
with open(_SCENARIO_FILE) as f:
258+
with open(_SCENARIO_FILE, encoding="utf-8") as f:
259259
scenarios = json.load(f)
260260
keys_file = _filename_from_uri(scenarios["keys"])
261261
keys = _load_keys(keys_file)

Diff for: test/functional/functional_test_vector_generators.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ def _decode_complex_value(_value):
104104

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

112112

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

126126

127127
def string_to_sign_test_vectors():
128-
with open(_STRING_TO_SIGN_TEST_VECTORS_FILE) as f:
128+
with open(_STRING_TO_SIGN_TEST_VECTORS_FILE, encoding="utf-8") as f:
129129
vectors = json.load(f)
130130
for vector in vectors:
131131
item = {key: decode_value(value["value"]) for key, value in vector["item"].items()}

Diff for: test/functional/hypothesis_strategies.py

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
hypothesis.HealthCheck.too_slow,
2424
hypothesis.HealthCheck.data_too_large,
2525
hypothesis.HealthCheck.large_base_example,
26+
hypothesis.HealthCheck.function_scoped_fixture,
2627
),
2728
deadline=None,
2829
)

Diff for: test/functional/internal/test_str_ops.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
(
2727
("asdf", "asdf"),
2828
(b"asdf", "asdf"),
29-
(codecs.encode(u"Предисловие", "utf-8"), u"Предисловие"),
30-
(u"Предисловие", u"Предисловие"),
29+
(codecs.encode("Предисловие", "utf-8"), "Предисловие"),
30+
("Предисловие", "Предисловие"),
3131
),
3232
)
3333
def test_to_str(data, expected_output):
@@ -41,8 +41,8 @@ def test_to_str(data, expected_output):
4141
("asdf", b"asdf"),
4242
(b"asdf", b"asdf"),
4343
(b"\x3a\x00\x99", b"\x3a\x00\x99"),
44-
(u"Предисловие", codecs.encode(u"Предисловие", "utf-8")),
45-
(codecs.encode(u"Предисловие", "utf-8"), codecs.encode(u"Предисловие", "utf-8")),
44+
("Предисловие", codecs.encode("Предисловие", "utf-8")),
45+
(codecs.encode("Предисловие", "utf-8"), codecs.encode("Предисловие", "utf-8")),
4646
),
4747
)
4848
def test_to_bytes(data, expected_output):

0 commit comments

Comments
 (0)