Skip to content

Commit c44e1b1

Browse files
hawflaubrienseahnnasit
authored
Feat python3.12 (#575)
* Add python3.12. * Empty-Commit * Revert "Add python3.12." This reverts commit 8bac5ef. * Revert "Revert "Add python3.12."" (#86) * Revert "Revert "Add python3.12."" This reverts commit f09d7d9. * attempt to fix py3.12 integration tests * attempt to fix py3.12 integration tests * attempt to fix py3.12 integration tests * attempt to fix py3.12 integration tests * attempt to fix py3.12 integration tests * attempt to fix py3.12 integration tests * Update numpy version for python3.12 integration tests * fix py312 integration test * fix * update test expected files for inflate64 * try upgrading inflate64 version to fix windows tests * Lower inflate64 version as python3.7 integ tests fail * Add conditions as there is no ideal version to satisfy python * update python condition * missed updating python version in integ test case --------- Co-authored-by: Haresh Nasit <hnnasit@amazon.com> --------- Co-authored-by: Sean O Brien <briensea@amazon.com> Co-authored-by: Haresh Nasit <hnnasit@amazon.com>
1 parent f980325 commit c44e1b1

File tree

9 files changed

+43
-9
lines changed

9 files changed

+43
-9
lines changed

.github/workflows/build.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ jobs:
125125
- "3.9"
126126
- "3.10"
127127
- "3.11"
128+
- "3.12"
128129
npm:
129130
- 8
130131
- 9
@@ -158,6 +159,7 @@ jobs:
158159
- "3.9"
159160
- "3.10"
160161
- "3.11"
162+
- "3.12"
161163
steps:
162164
- uses: actions/checkout@v4
163165
- uses: actions/setup-python@v4
@@ -185,6 +187,7 @@ jobs:
185187
- "3.9"
186188
- "3.10"
187189
- "3.11"
190+
- "3.12"
188191
steps:
189192
- uses: actions/checkout@v4
190193
- uses: actions/setup-python@v4
@@ -215,6 +218,7 @@ jobs:
215218
- "3.9"
216219
- "3.10"
217220
- "3.11"
221+
- "3.12"
218222
steps:
219223
- uses: actions/checkout@v4
220224
- uses: actions/setup-python@v4
@@ -243,6 +247,7 @@ jobs:
243247
- "3.9"
244248
- "3.10"
245249
- "3.11"
250+
- "3.12"
246251
steps:
247252
- uses: actions/checkout@v4
248253
- uses: actions/setup-python@v4
@@ -267,11 +272,16 @@ jobs:
267272
- "3.9"
268273
- "3.10"
269274
- "3.11"
275+
- "3.12"
270276
steps:
271277
- uses: actions/checkout@v4
272278
- uses: actions/setup-python@v4
273279
with:
274280
python-version: ${{ matrix.python }}
281+
- run: |
282+
python -m pip install --upgrade pip
283+
pip install --upgrade setuptools
284+
if: ${{ matrix.os }} == 'ubuntu-latest' && ${{ matrix.python }} == '3.12'
275285
- run: make init
276286
- run: pytest -vv tests/integration/workflows/python_pip
277287

@@ -291,6 +301,7 @@ jobs:
291301
- "3.9"
292302
- "3.10"
293303
- "3.11"
304+
- "3.12"
294305
steps:
295306
- uses: actions/checkout@v4
296307
- uses: actions/setup-python@v4
@@ -321,6 +332,7 @@ jobs:
321332
- "3.9"
322333
- "3.10"
323334
- "3.11"
335+
- "3.12"
324336
steps:
325337
- uses: actions/checkout@v4
326338
- uses: actions/setup-python@v4

aws_lambda_builders/validator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"python3.9": [ARM64, X86_64],
2121
"python3.10": [ARM64, X86_64],
2222
"python3.11": [ARM64, X86_64],
23+
"python3.12": [ARM64, X86_64],
2324
"ruby2.7": [ARM64, X86_64],
2425
"ruby3.2": [ARM64, X86_64],
2526
"java8": [ARM64, X86_64],

aws_lambda_builders/workflows/python_pip/DESIGN.md

Lines changed: 1 addition & 1 deletion
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 or python3.11. These are
52+
either be python3.7, 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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def get_lambda_abi(runtime):
8787
"python3.9": "cp39",
8888
"python3.10": "cp310",
8989
"python3.11": "cp311",
90+
"python3.12": "cp312",
9091
}
9192

9293
if runtime not in supported:
@@ -101,7 +102,7 @@ def __init__(self, runtime, osutils=None, dependency_builder=None, architecture=
101102
102103
:type runtime: str
103104
:param runtime: Python version to build dependencies for. This can
104-
either be python3.7, python3.8, python3.9, python3.10 or python3.11. These are currently the
105+
either be python3.7, python3.8, python3.9, python3.10, python3.11 or python3.12. These are currently the
105106
only supported values.
106107
107108
:type osutils: :class:`lambda_builders.utils.OSUtils`

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def read_version():
6363
"Programming Language :: Python :: 3.9",
6464
"Programming Language :: Python :: 3.10",
6565
"Programming Language :: Python :: 3.11",
66+
"Programming Language :: Python :: 3.12",
6667
"Topic :: Internet",
6768
"Topic :: Software Development :: Build Tools",
6869
"Topic :: Utilities",

tests/integration/workflows/python_pip/test_python_pip.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
logger = logging.getLogger("aws_lambda_builders.workflows.python_pip.workflow")
1919
IS_WINDOWS = platform.system().lower() == "windows"
2020
NOT_ARM = platform.processor() != "aarch64"
21-
ARM_RUNTIMES = {"python3.8", "python3.9", "python3.10", "python3.11"}
21+
ARM_RUNTIMES = {"python3.8", "python3.9", "python3.10", "python3.11", "python3.12"}
2222

2323

2424
@parameterized_class(("experimental_flags",), [([]), ([EXPERIMENTAL_FLAG_BUILD_PERFORMANCE])])
@@ -64,6 +64,7 @@ def setUp(self):
6464
"python3.9": "python3.7",
6565
"python3.10": "python3.9",
6666
"python3.11": "python3.10",
67+
"python3.12": "python3.11",
6768
}
6869

6970
def tearDown(self):
@@ -96,7 +97,10 @@ def test_must_build_python_project(self):
9697
experimental_flags=self.experimental_flags,
9798
)
9899

