Skip to content

Commit

Permalink
Merge branch 'develop' into nodejs22-support
Browse files Browse the repository at this point in the history
  • Loading branch information
hnnasit authored Nov 16, 2024
2 parents 503a262 + 2a2d6b7 commit f1a0b31
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 20 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
2 changes: 1 addition & 1 deletion aws_lambda_builders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
# Changing version will trigger a new release!
# Please make the version change as the last step of your development.

__version__ = "1.50.0"
__version__ = "1.51.0"
RPC_PROTOCOL_VERSION = "0.3"
1 change: 1 addition & 0 deletions aws_lambda_builders/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,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
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,5 @@ def _get_jvm_string(self, gradle_path):

for line in stdout.splitlines():
l_dec = decode(line)
if l_dec.startswith("JVM"):
if "JVM" in l_dec:
return l_dec
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
7 changes: 4 additions & 3 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
coverage==7.6.3; python_version>="3.9"
coverage==7.6.4; python_version>="3.9"
coverage==7.6.1; python_version<"3.9"
flake8==3.8.4
pytest-cov==5.0.0
pytest-cov==6.0.0; python_version>="3.9"
pytest-cov==5.0.0; python_version<"3.9"

# Test requirements
pytest>=6.1.1
Expand All @@ -11,4 +12,4 @@ pyelftools~=0.31 # Used to verify the generated Go binary architecture in integr
# formatter
black==24.10.0; python_version>="3.9"
black==24.8.0; python_version<"3.9"
ruff==0.6.9
ruff==0.7.3
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'
34 changes: 34 additions & 0 deletions tests/unit/workflows/java_gradle/test_gradle_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,40 @@ def test_emits_warning_when_version_string_not_found(self):
validator.validate(runtime_path=self.runtime_path)
self.mock_log.warning.assert_called_with(GradleValidator.VERSION_STRING_WARNING, self.runtime_path)

@parameterized.expand(
[
("1.8.0", "java8"),
("11.0.0", "java11"),
("17.0.0", "java17"),
("21.0.0", "java21"),
]
)
def test_does_not_emit_warning_for_version_string_in_gradle_lt_8_9(self, version, runtime):
version_string = f"JVM: {version}".encode()
self.mock_os_utils.popen.side_effect = [FakePopen(stdout=version_string, returncode=0)]
validator = GradleValidator(
runtime=runtime, architecture=self.architecture, os_utils=self.mock_os_utils, log=self.mock_log
)
validator.validate(runtime_path=self.runtime_path)
self.mock_log.warning.assert_not_called()

@parameterized.expand(
[
("1.8.0", "java8"),
("11.0.0", "java11"),
("17.0.0", "java17"),
("21.0.0", "java21"),
]
)
def test_does_not_emit_warning_for_version_string_in_gradle_ge_8_9(self, version, runtime):
version_string = f"Launcher JVM: {version}".encode()
self.mock_os_utils.popen.side_effect = [FakePopen(stdout=version_string, returncode=0)]
validator = GradleValidator(
runtime=runtime, architecture=self.architecture, os_utils=self.mock_os_utils, log=self.mock_log
)
validator.validate(runtime_path=self.runtime_path)
self.mock_log.warning.assert_not_called()

@parameterized.expand(
[
("11.0.0", "java11"),
Expand Down
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 f1a0b31

Please sign in to comment.