diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d8ea4d3cd..192eb6686 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -125,6 +125,7 @@ jobs: - "3.9" - "3.10" - "3.11" + - "3.12" npm: - 8 - 9 @@ -158,6 +159,7 @@ jobs: - "3.9" - "3.10" - "3.11" + - "3.12" steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 @@ -185,6 +187,7 @@ jobs: - "3.9" - "3.10" - "3.11" + - "3.12" steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 @@ -215,6 +218,7 @@ jobs: - "3.9" - "3.10" - "3.11" + - "3.12" steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 @@ -243,6 +247,7 @@ jobs: - "3.9" - "3.10" - "3.11" + - "3.12" steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 @@ -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 @@ -291,6 +301,7 @@ jobs: - "3.9" - "3.10" - "3.11" + - "3.12" steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 @@ -321,6 +332,7 @@ jobs: - "3.9" - "3.10" - "3.11" + - "3.12" steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 diff --git a/aws_lambda_builders/validator.py b/aws_lambda_builders/validator.py index 1f2de6df3..0306ce14d 100644 --- a/aws_lambda_builders/validator.py +++ b/aws_lambda_builders/validator.py @@ -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], diff --git a/aws_lambda_builders/workflows/python_pip/DESIGN.md b/aws_lambda_builders/workflows/python_pip/DESIGN.md index a53f2b518..c1d9fadb8 100644 --- a/aws_lambda_builders/workflows/python_pip/DESIGN.md +++ b/aws_lambda_builders/workflows/python_pip/DESIGN.md @@ -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` diff --git a/aws_lambda_builders/workflows/python_pip/packager.py b/aws_lambda_builders/workflows/python_pip/packager.py index 372868d03..252e45f7a 100644 --- a/aws_lambda_builders/workflows/python_pip/packager.py +++ b/aws_lambda_builders/workflows/python_pip/packager.py @@ -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: @@ -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` diff --git a/setup.py b/setup.py index ba5d6ea78..bcd79b7f1 100644 --- a/setup.py +++ b/setup.py @@ -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", diff --git a/tests/integration/workflows/python_pip/test_python_pip.py b/tests/integration/workflows/python_pip/test_python_pip.py index 58ee07298..e93781224 100644 --- a/tests/integration/workflows/python_pip/test_python_pip.py +++ b/tests/integration/workflows/python_pip/test_python_pip.py @@ -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])]) @@ -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): @@ -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: @@ -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: @@ -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"]) @@ -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) diff --git a/tests/integration/workflows/python_pip/testdata/requirements-inflate.txt b/tests/integration/workflows/python_pip/testdata/requirements-inflate.txt index 0680f795f..59b3fff69 100644 --- a/tests/integration/workflows/python_pip/testdata/requirements-inflate.txt +++ b/tests/integration/workflows/python_pip/testdata/requirements-inflate.txt @@ -1 +1,2 @@ -inflate64==0.1.4 --no-binary=:inflate64: \ No newline at end of file +inflate64==0.3.1; python_version < '3.8' --no-binary=:inflate64: +inflate64==1.0.0; python_version >= '3.8' --no-binary=:inflate64: \ No newline at end of file diff --git a/tests/integration/workflows/python_pip/testdata/requirements-numpy.txt b/tests/integration/workflows/python_pip/testdata/requirements-numpy.txt index 965a49f92..cf49c86eb 100644 --- a/tests/integration/workflows/python_pip/testdata/requirements-numpy.txt +++ b/tests/integration/workflows/python_pip/testdata/requirements-numpy.txt @@ -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' \ No newline at end of file +numpy==1.23.5; python_version == '3.11' +numpy==1.26.1; python_version == '3.12' diff --git a/tests/unit/workflows/python_pip/test_packager.py b/tests/unit/workflows/python_pip/test_packager.py index 355c5da71..5b8db0216 100644 --- a/tests/unit/workflows/python_pip/test_packager.py +++ b/tests/unit/workflows/python_pip/test_packager.py @@ -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):