99-
if self.runtime in ("python3.10", "python3.11"):
100+
if self.runtime in ("python3.12"):
101+
self.check_architecture_in("numpy-1.26.1.dist-info", ["manylinux2014_x86_64", "manylinux1_x86_64"])
102+
expected_files = self.test_data_files.union({"numpy", "numpy-1.26.1.dist-info", "numpy.libs"})
103+
elif self.runtime in ("python3.10", "python3.11"):
100104
self.check_architecture_in("numpy-1.23.5.dist-info", ["manylinux2014_x86_64", "manylinux1_x86_64"])
101105
expected_files = self.test_data_files.union({"numpy", "numpy-1.23.5.dist-info", "numpy.libs"})
102106
else:
@@ -123,7 +127,10 @@ def test_must_build_python_project_python3_binary(self):
123127
executable_search_paths=[executable_dir],
124128
)
125129

126-
if self.runtime in ("python3.10", "python3.11"):
130+
if self.runtime in ("python3.12"):
131+
self.check_architecture_in("numpy-1.26.1.dist-info", ["manylinux2014_x86_64", "manylinux1_x86_64"])
132+
expected_files = self.test_data_files.union({"numpy", "numpy-1.26.1.dist-info", "numpy.libs"})
133+
elif self.runtime in ("python3.10", "python3.11", "python3.12"):
127134
self.check_architecture_in("numpy-1.23.5.dist-info", ["manylinux2014_x86_64", "manylinux1_x86_64"])
128135
expected_files = self.test_data_files.union({"numpy", "numpy-1.23.5.dist-info", "numpy.libs"})
129136
else:
@@ -168,12 +175,16 @@ def test_must_build_python_project_with_arm_architecture(self):
168175
experimental_flags=self.experimental_flags,
169176
)
170177
expected_files = self.test_data_files.union({"numpy", "numpy.libs", "numpy-1.20.3.dist-info"})
178+
if self.runtime in ("python3.12"):
179+
expected_files = self.test_data_files.union({"numpy", "numpy.libs", "numpy-1.26.1.dist-info"})
171180
if self.runtime in ("python3.10", "python3.11"):
172181
expected_files = self.test_data_files.union({"numpy", "numpy.libs", "numpy-1.23.5.dist-info"})
173182
output_files = set(os.listdir(self.artifacts_dir))
174183
self.assertEqual(expected_files, output_files)
175184

176-
if self.runtime in ("python3.10", "python3.11"):
185+
if self.runtime in ("python3.12"):
186+
self.check_architecture_in("numpy-1.26.1.dist-info", ["manylinux2014_aarch64"])
187+
elif self.runtime in ("python3.10", "python3.11"):
177188
self.check_architecture_in("numpy-1.23.5.dist-info", ["manylinux2014_aarch64"])
178189
else:
179190
self.check_architecture_in("numpy-1.20.3.dist-info", ["manylinux2014_aarch64"])
@@ -245,7 +256,10 @@ def test_must_resolve_unknown_package_name(self):
245256
runtime=self.runtime,
246257
experimental_flags=self.experimental_flags,
247258
)
248-
expected_files = self.test_data_files.union(["inflate64", "inflate64.libs", "inflate64-0.1.4.dist-info"])
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"])
249263
output_files = set(os.listdir(self.artifacts_dir))
250264
for f in expected_files:
251265
self.assertIn(f, output_files)
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
inflate64==0.1.4 --no-binary=:inflate64:
1+
inflate64==0.3.1; python_version < '3.8' --no-binary=:inflate64:
2+
inflate64==1.0.0; python_version >= '3.8' --no-binary=:inflate64:

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ numpy==1.20.3; python_version == '3.7'
44
numpy==1.20.3; python_version == '3.8'
55
numpy==1.20.3; python_version == '3.9'
66
numpy==1.23.5; python_version == '3.10'
7-
numpy==1.23.5; python_version == '3.11'
7+
numpy==1.23.5; python_version == '3.11'
8+
numpy==1.26.1; python_version == '3.12'

tests/unit/workflows/python_pip/test_packager.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ def test_get_lambda_abi_python310(self):
106106
def test_get_lambda_abi_python311(self):
107107
assert "cp311" == get_lambda_abi("python3.11")
108108

109+
def test_get_lambda_abi_python312(self):
110+
assert "cp312" == get_lambda_abi("python3.12")
111+
109112

110113
class TestPythonPipDependencyBuilder(object):
111114
def test_can_call_dependency_builder(self, osutils):

0 commit comments

Comments
 (0)