diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1aea07e652..5ab0561213 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -144,6 +144,7 @@ jobs: 3.10 3.11 3.12 + 3.13 ${{ matrix.python }} - uses: actions/setup-go@v5 with: @@ -249,6 +250,7 @@ jobs: 3.10 3.11 3.12 + 3.13 - name: Stop Docker Linux if: ${{ matrix.os == 'ubuntu-latest' }} run: | diff --git a/samcli/commands/build/command.py b/samcli/commands/build/command.py index e9be0ea91b..262e40034d 100644 --- a/samcli/commands/build/command.py +++ b/samcli/commands/build/command.py @@ -55,7 +55,7 @@ \b Supported Runtimes ------------------ - 1. Python 3.8, 3.9, 3.10, 3.11, 3.12 using PIP\n + 1. Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13 using PIP\n 2. Nodejs 20.x, 18.x, 16.x, 14.x, 12.x using NPM\n 3. Ruby 3.2, 3.3 using Bundler\n 4. Java 8, Java 11, Java 17, Java 21 using Gradle and Maven\n diff --git a/samcli/lib/build/workflow_config.py b/samcli/lib/build/workflow_config.py index 3bb646ab04..88bcc480b9 100644 --- a/samcli/lib/build/workflow_config.py +++ b/samcli/lib/build/workflow_config.py @@ -90,6 +90,7 @@ def get_layer_subfolder(build_workflow: str) -> str: "python3.10": "python", "python3.11": "python", "python3.12": "python", + "python3.13": "python", "nodejs4.3": "nodejs", "nodejs6.10": "nodejs", "nodejs8.10": "nodejs", @@ -157,6 +158,7 @@ def get_workflow_config( "python3.10": BasicWorkflowSelector(PYTHON_PIP_CONFIG), "python3.11": BasicWorkflowSelector(PYTHON_PIP_CONFIG), "python3.12": BasicWorkflowSelector(PYTHON_PIP_CONFIG), + "python3.13": BasicWorkflowSelector(PYTHON_PIP_CONFIG), "nodejs16.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG), "nodejs18.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG), "nodejs20.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG), diff --git a/samcli/lib/utils/architecture.py b/samcli/lib/utils/architecture.py index 2bc34ecb8f..9d45cc7290 100644 --- a/samcli/lib/utils/architecture.py +++ b/samcli/lib/utils/architecture.py @@ -23,6 +23,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.al2": [ARM64, X86_64], diff --git a/samcli/local/common/runtime_template.py b/samcli/local/common/runtime_template.py index c57d5008b8..d34adf3c54 100644 --- a/samcli/local/common/runtime_template.py +++ b/samcli/local/common/runtime_template.py @@ -16,7 +16,7 @@ RUNTIME_DEP_TEMPLATE_MAPPING = { "python": [ { - "runtimes": ["python3.12", "python3.11", "python3.10", "python3.9", "python3.8"], + "runtimes": ["python3.13", "python3.12", "python3.11", "python3.10", "python3.9", "python3.8"], "dependency_manager": "pip", "init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-python"), "build": True, @@ -117,6 +117,7 @@ def get_local_lambda_images_location(mapping, runtime): "provided.al2", "provided", # python runtimes in descending order + "python3.13", "python3.12", "python3.11", "python3.10", @@ -141,6 +142,7 @@ def get_local_lambda_images_location(mapping, runtime): "nodejs20.x": "amazon/nodejs20.x-base", "nodejs18.x": "amazon/nodejs18.x-base", "nodejs16.x": "amazon/nodejs16.x-base", + "python3.13": "amazon/python3.13-base", "python3.12": "amazon/python3.12-base", "python3.11": "amazon/python3.11-base", "python3.10": "amazon/python3.10-base", @@ -165,6 +167,7 @@ def get_local_lambda_images_location(mapping, runtime): "python3.10": "Python36", "python3.11": "Python36", "python3.12": "Python36", + "python3.13": "Python36", "dotnet6": "dotnet6", "dotnet8": "dotnet6", "go1.x": "Go1", diff --git a/samcli/local/docker/lambda_debug_settings.py b/samcli/local/docker/lambda_debug_settings.py index 7251da1851..4dfc1549d7 100644 --- a/samcli/local/docker/lambda_debug_settings.py +++ b/samcli/local/docker/lambda_debug_settings.py @@ -173,6 +173,10 @@ def get_debug_settings(debug_port, debug_args_list, _container_env_vars, runtime entry + ["/var/lang/bin/python3.12"] + debug_args_list + ["/var/runtime/bootstrap.py"], container_env_vars=_container_env_vars, ), + Runtime.python313.value: lambda: DebugSettings( + entry + ["/var/lang/bin/python3.13"] + debug_args_list + ["/var/runtime/bootstrap.py"], + container_env_vars=_container_env_vars, + ), } try: return entrypoint_mapping[runtime]() diff --git a/samcli/local/docker/lambda_image.py b/samcli/local/docker/lambda_image.py index 47a5d5d6ad..d28111b2e0 100644 --- a/samcli/local/docker/lambda_image.py +++ b/samcli/local/docker/lambda_image.py @@ -43,6 +43,7 @@ class Runtime(Enum): python310 = "python3.10" python311 = "python3.11" python312 = "python3.12" + python313 = "python3.13" ruby32 = "ruby3.2" ruby33 = "ruby3.3" java8al2 = "java8.al2" diff --git a/schema/samcli.json b/schema/samcli.json index 1831618a0a..dc1422cffa 100644 --- a/schema/samcli.json +++ b/schema/samcli.json @@ -23,7 +23,7 @@ "properties": { "parameters": { "title": "Parameters for the init command", - "description": "Available parameters for the init command:\n* no_interactive:\nDisable interactive prompting for init parameters. (fail if any required values are missing)\n* architecture:\nArchitectures for Lambda functions.\n\nArchitectures: ['arm64', 'x86_64']\n* location:\nTemplate location (git, mercurial, http(s), zip, path).\n* runtime:\nLambda runtime for application.\n\nRuntimes: dotnet8, dotnet6, go1.x, java21, java17, java11, java8.al2, nodejs20.x, nodejs18.x, nodejs16.x, provided, provided.al2, provided.al2023, python3.9, python3.8, python3.12, python3.11, python3.10, ruby3.3, ruby3.2\n* package_type:\nLambda deployment package type.\n\nPackage Types: Zip, Image\n* base_image:\nLambda base image for deploying IMAGE based package type.\n\nBase images: amazon/dotnet6-base, amazon/dotnet8-base, amazon/go-provided.al2-base, amazon/go-provided.al2023-base, amazon/go1.x-base, amazon/java11-base, amazon/java17-base, amazon/java21-base, amazon/java8.al2-base, amazon/nodejs16.x-base, amazon/nodejs18.x-base, amazon/nodejs20.x-base, amazon/python3.10-base, amazon/python3.11-base, amazon/python3.12-base, amazon/python3.8-base, amazon/python3.9-base, amazon/ruby3.2-base, amazon/ruby3.3-base\n* dependency_manager:\nDependency manager for Lambda runtime.\n\nDependency managers: bundler, cli-package, gradle, maven, mod, npm, pip\n* output_dir:\nDirectory to initialize AWS SAM application.\n* name:\nName of AWS SAM Application.\n* app_template:\nIdentifier of the managed application template to be used. Alternatively, run '$sam init' without options for an interactive workflow.\n* no_input:\nDisable Cookiecutter prompting and accept default values defined in the cookiecutter config.\n* extra_context:\nOverride custom parameters in the template's cookiecutter.json configuration e.g. {\"customParam1\": \"customValue1\", \"customParam2\":\"customValue2\"}\n* tracing:\nEnable AWS X-Ray tracing for application.\n* application_insights:\nEnable CloudWatch Application Insights monitoring for application.\n* structured_logging:\nEnable Structured Logging for application.\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.\n* save_params:\nSave the parameters provided via the command line to the configuration file.", + "description": "Available parameters for the init command:\n* no_interactive:\nDisable interactive prompting for init parameters. (fail if any required values are missing)\n* architecture:\nArchitectures for Lambda functions.\n\nArchitectures: ['arm64', 'x86_64']\n* location:\nTemplate location (git, mercurial, http(s), zip, path).\n* runtime:\nLambda runtime for application.\n\nRuntimes: dotnet8, dotnet6, go1.x, java21, java17, java11, java8.al2, nodejs20.x, nodejs18.x, nodejs16.x, provided, provided.al2, provided.al2023, python3.9, python3.8, python3.13, python3.12, python3.11, python3.10, ruby3.3, ruby3.2\n* package_type:\nLambda deployment package type.\n\nPackage Types: Zip, Image\n* base_image:\nLambda base image for deploying IMAGE based package type.\n\nBase images: amazon/dotnet6-base, amazon/dotnet8-base, amazon/go-provided.al2-base, amazon/go-provided.al2023-base, amazon/go1.x-base, amazon/java11-base, amazon/java17-base, amazon/java21-base, amazon/java8.al2-base, amazon/nodejs16.x-base, amazon/nodejs18.x-base, amazon/nodejs20.x-base, amazon/python3.10-base, amazon/python3.11-base, amazon/python3.12-base, amazon/python3.13-base, amazon/python3.8-base, amazon/python3.9-base, amazon/ruby3.2-base, amazon/ruby3.3-base\n* dependency_manager:\nDependency manager for Lambda runtime.\n\nDependency managers: bundler, cli-package, gradle, maven, mod, npm, pip\n* output_dir:\nDirectory to initialize AWS SAM application.\n* name:\nName of AWS SAM Application.\n* app_template:\nIdentifier of the managed application template to be used. Alternatively, run '$sam init' without options for an interactive workflow.\n* no_input:\nDisable Cookiecutter prompting and accept default values defined in the cookiecutter config.\n* extra_context:\nOverride custom parameters in the template's cookiecutter.json configuration e.g. {\"customParam1\": \"customValue1\", \"customParam2\":\"customValue2\"}\n* tracing:\nEnable AWS X-Ray tracing for application.\n* application_insights:\nEnable CloudWatch Application Insights monitoring for application.\n* structured_logging:\nEnable Structured Logging for application.\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.\n* save_params:\nSave the parameters provided via the command line to the configuration file.", "type": "object", "properties": { "no_interactive": { @@ -48,7 +48,7 @@ "runtime": { "title": "runtime", "type": "string", - "description": "Lambda runtime for application.\n\nRuntimes: dotnet8, dotnet6, go1.x, java21, java17, java11, java8.al2, nodejs20.x, nodejs18.x, nodejs16.x, provided, provided.al2, provided.al2023, python3.9, python3.8, python3.12, python3.11, python3.10, ruby3.3, ruby3.2", + "description": "Lambda runtime for application.\n\nRuntimes: dotnet8, dotnet6, go1.x, java21, java17, java11, java8.al2, nodejs20.x, nodejs18.x, nodejs16.x, provided, provided.al2, provided.al2023, python3.9, python3.8, python3.13, python3.12, python3.11, python3.10, ruby3.3, ruby3.2", "enum": [ "dotnet6", "dotnet8", @@ -66,6 +66,7 @@ "python3.10", "python3.11", "python3.12", + "python3.13", "python3.8", "python3.9", "ruby3.2", @@ -84,7 +85,7 @@ "base_image": { "title": "base_image", "type": "string", - "description": "Lambda base image for deploying IMAGE based package type.\n\nBase images: amazon/dotnet6-base, amazon/dotnet8-base, amazon/go-provided.al2-base, amazon/go-provided.al2023-base, amazon/go1.x-base, amazon/java11-base, amazon/java17-base, amazon/java21-base, amazon/java8.al2-base, amazon/nodejs16.x-base, amazon/nodejs18.x-base, amazon/nodejs20.x-base, amazon/python3.10-base, amazon/python3.11-base, amazon/python3.12-base, amazon/python3.8-base, amazon/python3.9-base, amazon/ruby3.2-base, amazon/ruby3.3-base", + "description": "Lambda base image for deploying IMAGE based package type.\n\nBase images: amazon/dotnet6-base, amazon/dotnet8-base, amazon/go-provided.al2-base, amazon/go-provided.al2023-base, amazon/go1.x-base, amazon/java11-base, amazon/java17-base, amazon/java21-base, amazon/java8.al2-base, amazon/nodejs16.x-base, amazon/nodejs18.x-base, amazon/nodejs20.x-base, amazon/python3.10-base, amazon/python3.11-base, amazon/python3.12-base, amazon/python3.13-base, amazon/python3.8-base, amazon/python3.9-base, amazon/ruby3.2-base, amazon/ruby3.3-base", "enum": [ "amazon/dotnet6-base", "amazon/dotnet8-base", @@ -101,6 +102,7 @@ "amazon/python3.10-base", "amazon/python3.11-base", "amazon/python3.12-base", + "amazon/python3.13-base", "amazon/python3.8-base", "amazon/python3.9-base", "amazon/ruby3.2-base", diff --git a/tests/integration/buildcmd/test_build_cmd_arm64.py b/tests/integration/buildcmd/test_build_cmd_arm64.py index b1eb8acb7b..203915bfa8 100644 --- a/tests/integration/buildcmd/test_build_cmd_arm64.py +++ b/tests/integration/buildcmd/test_build_cmd_arm64.py @@ -37,11 +37,13 @@ class TestBuildCommand_PythonFunctions_With_Specified_Architecture_arm64(BuildIn ("python3.10", "Python", False), ("python3.11", "Python", False), ("python3.12", "Python", False), + ("python3.13", "Python", False), ("python3.8", "PythonPEP600", False), ("python3.9", "PythonPEP600", False), ("python3.10", "PythonPEP600", False), ("python3.11", "PythonPEP600", False), ("python3.12", "PythonPEP600", False), + ("python3.13", "PythonPEP600", False), ("python3.8", "Python", "use_container"), ("python3.9", "Python", "use_container"), ("python3.10", "Python", "use_container"), @@ -54,6 +56,7 @@ def test_with_default_requirements(self, runtime, codeuri, use_container): @parameterized.expand( [ ("python3.12", "Python", "use_container"), + ("python3.13", "Python", "use_container"), ] ) @pytest.mark.al2023 diff --git a/tests/integration/buildcmd/test_build_cmd_python.py b/tests/integration/buildcmd/test_build_cmd_python.py index 14ed540082..a59a4ad2f1 100644 --- a/tests/integration/buildcmd/test_build_cmd_python.py +++ b/tests/integration/buildcmd/test_build_cmd_python.py @@ -78,8 +78,8 @@ def test_with_default_requirements(self, runtime, dockerfile): @parameterized.expand( [ - *[(runtime, "Dockerfile") for runtime in ["3.12"]], - *[(runtime, "Dockerfile.production") for runtime in ["3.12"]], + *[(runtime, "Dockerfile") for runtime in ["3.12", "3.13"]], + *[(runtime, "Dockerfile.production") for runtime in ["3.12", "3.13"]], ] ) @pytest.mark.al2023 @@ -307,6 +307,8 @@ def test_with_default_requirements(self): [ ("python3.12", "Python"), ("python3.12", "PythonPEP600"), + ("python3.13", "Python"), + ("python3.13", "PythonPEP600"), ], ) @pytest.mark.al2023 @@ -362,6 +364,7 @@ def test_with_default_requirements(self, runtime): @parameterized.expand( [ ("python3.12",), + ("python3.13",), ] ) @pytest.mark.al2023 @@ -489,6 +492,9 @@ def test_with_default_requirements(self, runtime, codeuri, use_container, archit ("python3.12", "Python", False, "x86_64"), ("python3.12", "PythonPEP600", False, "x86_64"), ("python3.12", "Python", "use_container", "x86_64"), + ("python3.13", "Python", False, "x86_64"), + ("python3.13", "PythonPEP600", False, "x86_64"), + ("python3.13", "Python", "use_container", "x86_64"), ] ) @pytest.mark.al2023 diff --git a/tests/integration/testdata/buildcmd/Python/requirements.txt b/tests/integration/testdata/buildcmd/Python/requirements.txt index 830e1c4b89..b840aaf2bb 100644 --- a/tests/integration/testdata/buildcmd/Python/requirements.txt +++ b/tests/integration/testdata/buildcmd/Python/requirements.txt @@ -5,6 +5,7 @@ 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.1; python_version == '3.13' # `cryptography` has a dependency on `pycparser` which, for some reason doesn't build inside a Docker container. # Turning this off until we resolve this issue: https://github.com/awslabs/aws-lambda-builders/issues/29 # cryptography~=2.4 diff --git a/tests/integration/testdata/buildcmd/PythonPEP600/requirements.txt b/tests/integration/testdata/buildcmd/PythonPEP600/requirements.txt index af06dbb85c..c2c4a815d5 100644 --- a/tests/integration/testdata/buildcmd/PythonPEP600/requirements.txt +++ b/tests/integration/testdata/buildcmd/PythonPEP600/requirements.txt @@ -5,5 +5,6 @@ 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.1; python_version == '3.13' greenlet==3.0.1 sqlalchemy==2.0.23 diff --git a/tests/unit/lib/build_module/test_workflow_config.py b/tests/unit/lib/build_module/test_workflow_config.py index 10b9fe0765..422745d1d8 100644 --- a/tests/unit/lib/build_module/test_workflow_config.py +++ b/tests/unit/lib/build_module/test_workflow_config.py @@ -16,7 +16,7 @@ def setUp(self): self.project_dir = "" EventTracker.clear_trackers() - @parameterized.expand([("python3.8",), ("python3.9",), ("python3.10",), ("python3.11",), ("python3.12",)]) + @parameterized.expand([("python3.8",), ("python3.9",), ("python3.10",), ("python3.11",), ("python3.12",), ("python3.13",)]) def test_must_work_for_python(self, runtime): result = get_workflow_config(runtime, self.code_dir, self.project_dir) self.assertEqual(result.language, "python") diff --git a/tests/unit/local/docker/test_lambda_container.py b/tests/unit/local/docker/test_lambda_container.py index 0b0841999c..25355c6be4 100644 --- a/tests/unit/local/docker/test_lambda_container.py +++ b/tests/unit/local/docker/test_lambda_container.py @@ -25,6 +25,7 @@ Runtime.python310.value, Runtime.python311.value, Runtime.python312.value, + Runtime.python313.value, Runtime.dotnet6.value, Runtime.dotnet8.value, ] diff --git a/tests/unit/local/docker/test_lambda_debug_settings.py b/tests/unit/local/docker/test_lambda_debug_settings.py index 21e85ef129..ea9e692124 100644 --- a/tests/unit/local/docker/test_lambda_debug_settings.py +++ b/tests/unit/local/docker/test_lambda_debug_settings.py @@ -21,6 +21,7 @@ Runtime.python310, Runtime.python311, Runtime.python312, + Runtime.python313, ]