Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-sam-cli-bot committed Nov 7, 2024
2 parents f9ffd0c + 568acc4 commit b98cef7
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 32 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
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ integ-test:
LAMBDA_BUILDERS_DEV=1 pytest tests/integration

lint:
# Liner performs static analysis to catch latent bugs
ruff aws_lambda_builders
# Linter performs static analysis to catch latent bugs
ruff check aws_lambda_builders

lint-fix:
ruff aws_lambda_builders --fix
Expand All @@ -35,4 +35,4 @@ black-check:
# Verifications to run before sending a pull request
pr: init dev black-check

format: lint-fix black
format: lint-fix black
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 @@ -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
4 changes: 2 additions & 2 deletions aws_lambda_builders/workflows/nodejs_npm/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def execute(self):
:raises lambda_builders.actions.ActionFailedError: when NPM execution fails
"""
try:
LOG.debug("NODEJS installing in: %s", self.install_dir)
LOG.debug("NODEJS installing production dependencies in: %s", self.install_dir)

command = ["install", "-q", "--no-audit", "--no-save", "--unsafe-perm", "--production"]
self.subprocess_npm.run(command, cwd=self.install_dir)
Expand All @@ -132,7 +132,7 @@ def execute(self):
:raises lambda_builders.actions.ActionFailedError: when NPM execution fails
"""
try:
LOG.debug("NODEJS updating in: %s", self.install_dir)
LOG.debug("NODEJS updating production dependencies in: %s", self.install_dir)

command = [
"update",
Expand Down
5 changes: 5 additions & 0 deletions aws_lambda_builders/workflows/nodejs_npm/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,11 @@ def get_install_action(
if build_options and isinstance(build_options, dict):
npm_ci_option = build_options.get("use_npm_ci", False)

LOG.debug(
"npm installation actions install only production dependencies. "
"Dev dependencies are omitted from the Lambda artifacts package"
)

if (osutils.file_exists(lockfile_path) or osutils.file_exists(shrinkwrap_path)) and npm_ci_option:
return NodejsNpmCIAction(
install_dir=install_dir, subprocess_npm=subprocess_npm, install_links=is_building_in_source
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
16 changes: 9 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
[tool.ruff]
line-length = 120

[tool.ruff.lint]

select = [
"E", # Pycodestyle
"F", # Pyflakes
"PL", # pylint
"I", # isort
"E", # Pycodestyle
"F", # Pyflakes
"PL", # pylint
"I", # isort
]
ignore = ["PLR0913"]

[tool.ruff.pylint]
[tool.ruff.lint.pylint]
max-branches = 13

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401", "E501"]
"aws_lambda_builders/workflow.py" = ["E501"]

Expand All @@ -32,4 +34,4 @@ exclude = '''
| pip-wheel-metadata
)/
)
'''
'''
8 changes: 5 additions & 3 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
coverage==7.5.1
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

Expand All @@ -8,5 +9,6 @@ parameterized==0.9.0
pyelftools~=0.31 # Used to verify the generated Go binary architecture in integration tests (utils.py)

# formatter
black==24.4.2
ruff==0.4.3
black==24.10.0; python_version>="3.9"
black==24.8.0; python_version<"3.9"
ruff==0.7.1
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
14 changes: 13 additions & 1 deletion tests/integration/workflows/java_gradle/test_java_gradle.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import shutil
import tempfile
import platform

from unittest import TestCase
from pathlib import Path
Expand Down Expand Up @@ -36,7 +37,18 @@ class TestJavaGradle(TestCase):

def setUp(self):
self.artifacts_dir = tempfile.mkdtemp()
self.scratch_dir = tempfile.mkdtemp()

scratch_folder_override = None
if platform.system().lower() == "windows" and os.getenv("GITHUB_ACTIONS"):
# lucashuy: there is some really odd behaviour where
# gradle will refuse to work it is run within
# the default TEMP folder location in Github Actions
#
# use the runner's home directory as a workaround
scratch_folder_override = os.getenv("userprofile")

self.scratch_dir = tempfile.mkdtemp(dir=scratch_folder_override)

self.dependencies_dir = tempfile.mkdtemp()
self.builder = LambdaBuilder(language="java", dependency_manager="gradle", application_framework=None)

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 b98cef7

Please sign in to comment.