Skip to content

Commit 57b74ab

Browse files
authoredFeb 8, 2024
fix: remove python3.7 support (#613)
* fix: remove python3.7 support * remove deps related to py3.7 * add missing key for runtime mismatch tests
1 parent bb2fc45 commit 57b74ab

File tree

12 files changed

+19
-48
lines changed

12 files changed

+19
-48
lines changed
 

‎.github/workflows/build.yml

-11
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ jobs:
6363
- ubuntu-latest
6464
- windows-latest
6565
python:
66-
- "3.7"
6766
- "3.8"
6867
- "3.9"
6968
- "3.10"
@@ -88,7 +87,6 @@ jobs:
8887
- ubuntu-latest
8988
- windows-latest
9089
python:
91-
- "3.7"
9290
- "3.8"
9391
- "3.9"
9492
- "3.10"
@@ -120,7 +118,6 @@ jobs:
120118
- ubuntu-latest
121119
- windows-latest
122120
python:
123-
- "3.7"
124121
- "3.8"
125122
- "3.9"
126123
- "3.10"
@@ -154,7 +151,6 @@ jobs:
154151
- ubuntu-latest
155152
- windows-latest
156153
python:
157-
- "3.7"
158154
- "3.8"
159155
- "3.9"
160156
- "3.10"
@@ -182,7 +178,6 @@ jobs:
182178
- ubuntu-latest
183179
- windows-latest
184180
python:
185-
- "3.7"
186181
- "3.8"
187182
- "3.9"
188183
- "3.10"
@@ -213,7 +208,6 @@ jobs:
213208
- ubuntu-latest
214209
- windows-latest
215210
python:
216-
- "3.7"
217211
- "3.8"
218212
- "3.9"
219213
- "3.10"
@@ -242,7 +236,6 @@ jobs:
242236
- ubuntu-latest
243237
- windows-latest
244238
python:
245-
- "3.7"
246239
- "3.8"
247240
- "3.9"
248241
- "3.10"
@@ -267,7 +260,6 @@ jobs:
267260
- ubuntu-latest
268261
- windows-latest
269262
python:
270-
- "3.7"
271263
- "3.8"
272264
- "3.9"
273265
- "3.10"
@@ -296,7 +288,6 @@ jobs:
296288
- ubuntu-latest
297289
- windows-latest
298290
python:
299-
- "3.7"
300291
- "3.8"
301292
- "3.9"
302293
- "3.10"
@@ -324,7 +315,6 @@ jobs:
324315
- ubuntu-latest
325316
- windows-latest
326317
python:
327-
- "3.7"
328318
- "3.8"
329319
- "3.9"
330320
- "3.10"
@@ -356,7 +346,6 @@ jobs:
356346
python:
357347
- "3.9"
358348
- "3.8"
359-
- "3.7"
360349
rust:
361350
- stable
362351
steps:

‎aws_lambda_builders/validator.py

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"nodejs16.x": [ARM64, X86_64],
1414
"nodejs18.x": [ARM64, X86_64],
1515
"nodejs20.x": [ARM64, X86_64],
16-
"python3.7": [X86_64],
1716
"python3.8": [ARM64, X86_64],
1817
"python3.9": [ARM64, X86_64],
1918
"python3.10": [ARM64, X86_64],

‎aws_lambda_builders/workflows/python_pip/DESIGN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def build_dependencies(artifacts_dir_path,
4949
5050
:type runtime: str
5151
:param runtime: Python version to build dependencies for. This can
52-
either be python3.7, python3.8, python3.9, python3.10, python3.11 or python3.12. These are
52+
either be python3.8, python3.9, python3.10, python3.11 or python3.12. These are
5353
currently the only supported values.
5454
5555
:type ui: :class:`lambda_builders.actions.python_pip.utils.UI`

‎aws_lambda_builders/workflows/python_pip/packager.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ def __init__(self, version):
8181

8282
def get_lambda_abi(runtime):
8383
supported = {
84-
"python3.7": "cp37m",
8584
"python3.8": "cp38",
8685
"python3.9": "cp39",
8786
"python3.10": "cp310",
@@ -101,7 +100,7 @@ def __init__(self, runtime, python_exe, osutils=None, dependency_builder=None, a
101100
102101
:type runtime: str
103102
:param runtime: Python version to build dependencies for. This can
104-
either be python3.7, python3.8, python3.9, python3.10, python3.11 or python3.12. These are currently the
103+
either be python3.8, python3.9, python3.10, python3.11 or python3.12. These are currently the
105104
only supported values.
106105
107106
:type osutils: :class:`lambda_builders.utils.OSUtils`

‎requirements/dev.txt

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
coverage==7.2.7; python_version < '3.8'
2-
coverage==7.4.1; python_version >= '3.8'
3-
flake8==3.3.0; python_version < '3.8'
4-
flake8==3.8.4; python_version >= '3.8'
1+
coverage==7.4.1
2+
flake8==3.8.4
53
pytest-cov==4.1.0
64

7-
isort>=4.2.5,<5; python_version < '3.8'
8-
95
# Test requirements
106
pytest>=6.1.1
117
parameterized==0.9.0
128
pyelftools~=0.30 # Used to verify the generated Go binary architecture in integration tests (utils.py)
139

1410
# formatter
15-
black==22.6.0; python_version < "3.8"
16-
black==24.1.1; python_version >= "3.8"
11+
black==24.1.1
1712
ruff==0.2.0

‎setup.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def read_version():
4343
license="Apache License 2.0",
4444
packages=find_packages(exclude=["tests.*", "tests"]),
4545
keywords="AWS Lambda Functions Building",
46-
# Support 3.7 or greater
47-
python_requires=(">=3.7"),
46+
# Support 3.8 or greater
47+
python_requires=(">=3.8"),
4848
entry_points={"console_scripts": ["{}=aws_lambda_builders.__main__:main".format(cmd_name)]},
4949
install_requires=read_requirements("base.txt") + read_requirements("python_pip.txt"),
5050
extras_require={"dev": read_requirements("dev.txt")},
@@ -58,7 +58,6 @@ def read_version():
5858
"License :: OSI Approved :: Apache Software License",
5959
"Operating System :: OS Independent",
6060
"Programming Language :: Python",
61-
"Programming Language :: Python :: 3.7",
6261
"Programming Language :: Python :: 3.8",
6362
"Programming Language :: Python :: 3.9",
6463
"Programming Language :: Python :: 3.10",

‎tests/integration/workflows/python_pip/test_python_pip.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,8 @@ def setUp(self):
5959
language=self.builder.capability.language, major=sys.version_info.major, minor=sys.version_info.minor
6060
)
6161
self.runtime_mismatch = {
62-
"python3.7": "python3.8",
6362
"python3.8": "python3.9",
64-
"python3.9": "python3.7",
63+
"python3.9": "python3.10",
6564
"python3.10": "python3.9",
6665
"python3.11": "python3.10",
6766
"python3.12": "python3.11",
@@ -256,10 +255,7 @@ def test_must_resolve_unknown_package_name(self):
256255
runtime=self.runtime,
257256
experimental_flags=self.experimental_flags,
258257
)
259-
if self.runtime in ("python3.7"):
260-
expected_files = self.test_data_files.union(["inflate64", "inflate64-0.3.1.dist-info"])
261-
else:
262-
expected_files = self.test_data_files.union(["inflate64", "inflate64-1.0.0.dist-info"])
258+
expected_files = self.test_data_files.union(["inflate64", "inflate64-1.0.0.dist-info"])
263259
output_files = set(os.listdir(self.artifacts_dir))
264260
for f in expected_files:
265261
self.assertIn(f, output_files)

‎tests/integration/workflows/python_pip/testdata/requirements-numpy.txt

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
numpy==1.15.4; python_version == '2.7'
2-
numpy==1.17.4; python_version == '3.6'
3-
numpy==1.20.3; python_version == '3.7'
41
numpy==1.20.3; python_version == '3.8'
52
numpy==1.20.3; python_version == '3.9'
63
numpy==1.23.5; python_version == '3.10'

‎tests/unit/test_validator.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def test_validate_with_unsupported_runtime(self):
2222
validator.validate("/usr/bin/unknown_runtime")
2323

2424
def test_validate_with_runtime_and_incompatible_architecture(self):
25-
runtime_list = ["python3.7"]
25+
runtime_list = ["python3.12"]
2626
for runtime in runtime_list:
27-
validator = RuntimeValidator(runtime=runtime, architecture="arm64")
27+
validator = RuntimeValidator(runtime=runtime, architecture="invalid_arch")
2828
with self.assertRaises(UnsupportedArchitectureError):
2929
validator.validate("/usr/bin/{}".format(runtime))

‎tests/unit/test_workflow.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ def test_must_raise_for_incompatible_runtime_and_architecture(self):
369369
"artifacts_dir",
370370
"scratch_dir",
371371
"manifest_path",
372-
runtime="python3.7",
372+
runtime="python3.12",
373373
executable_search_paths=[str(pathlib.Path(os.getcwd()).parent)],
374374
optimizations={"a": "b"},
375375
options={"c": "d"},
@@ -378,7 +378,7 @@ def test_must_raise_for_incompatible_runtime_and_architecture(self):
378378
validator_mock = Mock()
379379
validator_mock.validate = Mock()
380380
validator_mock.validate = MagicMock(
381-
side_effect=UnsupportedArchitectureError(runtime="python3.7", architecture="arm64")
381+
side_effect=UnsupportedArchitectureError(runtime="python3.12", architecture="invalid_arch")
382382
)
383383

384384
resolver_mock = Mock()
@@ -394,7 +394,7 @@ def test_must_raise_for_incompatible_runtime_and_architecture(self):
394394
with self.assertRaises(WorkflowFailedError) as ex:
395395
self.work.run()
396396

397-
self.assertIn("Architecture arm64 is not supported for runtime python3.7", str(ex.exception))
397+
self.assertIn("Architecture invalid_arch is not supported for runtime python3.12", str(ex.exception))
398398

399399

400400
class TestBaseWorkflow_repr(TestCase):

‎tests/unit/workflows/python_pip/test_packager.py

-3
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@ def popen(self, *args, **kwargs):
9191

9292

9393
class TestGetLambdaAbi(object):
94-
def test_get_lambda_abi_python37(self):
95-
assert "cp37m" == get_lambda_abi("python3.7")
96-
9794
def test_get_lambda_abi_python38(self):
9895
assert "cp38" == get_lambda_abi("python3.8")
9996

‎tests/unit/workflows/python_pip/test_validator.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def communicate(self):
1717

1818
class TestPythonRuntimeValidator(TestCase):
1919
def setUp(self):
20-
self.validator = PythonRuntimeValidator(runtime="python3.7", architecture="x86_64")
20+
self.validator = PythonRuntimeValidator(runtime="python3.12", architecture="x86_64")
2121

2222
def test_runtime_validate_unsupported_language_fail_open(self):
2323
validator = PythonRuntimeValidator(runtime="python2.6", architecture="arm64")
@@ -27,7 +27,7 @@ def test_runtime_validate_unsupported_language_fail_open(self):
2727
def test_runtime_validate_supported_version_runtime(self):
2828
with mock.patch("subprocess.Popen") as mock_subprocess:
2929
mock_subprocess.return_value = MockSubProcess(0)
30-
self.validator.validate(runtime_path="/usr/bin/python3.7")
30+
self.validator.validate(runtime_path="/usr/bin/python3.12")
3131
self.assertTrue(mock_subprocess.call_count, 1)
3232

3333
def test_runtime_validate_mismatch_version_runtime(self):
@@ -38,14 +38,14 @@ def test_runtime_validate_mismatch_version_runtime(self):
3838
self.assertTrue(mock_subprocess.call_count, 1)
3939

4040
def test_python_command(self):
41-
cmd = self.validator._validate_python_cmd(runtime_path="/usr/bin/python3.7")
42-
version_strings = ["sys.version_info.major == 3", "sys.version_info.minor == 7"]
41+
cmd = self.validator._validate_python_cmd(runtime_path="/usr/bin/python3.12")
42+
version_strings = ["sys.version_info.major == 3", "sys.version_info.minor == 12"]
4343
for version_string in version_strings:
4444
self.assertTrue(all([part for part in cmd if version_string in part]))
4545

4646
@parameterized.expand(
4747
[
48-
("python3.7", "arm64"),
48+
("python3.12", "invalid_arch"),
4949
]
5050
)
5151
def test_runtime_validate_with_incompatible_architecture(self, runtime, architecture):

0 commit comments

Comments
 (0)
Please sign in to comment.