Skip to content

Commit

Permalink
feat: Add python3.13 runtime support (#691)
Browse files Browse the repository at this point in the history
* feat: Add python3.13 runime support

* skip unknown_package_name test on Windows

* skip test using skipTest fn
  • Loading branch information
hnnasit authored Nov 7, 2024
1 parent eedc026 commit c2f1ce2
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 15 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
npm:
- 8
- 9
Expand Down Expand Up @@ -156,6 +157,7 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down Expand Up @@ -183,6 +185,7 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down Expand Up @@ -213,6 +216,7 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down Expand Up @@ -265,6 +269,7 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down Expand Up @@ -293,6 +298,7 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down Expand Up @@ -320,6 +326,7 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
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 @@ -18,6 +18,7 @@
"python3.10": [ARM64, X86_64],
"python3.11": [ARM64, X86_64],
"python3.12": [ARM64, X86_64],
"python3.13": [ARM64, X86_64],
"ruby3.2": [ARM64, X86_64],
"ruby3.3": [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.8, python3.9, python3.10, python3.11 or python3.12. These are
either be python3.8, python3.9, python3.10, python3.11, python3.12 or python3.13. 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 @@ -86,6 +86,7 @@ def get_lambda_abi(runtime):
"python3.10": "cp310",
"python3.11": "cp311",
"python3.12": "cp312",
"python3.13": "cp313",
}

if runtime not in supported:
Expand All @@ -100,7 +101,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.8, python3.9, python3.10, python3.11 or python3.12. These are currently the
either be python3.8, python3.9, python3.10, python3.11, python3.12 or python3.13. 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.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Internet",
"Topic :: Software Development :: Build Tools",
"Topic :: Utilities",
Expand Down
27 changes: 15 additions & 12 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", "python3.12"}
ARM_RUNTIMES = {"python3.8", "python3.9", "python3.10", "python3.11", "python3.12", "python3.13"}


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

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

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"})
if self.runtime in ("python3.12", "python3.13"):
self.check_architecture_in("numpy-2.1.2.dist-info", ["manylinux2014_x86_64", "manylinux1_x86_64"])
expected_files = self.test_data_files.union({"numpy", "numpy-2.1.2.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"})
Expand Down Expand Up @@ -126,10 +127,10 @@ def test_must_build_python_project_python3_binary(self):
executable_search_paths=[executable_dir],
)

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"):
if self.runtime in ("python3.12", "python3.13"):
self.check_architecture_in("numpy-2.1.2.dist-info", ["manylinux2014_x86_64", "manylinux1_x86_64"])
expected_files = self.test_data_files.union({"numpy", "numpy-2.1.2.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 Down Expand Up @@ -174,15 +175,15 @@ 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.12", "python3.13"):
expected_files = self.test_data_files.union({"numpy", "numpy.libs", "numpy-2.1.2.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.12"):
self.check_architecture_in("numpy-1.26.1.dist-info", ["manylinux2014_aarch64"])
if self.runtime in ("python3.12", "python3.13"):
self.check_architecture_in("numpy-2.1.2.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:
Expand Down Expand Up @@ -247,6 +248,8 @@ def test_must_resolve_local_dependency(self):
self.assertIn(f, output_files)

def test_must_resolve_unknown_package_name(self):
if IS_WINDOWS and self.runtime == "python3.13":
self.skipTest("Skip test as pip install inflate64 does not work on Windows with Python 3.13")
self.builder.build(
self.source_dir,
self.artifacts_dir,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ 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.26.1; python_version == '3.12'
numpy==2.1.2; python_version == '3.12'
numpy==2.1.2; python_version == '3.13'
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_python311(self):
def test_get_lambda_abi_python312(self):
assert "cp312" == get_lambda_abi("python3.12")

def test_get_lambda_abi_python313(self):
assert "cp313" == get_lambda_abi("python3.13")


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

0 comments on commit c2f1ce2

Please sign in to comment.