Skip to content

Commit 111ea79

Browse files
mndevecicalavera
authored andcommitted
fix: remove python3.6 support (aws#434)
1 parent c1ae732 commit 111ea79

File tree

11 files changed

+43
-94
lines changed

11 files changed

+43
-94
lines changed

aws_lambda_builders/validator.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"nodejs14.x": [ARM64, X86_64],
1616
"nodejs16.x": [ARM64, X86_64],
1717
"nodejs18.x": [ARM64, X86_64],
18-
"python3.6": [X86_64],
1918
"python3.7": [X86_64],
2019
"python3.8": [ARM64, X86_64],
2120
"python3.9": [ARM64, X86_64],

aws_lambda_builders/workflows/python_pip/packager.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ def __init__(self, version):
8282

8383
def get_lambda_abi(runtime):
8484
supported = {
85-
"python3.6": "cp36m",
8685
"python3.7": "cp37m",
8786
"python3.8": "cp38",
8887
"python3.9": "cp39",
@@ -100,7 +99,7 @@ def __init__(self, runtime, osutils=None, dependency_builder=None, architecture=
10099
101100
:type runtime: str
102101
:param runtime: Python version to build dependencies for. This can
103-
either be python3.6, python3.7, python3.8 or python3.9. These are currently the
102+
either be python3.7, python3.8 or python3.9. These are currently the
104103
only supported values.
105104
106105
:type osutils: :class:`lambda_builders.utils.OSUtils`
@@ -199,8 +198,6 @@ class DependencyBuilder(object):
199198

200199
# Mapping of abi to glibc version in Lambda runtime.
201200
_RUNTIME_GLIBC = {
202-
"cp27mu": (2, 17),
203-
"cp36m": (2, 17),
204201
"cp37m": (2, 17),
205202
"cp38": (2, 26),
206203
"cp39": (2, 26),
@@ -410,15 +407,11 @@ def _is_compatible_wheel_filename(self, filename):
410407
return True
411408
prefix_version = implementation[:3]
412409
if prefix_version == "cp3":
413-
# Deploying python 3 function which means we need cp36m abi
410+
# Deploying python 3 function which means we need cp37m abi
414411
# We can also accept abi3 which is the CPython 3 Stable ABI and
415412
# will work on any version of python 3.
416413
if abi == lambda_runtime_abi or abi == "abi3":
417414
return True
418-
elif prefix_version == "cp2":
419-
# Deploying to python 2 function which means we need cp27mu abi
420-
if abi == "cp27mu":
421-
return True
422415
# Don't know what we have but it didn't pass compatibility tests.
423416
return False
424417

aws_lambda_builders/workflows/python_pip/validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def validate(self, runtime_path):
3131
Returns
3232
-------
3333
str
34-
runtime_path, runtime to check eg: /usr/bin/python3.6
34+
runtime_path, runtime to check eg: /usr/bin/python3.9
3535
3636
Raises
3737
------

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ignore = ["PLR0913"]
1414

1515
[tool.black]
1616
line-length = 120
17-
target_version = ['py37', 'py36', 'py38']
17+
target_version = ['py37', 'py38', 'py39']
1818
exclude = '''
1919
2020
(

requirements/dev.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ mock==4.0.2
1111
parameterized==0.7.4
1212
pyelftools~=0.27 # Used to verify the generated Go binary architecture in integration tests (utils.py)
1313

14-
15-
# tempfile backport for < 3.7
16-
backports.tempfile==1.0; python_version<"3.7"
17-
18-
1914
# formatter
2015
black==22.3.0
2116
ruff

setup.py

Lines changed: 2 additions & 3 deletions
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.6 or greater
47-
python_requires=(">=3.6"),
46+
# Support 3.7 or greater
47+
python_requires=(">=3.7"),
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.6",
6261
"Programming Language :: Python :: 3.7",
6362
"Programming Language :: Python :: 3.8",
6463
"Programming Language :: Python :: 3.9",

tests/functional/workflows/python_pip/test_packager.py

Lines changed: 30 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def _write_requirements_txt(self, packages, directory):
204204
def _make_appdir_and_dependency_builder(self, reqs, tmpdir, runner, **kwargs):
205205
appdir = str(_create_app_structure(tmpdir))
206206
self._write_requirements_txt(reqs, appdir)
207-
builder = DependencyBuilder(OSUtils(), "python3.6", runner, **kwargs)
207+
builder = DependencyBuilder(OSUtils(), "python3.9", runner, **kwargs)
208208
return appdir, builder
209209

210210
def test_can_build_local_dir_as_whl(self, tmpdir, pip_runner, osutils):
@@ -215,7 +215,7 @@ def test_can_build_local_dir_as_whl(self, tmpdir, pip_runner, osutils):
215215
pip.set_return_tuple(0, (b"Processing ../foo\n" b" Link is a directory," b" ignoring download_dir"), b"")
216216
pip.wheels_to_build(
217217
expected_args=["--no-deps", "--wheel-dir", mock.ANY, "../foo"],
218-
wheels_to_build=["foo-1.2-cp36-none-any.whl"],
218+
wheels_to_build=["foo-1.2-cp39-none-any.whl"],
219219
)
220220

221221
site_packages = os.path.join(appdir, "site-packages")
@@ -233,7 +233,7 @@ def test_can_get_whls_all_manylinux(self, tmpdir, pip_runner, osutils):
233233
requirements_file = os.path.join(appdir, "requirements.txt")
234234
pip.packages_to_download(
235235
expected_args=["-r", requirements_file, "--dest", mock.ANY, "--exists-action", "i"],
236-
packages=["foo-1.2-cp36-cp36m-manylinux1_x86_64.whl", "bar-1.2-cp36-cp36m-manylinux1_x86_64.whl"],
236+
packages=["foo-1.2-cp39-cp39-manylinux1_x86_64.whl", "bar-1.2-cp39-cp39-manylinux1_x86_64.whl"],
237237
)
238238

239239
site_packages = os.path.join(appdir, ".chalice.", "site-packages")
@@ -276,7 +276,7 @@ def test_can_expand_purelib_whl(self, tmpdir, pip_runner, osutils):
276276
requirements_file = os.path.join(appdir, "requirements.txt")
277277
pip.packages_to_download(
278278
expected_args=["-r", requirements_file, "--dest", mock.ANY, "--exists-action", "i"],
279-
packages=["foo-1.2-cp36-cp36m-manylinux1_x86_64.whl"],
279+
packages=["foo-1.2-cp39-cp39-manylinux1_x86_64.whl"],
280280
whl_contents=["foo-1.2.data/purelib/foo/"],
281281
)
282282

@@ -296,7 +296,7 @@ def test_can_expand_platlib_whl(self, tmpdir, pip_runner, osutils):
296296
requirements_file = os.path.join(appdir, "requirements.txt")
297297
pip.packages_to_download(
298298
expected_args=["-r", requirements_file, "--dest", mock.ANY, "--exists-action", "i"],
299-
packages=["foo-1.2-cp36-cp36m-manylinux1_x86_64.whl"],
299+
packages=["foo-1.2-cp39-cp39-manylinux1_x86_64.whl"],
300300
whl_contents=["foo-1.2.data/platlib/foo/"],
301301
)
302302

@@ -318,7 +318,7 @@ def test_can_expand_platlib_and_purelib(self, tmpdir, pip_runner, osutils):
318318
requirements_file = os.path.join(appdir, "requirements.txt")
319319
pip.packages_to_download(
320320
expected_args=["-r", requirements_file, "--dest", mock.ANY, "--exists-action", "i"],
321-
packages=["foo-1.2-cp36-cp36m-manylinux1_x86_64.whl"],
321+
packages=["foo-1.2-cp39-cp39-manylinux1_x86_64.whl"],
322322
whl_contents=["foo-1.2.data/platlib/foo/", "foo-1.2.data/purelib/bar/"],
323323
)
324324

@@ -340,7 +340,7 @@ def test_does_ignore_data(self, tmpdir, pip_runner, osutils):
340340
requirements_file = os.path.join(appdir, "requirements.txt")
341341
pip.packages_to_download(
342342
expected_args=["-r", requirements_file, "--dest", mock.ANY, "--exists-action", "i"],
343-
packages=["foo-1.2-cp36-cp36m-manylinux1_x86_64.whl"],
343+
packages=["foo-1.2-cp39-cp39-manylinux1_x86_64.whl"],
344344
whl_contents=["foo/placeholder", "foo-1.2.data/data/bar/"],
345345
)
346346

@@ -363,7 +363,7 @@ def test_does_ignore_include(self, tmpdir, pip_runner, osutils):
363363
requirements_file = os.path.join(appdir, "requirements.txt")
364364
pip.packages_to_download(
365365
expected_args=["-r", requirements_file, "--dest", mock.ANY, "--exists-action", "i"],
366-
packages=["foo-1.2-cp36-cp36m-manylinux1_x86_64.whl"],
366+
packages=["foo-1.2-cp39-cp39-manylinux1_x86_64.whl"],
367367
whl_contents=["foo/placeholder", "foo.1.2.data/includes/bar/"],
368368
)
369369

@@ -386,7 +386,7 @@ def test_does_ignore_scripts(self, tmpdir, pip_runner, osutils):
386386
requirements_file = os.path.join(appdir, "requirements.txt")
387387
pip.packages_to_download(
388388
expected_args=["-r", requirements_file, "--dest", mock.ANY, "--exists-action", "i"],
389-
packages=["foo-1.2-cp36-cp36m-manylinux1_x86_64.whl"],
389+
packages=["foo-1.2-cp39-cp39-manylinux1_x86_64.whl"],
390390
whl_contents=["{package_name}/placeholder", "{data_dir}/scripts/bar/placeholder"],
391391
)
392392

@@ -410,7 +410,7 @@ def test_can_expand_platlib_and_platlib_and_root(self, tmpdir, pip_runner, osuti
410410
requirements_file = os.path.join(appdir, "requirements.txt")
411411
pip.packages_to_download(
412412
expected_args=["-r", requirements_file, "--dest", mock.ANY, "--exists-action", "i"],
413-
packages=["foo-1.2-cp36-cp36m-manylinux1_x86_64.whl"],
413+
packages=["foo-1.2-cp39-cp39-manylinux1_x86_64.whl"],
414414
whl_contents=[
415415
"{package_name}/placeholder",
416416
"{data_dir}/platlib/bar/placeholder",
@@ -435,9 +435,9 @@ def test_can_get_whls_mixed_compat(self, tmpdir, osutils, pip_runner):
435435
pip.packages_to_download(
436436
expected_args=["-r", requirements_file, "--dest", mock.ANY, "--exists-action", "i"],
437437
packages=[
438-
"foo-1.0-cp36-none-any.whl",
439-
"bar-1.2-cp36-cp36m-manylinux1_x86_64.whl",
440-
"baz-1.5-cp36-cp36m-linux_x86_64.whl",
438+
"foo-1.0-cp39-none-any.whl",
439+
"bar-1.2-cp39-cp39-manylinux1_x86_64.whl",
440+
"baz-1.5-cp39-cp39-linux_x86_64.whl",
441441
],
442442
)
443443

@@ -458,7 +458,7 @@ def test_can_support_pep_600_tags(self, tmpdir, osutils, pip_runner):
458458
pip.packages_to_download(
459459
expected_args=["-r", requirements_file, "--dest", mock.ANY, "--exists-action", "i"],
460460
packages=[
461-
"foo-1.2-cp36-cp36m-manylinux_2_12_x86_64.whl",
461+
"foo-1.2-cp39-cp39-manylinux_2_12_x86_64.whl",
462462
],
463463
)
464464

@@ -479,30 +479,7 @@ def test_can_support_compressed_tags(self, tmpdir, osutils, pip_runner):
479479
pip.packages_to_download(
480480
expected_args=["-r", requirements_file, "--dest", mock.ANY, "--exists-action", "i"],
481481
packages=[
482-
"foo-1.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl",
483-
],
484-
)
485-
486-
site_packages = os.path.join(appdir, ".chalice.", "site-packages")
487-
with osutils.tempdir() as scratch_dir:
488-
builder.build_site_packages(requirements_file, site_packages, scratch_dir)
489-
installed_packages = os.listdir(site_packages)
490-
491-
pip.validate()
492-
for req in reqs:
493-
assert req in installed_packages
494-
495-
def test_can_get_py27_whls(self, tmpdir, osutils, pip_runner):
496-
reqs = ["foo", "bar", "baz"]
497-
pip, runner = pip_runner
498-
appdir, builder = self._make_appdir_and_dependency_builder(reqs, tmpdir, runner)
499-
requirements_file = os.path.join(appdir, "requirements.txt")
500-
pip.packages_to_download(
501-
expected_args=["-r", requirements_file, "--dest", mock.ANY, "--exists-action", "i"],
502-
packages=[
503-
"foo-1.0-cp27-none-any.whl",
504-
"bar-1.2-cp27-none-manylinux1_x86_64.whl",
505-
"baz-1.5-cp27-cp27mu-linux_x86_64.whl",
482+
"foo-1.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl",
506483
],
507484
)
508485

@@ -523,9 +500,9 @@ def test_can_get_arm64_whls(self, tmpdir, osutils, pip_runner):
523500
pip.packages_to_download(
524501
expected_args=["-r", requirements_file, "--dest", mock.ANY, "--exists-action", "i"],
525502
packages=[
526-
"foo-1.0-cp36-none-any.whl",
527-
"bar-1.2-cp36-none-manylinux2014_aarch64.whl",
528-
"baz-1.5-cp36-cp36m-manylinux2014_aarch64.whl",
503+
"foo-1.0-cp39-none-any.whl",
504+
"bar-1.2-cp39-none-manylinux2014_aarch64.whl",
505+
"baz-1.5-cp39-cp39-manylinux2014_aarch64.whl",
529506
],
530507
)
531508

@@ -613,10 +590,10 @@ def test_does_fail_on_pep_600_tag_with_unsupported_glibc_version(self, tmpdir, o
613590
pip.packages_to_download(
614591
expected_args=["-r", requirements_file, "--dest", mock.ANY, "--exists-action", "i"],
615592
packages=[
616-
"foo-1.2-cp36-cp36m-manylinux_2_12_x86_64.whl",
617-
"bar-1.2-cp36-cp36m-manylinux_2_999_x86_64.whl",
618-
"baz-1.2-cp36-cp36m-manylinux_3_12_x86_64.whl",
619-
"qux-1.2-cp36-cp36m-manylinux_3_999_x86_64.whl",
593+
"foo-1.2-cp39-cp39-manylinux_2_12_x86_64.whl",
594+
"bar-1.2-cp39-cp39-manylinux_2_999_x86_64.whl",
595+
"baz-1.2-cp39-cp39-manylinux_3_12_x86_64.whl",
596+
"qux-1.2-cp39-cp39-manylinux_3_999_x86_64.whl",
620597
],
621598
)
622599

@@ -642,7 +619,7 @@ def test_can_replace_incompat_whl(self, tmpdir, osutils, pip_runner):
642619
requirements_file = os.path.join(appdir, "requirements.txt")
643620
pip.packages_to_download(
644621
expected_args=["-r", requirements_file, "--dest", mock.ANY, "--exists-action", "i"],
645-
packages=["foo-1.0-cp36-none-any.whl", "bar-1.2-cp36-cp36m-macosx_10_6_intel.whl"],
622+
packages=["foo-1.0-cp39-none-any.whl", "bar-1.2-cp39-cp39-macosx_10_6_intel.whl"],
646623
)
647624
# Once the initial download has 1 incompatible whl file. The second,
648625
# more targeted download, finds manylinux1_x86_64 and downloads that.
@@ -660,7 +637,7 @@ def test_can_replace_incompat_whl(self, tmpdir, osutils, pip_runner):
660637
mock.ANY,
661638
"bar==1.2",
662639
],
663-
packages=["bar-1.2-cp36-cp36m-manylinux1_x86_64.whl"],
640+
packages=["bar-1.2-cp39-cp39-manylinux1_x86_64.whl"],
664641
)
665642
site_packages = os.path.join(appdir, ".chalice.", "site-packages")
666643
with osutils.tempdir() as scratch_dir:
@@ -711,13 +688,13 @@ def test_can_build_sdist(self, tmpdir, osutils, pip_runner):
711688
requirements_file = os.path.join(appdir, "requirements.txt")
712689
pip.packages_to_download(
713690
expected_args=["-r", requirements_file, "--dest", mock.ANY, "--exists-action", "i"],
714-
packages=["foo-1.2.zip", "bar-1.2-cp36-cp36m-manylinux1_x86_64.whl"],
691+
packages=["foo-1.2.zip", "bar-1.2-cp39-cp39-manylinux1_x86_64.whl"],
715692
)
716693
# Foo is built from and is pure python so it yields a compatible
717694
# wheel file.
718695
pip.wheels_to_build(
719696
expected_args=["--no-deps", "--wheel-dir", mock.ANY, PathArgumentEndingWith("foo-1.2.zip")],
720-
wheels_to_build=["foo-1.2-cp36-none-any.whl"],
697+
wheels_to_build=["foo-1.2-cp39-none-any.whl"],
721698
)
722699
site_packages = os.path.join(appdir, ".chalice.", "site-packages")
723700
with osutils.tempdir() as scratch_dir:
@@ -735,7 +712,7 @@ def test_build_sdist_makes_incompatible_whl(self, tmpdir, osutils, pip_runner):
735712
requirements_file = os.path.join(appdir, "requirements.txt")
736713
pip.packages_to_download(
737714
expected_args=["-r", requirements_file, "--dest", mock.ANY, "--exists-action", "i"],
738-
packages=["foo-1.2.zip", "bar-1.2-cp36-cp36m-manylinux1_x86_64.whl"],
715+
packages=["foo-1.2.zip", "bar-1.2-cp39-cp39-manylinux1_x86_64.whl"],
739716
)
740717
# foo is compiled since downloading it failed to get any wheels. And
741718
# the second download for manylinux1_x86_64 wheels failed as well.
@@ -744,7 +721,7 @@ def test_build_sdist_makes_incompatible_whl(self, tmpdir, osutils, pip_runner):
744721
# can do to install this package.
745722
pip.wheels_to_build(
746723
expected_args=["--no-deps", "--wheel-dir", mock.ANY, PathArgumentEndingWith("foo-1.2.zip")],
747-
wheels_to_build=["foo-1.2-cp36-cp36m-macosx_10_6_intel.whl"],
724+
wheels_to_build=["foo-1.2-cp39-cp39-macosx_10_6_intel.whl"],
748725
)
749726
site_packages = os.path.join(appdir, ".chalice.", "site-packages")
750727
with osutils.tempdir() as scratch_dir:
@@ -813,7 +790,7 @@ def test_build_into_existing_dir_with_preinstalled_packages(self, tmpdir, osutil
813790
requirements_file = os.path.join(appdir, "requirements.txt")
814791
pip.packages_to_download(
815792
expected_args=["-r", requirements_file, "--dest", mock.ANY, "--exists-action", "i"],
816-
packages=["foo-1.2.zip", "bar-1.2-cp36-cp36m-manylinux1_x86_64.whl"],
793+
packages=["foo-1.2.zip", "bar-1.2-cp39-cp39-manylinux1_x86_64.whl"],
817794
)
818795
pip.packages_to_download(
819796
expected_args=[
@@ -829,7 +806,7 @@ def test_build_into_existing_dir_with_preinstalled_packages(self, tmpdir, osutil
829806
mock.ANY,
830807
"foo==1.2",
831808
],
832-
packages=["foo-1.2-cp36-cp36m-macosx_10_6_intel.whl"],
809+
packages=["foo-1.2-cp39-cp39-macosx_10_6_intel.whl"],
833810
)
834811

835812
# Add two fake packages foo and bar that have previously been

tests/integration/workflows/python_pip/test_python_pip.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ def setUp(self):
5757
language=self.builder.capability.language, major=sys.version_info.major, minor=sys.version_info.minor
5858
)
5959
self.runtime_mismatch = {
60-
"python3.6": "python3.7",
6160
"python3.7": "python3.8",
6261
"python3.8": "python3.9",
6362
"python3.9": "python3.7",
@@ -93,12 +92,8 @@ def test_must_build_python_project(self):
9392
experimental_flags=self.experimental_flags,
9493
)
9594

96-
if self.runtime == "python3.6":
97-
self.check_architecture_in("numpy-1.17.4.dist-info", ["manylinux2010_x86_64", "manylinux1_x86_64"])
98-
expected_files = self.test_data_files.union({"numpy", "numpy-1.17.4.dist-info"})
99-
else:
100-
self.check_architecture_in("numpy-1.20.3.dist-info", ["manylinux2010_x86_64", "manylinux1_x86_64"])
101-
expected_files = self.test_data_files.union({"numpy", "numpy-1.20.3.dist-info", "numpy.libs"})
95+
self.check_architecture_in("numpy-1.20.3.dist-info", ["manylinux2010_x86_64", "manylinux1_x86_64"])
96+
expected_files = self.test_data_files.union({"numpy", "numpy-1.20.3.dist-info", "numpy.libs"})
10297

10398
output_files = set(os.listdir(self.artifacts_dir))
10499
self.assertEqual(expected_files, output_files)
@@ -118,13 +113,8 @@ def test_must_build_python_project_python3_binary(self):
118113
experimental_flags=self.experimental_flags,
119114
executable_search_paths=[executable_dir],
120115
)
121-
122-
if self.runtime == "python3.6":
123-
self.check_architecture_in("numpy-1.17.4.dist-info", ["manylinux2010_x86_64", "manylinux1_x86_64"])
124-
expected_files = self.test_data_files.union({"numpy", "numpy-1.17.4.dist-info"})
125-
else:
126-
self.check_architecture_in("numpy-1.20.3.dist-info", ["manylinux2010_x86_64", "manylinux1_x86_64"])
127-
expected_files = self.test_data_files.union({"numpy", "numpy-1.20.3.dist-info", "numpy.libs"})
116+
self.check_architecture_in("numpy-1.20.3.dist-info", ["manylinux2010_x86_64", "manylinux1_x86_64"])
117+
expected_files = self.test_data_files.union({"numpy", "numpy-1.20.3.dist-info", "numpy.libs"})
128118

129119
output_files = set(os.listdir(self.artifacts_dir))
130120
self.assertEqual(expected_files, output_files)

tests/unit/test_validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ 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.6", "python3.7"]
25+
runtime_list = ["python3.7"]
2626
for runtime in runtime_list:
2727
validator = RuntimeValidator(runtime=runtime, architecture="arm64")
2828
with self.assertRaises(UnsupportedArchitectureError):

0 commit comments

Comments
 (0)