Skip to content

Commit

Permalink
fix: remove python3.7 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mndeveci committed Feb 7, 2024
1 parent f11d2a5 commit cf97b4c
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 40 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand All @@ -88,7 +87,6 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand Down Expand Up @@ -120,7 +118,6 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand Down Expand Up @@ -154,7 +151,6 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand Down Expand Up @@ -182,7 +178,6 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand Down Expand Up @@ -213,7 +208,6 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand Down Expand Up @@ -242,7 +236,6 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand All @@ -267,7 +260,6 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand Down Expand Up @@ -296,7 +288,6 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand Down Expand Up @@ -327,7 +318,6 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand Down Expand Up @@ -359,7 +349,6 @@ jobs:
python:
- "3.9"
- "3.8"
- "3.7"
rust:
- stable
steps:
Expand Down
1 change: 0 additions & 1 deletion aws_lambda_builders/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"nodejs16.x": [ARM64, X86_64],
"nodejs18.x": [ARM64, X86_64],
"nodejs20.x": [ARM64, X86_64],
"python3.7": [X86_64],
"python3.8": [ARM64, X86_64],
"python3.9": [ARM64, X86_64],
"python3.10": [ARM64, X86_64],
Expand Down
2 changes: 1 addition & 1 deletion aws_lambda_builders/workflows/python_pip/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def build_dependencies(artifacts_dir_path,
:type runtime: str
:param runtime: Python version to build dependencies for. This can
either be python3.7, python3.8, python3.9, python3.10, python3.11 or python3.12. These are
either be python3.8, python3.9, python3.10, python3.11 or python3.12. These are
currently the only supported values.
:type ui: :class:`lambda_builders.actions.python_pip.utils.UI`
Expand Down
3 changes: 1 addition & 2 deletions aws_lambda_builders/workflows/python_pip/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def __init__(self, version):

def get_lambda_abi(runtime):
supported = {
"python3.7": "cp37m",
"python3.8": "cp38",
"python3.9": "cp39",
"python3.10": "cp310",
Expand All @@ -101,7 +100,7 @@ def __init__(self, runtime, python_exe, osutils=None, dependency_builder=None, a
:type runtime: str
:param runtime: Python version to build dependencies for. This can
either be python3.7, python3.8, python3.9, python3.10, python3.11 or python3.12. These are currently the
either be python3.8, python3.9, python3.10, python3.11 or python3.12. These are currently the
only supported values.
:type osutils: :class:`lambda_builders.utils.OSUtils`
Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def read_version():
license="Apache License 2.0",
packages=find_packages(exclude=["tests.*", "tests"]),
keywords="AWS Lambda Functions Building",
# Support 3.7 or greater
python_requires=(">=3.7"),
# Support 3.8 or greater
python_requires=(">=3.8"),
entry_points={"console_scripts": ["{}=aws_lambda_builders.__main__:main".format(cmd_name)]},
install_requires=read_requirements("base.txt") + read_requirements("python_pip.txt"),
extras_require={"dev": read_requirements("dev.txt")},
Expand All @@ -58,7 +58,6 @@ def read_version():
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
7 changes: 1 addition & 6 deletions tests/integration/workflows/python_pip/test_python_pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ def setUp(self):
language=self.builder.capability.language, major=sys.version_info.major, minor=sys.version_info.minor
)
self.runtime_mismatch = {
"python3.7": "python3.8",
"python3.8": "python3.9",
"python3.9": "python3.7",
"python3.10": "python3.9",
"python3.11": "python3.10",
"python3.12": "python3.11",
Expand Down Expand Up @@ -256,10 +254,7 @@ def test_must_resolve_unknown_package_name(self):
runtime=self.runtime,
experimental_flags=self.experimental_flags,
)
if self.runtime in ("python3.7"):
expected_files = self.test_data_files.union(["inflate64", "inflate64-0.3.1.dist-info"])
else:
expected_files = self.test_data_files.union(["inflate64", "inflate64-1.0.0.dist-info"])
expected_files = self.test_data_files.union(["inflate64", "inflate64-1.0.0.dist-info"])
output_files = set(os.listdir(self.artifacts_dir))
for f in expected_files:
self.assertIn(f, output_files)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
numpy==1.15.4; python_version == '2.7'
numpy==1.17.4; python_version == '3.6'
numpy==1.20.3; python_version == '3.7'
numpy==1.20.3; python_version == '3.8'
numpy==1.20.3; python_version == '3.9'
numpy==1.23.5; python_version == '3.10'
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def test_validate_with_unsupported_runtime(self):
validator.validate("/usr/bin/unknown_runtime")

def test_validate_with_runtime_and_incompatible_architecture(self):
runtime_list = ["python3.7"]
runtime_list = ["python3.12"]
for runtime in runtime_list:
validator = RuntimeValidator(runtime=runtime, architecture="arm64")
validator = RuntimeValidator(runtime=runtime, architecture="invalid_arch")
with self.assertRaises(UnsupportedArchitectureError):
validator.validate("/usr/bin/{}".format(runtime))
6 changes: 3 additions & 3 deletions tests/unit/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def test_must_raise_for_incompatible_runtime_and_architecture(self):
"artifacts_dir",
"scratch_dir",
"manifest_path",
runtime="python3.7",
runtime="python3.12",
executable_search_paths=[str(pathlib.Path(os.getcwd()).parent)],
optimizations={"a": "b"},
options={"c": "d"},
Expand All @@ -378,7 +378,7 @@ def test_must_raise_for_incompatible_runtime_and_architecture(self):
validator_mock = Mock()
validator_mock.validate = Mock()
validator_mock.validate = MagicMock(
side_effect=UnsupportedArchitectureError(runtime="python3.7", architecture="arm64")
side_effect=UnsupportedArchitectureError(runtime="python3.12", architecture="invalid_arch")
)

resolver_mock = Mock()
Expand All @@ -394,7 +394,7 @@ def test_must_raise_for_incompatible_runtime_and_architecture(self):
with self.assertRaises(WorkflowFailedError) as ex:
self.work.run()

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


class TestBaseWorkflow_repr(TestCase):
Expand Down
3 changes: 0 additions & 3 deletions tests/unit/workflows/python_pip/test_packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ def popen(self, *args, **kwargs):


class TestGetLambdaAbi(object):
def test_get_lambda_abi_python37(self):
assert "cp37m" == get_lambda_abi("python3.7")

def test_get_lambda_abi_python38(self):
assert "cp38" == get_lambda_abi("python3.8")

Expand Down
10 changes: 5 additions & 5 deletions tests/unit/workflows/python_pip/test_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def communicate(self):

class TestPythonRuntimeValidator(TestCase):
def setUp(self):
self.validator = PythonRuntimeValidator(runtime="python3.7", architecture="x86_64")
self.validator = PythonRuntimeValidator(runtime="python3.12", architecture="x86_64")

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

def test_runtime_validate_mismatch_version_runtime(self):
Expand All @@ -38,14 +38,14 @@ def test_runtime_validate_mismatch_version_runtime(self):
self.assertTrue(mock_subprocess.call_count, 1)

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

@parameterized.expand(
[
("python3.7", "arm64"),
("python3.12", "invalid_arch"),
]
)
def test_runtime_validate_with_incompatible_architecture(self, runtime, architecture):
Expand Down

0 comments on commit cf97b4c

Please sign in to comment.