Skip to content

Commit

Permalink
Feat python3.12 (#575)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

---------

Co-authored-by: Sean O Brien <[email protected]>
Co-authored-by: Haresh Nasit <[email protected]>
  • Loading branch information
3 people authored Nov 15, 2023
1 parent f980325 commit c44e1b1
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 9 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
npm:
- 8
- 9
Expand Down Expand Up @@ -158,6 +159,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
Expand Down Expand Up @@ -185,6 +187,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
Expand Down Expand Up @@ -215,6 +218,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
Expand Down Expand Up @@ -243,6 +247,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
Expand All @@ -267,11 +272,16 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools
if: ${{ matrix.os }} == 'ubuntu-latest' && ${{ matrix.python }} == '3.12'
- run: make init
- run: pytest -vv tests/integration/workflows/python_pip

Expand All @@ -291,6 +301,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
Expand Down Expand Up @@ -321,6 +332,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
Expand Down
1 change: 1 addition & 0 deletions aws_lambda_builders/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"python3.9": [ARM64, X86_64],
"python3.10": [ARM64, X86_64],
"python3.11": [ARM64, X86_64],
"python3.12": [ARM64, X86_64],
"ruby2.7": [ARM64, X86_64],
"ruby3.2": [ARM64, X86_64],
"java8": [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 or python3.11. These are
either be python3.7, 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: 2 additions & 1 deletion aws_lambda_builders/workflows/python_pip/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def get_lambda_abi(runtime):
"python3.9": "cp39",
"python3.10": "cp310",
"python3.11": "cp311",
"python3.12": "cp312",
}

if runtime not in supported:
Expand All @@ -101,7 +102,7 @@ def __init__(self, runtime, osutils=None, dependency_builder=None, architecture=
:type runtime: str
:param runtime: Python version to build dependencies for. This can
either be python3.7, python3.8, python3.9, python3.10 or python3.11. These are currently the
either be python3.7, 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
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def read_version():
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Internet",
"Topic :: Software Development :: Build Tools",
"Topic :: Utilities",
Expand Down
24 changes: 19 additions & 5 deletions tests/integration/workflows/python_pip/test_python_pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
logger = logging.getLogger("aws_lambda_builders.workflows.python_pip.workflow")
IS_WINDOWS = platform.system().lower() == "windows"
NOT_ARM = platform.processor() != "aarch64"
ARM_RUNTIMES = {"python3.8", "python3.9", "python3.10", "python3.11"}
ARM_RUNTIMES = {"python3.8", "python3.9", "python3.10", "python3.11", "python3.12"}


@parameterized_class(("experimental_flags",), [([]), ([EXPERIMENTAL_FLAG_BUILD_PERFORMANCE])])
Expand Down Expand Up @@ -64,6 +64,7 @@ def setUp(self):
"python3.9": "python3.7",
"python3.10": "python3.9",
"python3.11": "python3.10",
"python3.12": "python3.11",
}

def tearDown(self):
Expand Down Expand Up @@ -96,7 +97,10 @@ def test_must_build_python_project(self):
experimental_flags=self.experimental_flags,
)

if self.runtime in ("python3.10", "python3.11"):
if self.runtime in ("python3.12"):
self.check_architecture_in("numpy-1.26.1.dist-info", ["manylinux2014_x86_64", "manylinux1_x86_64"])
expected_files = self.test_data_files.union({"numpy", "numpy-1.26.1.dist-info", "numpy.libs"})
elif self.runtime in ("python3.10", "python3.11"):
self.check_architecture_in("numpy-1.23.5.dist-info", ["manylinux2014_x86_64", "manylinux1_x86_64"])
expected_files = self.test_data_files.union({"numpy", "numpy-1.23.5.dist-info", "numpy.libs"})
else:
Expand All @@ -123,7 +127,10 @@ def test_must_build_python_project_python3_binary(self):
executable_search_paths=[executable_dir],
)

if self.runtime in ("python3.10", "python3.11"):
if self.runtime in ("python3.12"):
self.check_architecture_in("numpy-1.26.1.dist-info", ["manylinux2014_x86_64", "manylinux1_x86_64"])
expected_files = self.test_data_files.union({"numpy", "numpy-1.26.1.dist-info", "numpy.libs"})
elif self.runtime in ("python3.10", "python3.11", "python3.12"):
self.check_architecture_in("numpy-1.23.5.dist-info", ["manylinux2014_x86_64", "manylinux1_x86_64"])
expected_files = self.test_data_files.union({"numpy", "numpy-1.23.5.dist-info", "numpy.libs"})
else:
Expand Down Expand Up @@ -168,12 +175,16 @@ def test_must_build_python_project_with_arm_architecture(self):
experimental_flags=self.experimental_flags,
)
expected_files = self.test_data_files.union({"numpy", "numpy.libs", "numpy-1.20.3.dist-info"})
if self.runtime in ("python3.12"):
expected_files = self.test_data_files.union({"numpy", "numpy.libs", "numpy-1.26.1.dist-info"})
if self.runtime in ("python3.10", "python3.11"):
expected_files = self.test_data_files.union({"numpy", "numpy.libs", "numpy-1.23.5.dist-info"})
output_files = set(os.listdir(self.artifacts_dir))
self.assertEqual(expected_files, output_files)

if self.runtime in ("python3.10", "python3.11"):
if self.runtime in ("python3.12"):
self.check_architecture_in("numpy-1.26.1.dist-info", ["manylinux2014_aarch64"])
elif self.runtime in ("python3.10", "python3.11"):
self.check_architecture_in("numpy-1.23.5.dist-info", ["manylinux2014_aarch64"])
else:
self.check_architecture_in("numpy-1.20.3.dist-info", ["manylinux2014_aarch64"])
Expand Down Expand Up @@ -245,7 +256,10 @@ def test_must_resolve_unknown_package_name(self):
runtime=self.runtime,
experimental_flags=self.experimental_flags,
)
expected_files = self.test_data_files.union(["inflate64", "inflate64.libs", "inflate64-0.1.4.dist-info"])
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"])
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 +1,2 @@
inflate64==0.1.4 --no-binary=:inflate64:
inflate64==0.3.1; python_version < '3.8' --no-binary=:inflate64:
inflate64==1.0.0; python_version >= '3.8' --no-binary=:inflate64:
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ 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'
numpy==1.23.5; python_version == '3.11'
numpy==1.23.5; python_version == '3.11'
numpy==1.26.1; python_version == '3.12'
3 changes: 3 additions & 0 deletions tests/unit/workflows/python_pip/test_packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ def test_get_lambda_abi_python310(self):
def test_get_lambda_abi_python311(self):
assert "cp311" == get_lambda_abi("python3.11")

def test_get_lambda_abi_python312(self):
assert "cp312" == get_lambda_abi("python3.12")


class TestPythonPipDependencyBuilder(object):
def test_can_call_dependency_builder(self, osutils):
Expand Down

0 comments on commit c44e1b1

Please sign in to comment.