Skip to content

feat: add Python 3.15 runtime - #9398

Merged
vicheey merged 6 commits into
aws:developfrom
jhengle:python315-support
Nov 13, 2026
Merged

vicheey merged 6 commits into
aws:developfrom
jhengle:python315-support

Conversation

@jhengle

@jhengle jhengle commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Which issue(s) does this change fix?

Why is this change necessary?

To add python3.13 runtime support

How does it address the issue?

What side effects does this change have?

Mandatory Checklist

PRs will only be reviewed after checklist is complete

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jhengle
jhengle requested a review from a team as a code owner November 3, 2026 20:14
@aws-sam-tooling-bot

aws-sam-tooling-bot Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

🧪 Hands-on test: No problems observed in 6 scenarios

Commit f08a2b9 · build LambdaToolingHandsOn-NoDocker:f8eac2fb-90bc-4622-95ea-ce1f14d47e33. The plan's scenarios ran on an isolated build host; a problem is reported only if it reproduced at least twice. Passing scenarios show only that these checks behaved as expected, not that the change is correct.

Scenarios

Scenario Planned check Result Runner's note
S1 Main path: sam build of a zip function with Runtime python3.15 (pip workflow, x86_64) using the repo's Python fixture… ✅ pass Head: samdev build (SAM_CLI_DEV=1 installs the entry point as samdev, not sam) with Runtime=python3.15 on x86_64 using the Python fixture exited 0 with 'Build Succeeded'. The artifact has main.py, …
S2 Edge case: PEP 600 wheel naming with the PR's new Python 3.15 pins (numpy==2.5.4, greenlet==3.5.6, plus sqlalchemy and … ✅ pass Head: the PythonPEP600 fixture built for python3.15 with exit 0 and 'Build Succeeded'. The new pins resolved: numpy-2.5.4.dist-info, greenlet-3.5.6.dist-info and sqlalchemy/ are all present in .aws-s…
S3 Architecture map and layer subfolder: build a python3.15 function with Architectures [arm64] and a python3.15 layer (Bu… ✅ pass Head: a python3.15 function with Architectures [arm64] plus a layer with BuildMethod python3.15 / BuildArchitecture arm64 built with exit 0. numpy extensions are *.cpython-315-aarch64-linux-gnu.so, a…
S4 Beta python-uv workflow with python3.15 using the PythonPyProject fixture and the PR's updated pyproject.toml/uv.lock (… ✅ pass Head: samdev build --beta-features with template_uv.yaml and the PythonPyProject fixture used PythonUvBuilder with the lock-based build for python3.15 and exited 0 with 'Build Succeeded'. The artif…
S5 sam validate --lint accepts Runtime python3.15, as the PR's updated test_lint_supported_runtimes integration test exp… ✅ pass Head: with cfn-lint 1.58.0, samdev validate --lint --region us-east-1 on a python3.15 template exited 0 with 'is a valid SAM Template' and printed no runtime warnings. The 'Pipe to stdout was broke…
S6 Consistency: the committed schema/samcli.json matches what make schema generates from the PR's runtime lists, and the… ✅ pass Head: running python -m schema.make_schema regenerated schema/samcli.json with no diff (git diff --exit-code returned 0, 8 python3.15 mentions), and the file was restored afterwards. The changed un…
Runner's notes in full
  • S1: Head: samdev build (SAM_CLI_DEV=1 installs the entry point as samdev, not sam) with Runtime=python3.15 on x86_64 using the Python fixture exited 0 with 'Build Succeeded'. The artifact has main.py, numpy/, numpy-2.5.4.dist-info, cryptography/ and numpy extensions named *.cpython-315-x86_64-linux-gnu.so. Importing main under uv's Python 3.15.2 printed a Fernet key and {'pi': '3.14'}. Base (same fixture, base code) exited 1 with "Error: 'python3.15' runtime is not supported" and created no .aws-sam/build/Function.
  • S2: Head: the PythonPEP600 fixture built for python3.15 with exit 0 and 'Build Succeeded'. The new pins resolved: numpy-2.5.4.dist-info, greenlet-3.5.6.dist-info and sqlalchemy/ are all present in .aws-sam/build/Function.
  • S3: Head: a python3.15 function with Architectures [arm64] plus a layer with BuildMethod python3.15 / BuildArchitecture arm64 built with exit 0. numpy extensions are *.cpython-315-aarch64-linux-gnu.so, and the function has 0 x86_64 .so files. .aws-sam/build/Layer/python/ contains six.py, six-1.17.0.dist-info and mylayer.py. Base: the build failed at the layer with "Error: 'python3.15' does not have a supported builder" (exit 1).
  • S4: Head: samdev build --beta-features with template_uv.yaml and the PythonPyProject fixture used PythonUvBuilder with the lock-based build for python3.15 and exited 0 with 'Build Succeeded'. The artifact has numpy-2.5.4.dist-info (not 2.3.4), cryptography-3.3.2, cffi-2.1.1 and pycparser-3.12, with cpython-315 extension modules.
  • S5: Head: with cfn-lint 1.58.0, samdev validate --lint --region us-east-1 on a python3.15 template exited 0 with 'is a valid SAM Template' and printed no runtime warnings. The 'Pipe to stdout was broken' line in the log comes from `pip show | head` and is unrelated to the test.
  • S6: Head: running python -m schema.make_schema regenerated schema/samcli.json with no diff (git diff --exit-code returned 0, 8 python3.15 mentions), and the file was restored afterwards. The changed unit tests (test_workflow_config, test_lambda_debug_settings, test_lambda_container, init test_cli) all passed: 280 passed.

🤖 Automated hands-on test — not a review approval · model claude-opus-5.5 · Kiro kiro-cli 2.33.1 · build LambdaToolingHandsOn-NoDocker:f8eac2fb-90bc-4622-95ea-ce1f14d47e33 · commit f08a2b9

History (6)
Commit Result When (UTC) Build
f08a2b9 No problems observed 2026-11-13 20:49 LambdaToolingHandsOn-NoDocker:f8eac2fb-90bc-4622-95ea-ce1f14d47e33
1e0a384 No problems observed 2026-11-13 19:43 LambdaToolingHandsOn-NoDocker:6555b1b7-a508-4a5e-8268-3a8488dc8d2f
8a3c75b Problems reproduced: sam build for python3.15 fails: pinned aws-lambda-builders 1.68.0 rejects 'Runt… 2026-11-13 01:06 LambdaToolingHandsOn-Docker:e2438dde-45a3-476c-90fe-e086e287a3fd
87e21a5 Problems reproduced: sam build fails for python3.15 with the pip workflow: pinned aws_lambda_builder… 2026-11-11 18:53 LambdaToolingHandsOn-NoDocker:72650409-24d9-41d6-861d-25a47cbb27e7
53f64bf Problems reproduced: sam build with pip rejects python3.15: pinned aws_lambda_builders==1.68.0 does … 2026-11-04 18:00 LambdaToolingHandsOn-Docker:178737df-6465-4120-aa1f-78a417bbe482
7949248 Problems reproduced: sam build fails for python3.15 (pip workflow): pinned aws_lambda_builders 1.68.… 2026-11-03 20:26 LambdaToolingHandsOn-Docker:7a8a2eec-5a60-48cb-992f-c35a2c00f148

@aws-sam-tooling-bot aws-sam-tooling-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧪 Hands-on test reproduced 1 new problem on commit 7949248. Commands and evidence are in the hands-on comment.

  1. [BUG] sam build fails for python3.15 (pip workflow): pinned aws_lambda_builders 1.68.0 does not support python3.15 · high · pyproject.toml:48

🤖 Automated hands-on test — not a review approval

@github-actions github-actions Bot added area/local/start-api sam local start-api command area/build sam build command area/local/invoke sam local invoke command area/local/start-invoke area/schema JSON schema file pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Nov 3, 2026

@aws-sam-tooling-bot aws-sam-tooling-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Lambda Tooling PR Reviewer: No high-confidence issues found.

1 lower-confidence observation: these passed verification at a lower score, so check before acting

1. [BUG] tests/integration/buildcmd/test_build_cmd_python.py:369: New python3.15 non-container build tests run sam local invoke against an image this PR says is not released yet

The PR adds python3.15 cases with use_container=False at lines 362-369, 379-381 and 592-593, and at lines 43 and 50 of test_build_cmd_arm64.py. All of them go through BuildIntegPythonBase._test_with_default_requirements, which calls _verify_invoke_built_function whenever SKIP_DOCKER_TESTS is false. That invoke needs a python3.15 Lambda image. The same PR holds back the Dockerfile tests with the comment # add "3.15" once public.ecr.aws/lambda/python:3.15 is released, so by the PR's own statement these invoke steps will fail in Docker-enabled CI. To fix it, hold these cases back the same way, or pass a flag that skips the invoke step for 3.15 until the image is published.

@aws-sam-tooling-bot aws-sam-tooling-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧪 Hands-on test reproduced 1 new problem on commit 53f64bf. Commands and evidence are in the hands-on comment.

  1. [BUG] sam build with pip rejects python3.15: pinned aws_lambda_builders==1.68.0 does not support the runtime the PR adds · high · pyproject.toml:49

🤖 Automated hands-on test — not a review approval

bnusunny
bnusunny previously approved these changes Nov 9, 2026

@reedham-aws reedham-aws left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes mostly look good. I think we'll have to wait for lambda-builders release for the tests to start passing (at least some of the tests).

Comment thread samcli/lib/utils/tar.py Outdated
Comment on lines +109 to +115
try:
# commonpath compares whole path components; commonprefix compares characters,
# which would wrongly treat "/tmp/ab/x" as being inside "/tmp/a".
return os.path.commonpath([abs_directory, abs_target]) == abs_directory
except ValueError:
# Raised for paths on different drives (Windows): they cannot be nested
return False

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't follow why this is being changed here. The same change is in aws/aws-lambda-builders#950, and there I commented that the original comment is confusing because commonprefix isn't used anymore, so it doesn't make sense to mention it in the comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is os.path.commonprefix() is deprecated in Python3.15. Yeah this PR also makes sam-cli itself Python3.15 compatible, which I think is ok. I am not sure if this code reachable or not, but it must failed some thing that AI made the change.

# Note that returning within a finally block will have the effect of swallowing
# any reraised exceptions.
return auth_service_error
if auth_service_error:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also don't see why we're changing the comment here for what seems unrelated. The Python 3.15 update is not for the Python interpreter that runs this code in SAM CLI, but the interpreter that is used for user code. This means that the Python 3.15 update shouldn't affect this code at all. I could be wrong or misunderstanding something about this, so just let me know.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this PR includes changes to make sam-cli run in Python3.15. The change here was because some error / warning I remember, which said return should not be inside finally block.

@aws-sam-tooling-bot aws-sam-tooling-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧪 Hands-on test reproduced 1 new problem on commit 87e21a5. Commands and evidence are in the hands-on comment.

  1. [BUG] sam build fails for python3.15 with the pip workflow: pinned aws_lambda_builders 1.68.0 does not support python3.15 · high · pyproject.toml:49

🤖 Automated hands-on test — not a review approval

@reedham-aws reedham-aws left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After seeing the extra changes required to support 3.15 as a version to run SAM CLI, I think they're big enough to require a different PR. I think there might also be a few things missing, like an update to

target_version = ['py310', 'py311', 'py312', 'py313']
or
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Environment :: Other Environment",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",

Comment thread pyproject.toml
"regex!=2021.10.8",
"tzlocal==5.4.4",
# Bounded to the versions that lint every SAM resource type, see #9249
"cfn-lint>=1.52.0,<1.59",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I didn't leave this comment earlier, but what is the reason for bumping this here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because cfn-lint 1.59 starts to support Python3.15

@jhengle

jhengle commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

After seeing the extra changes required to support 3.15 as a version to run SAM CLI, I think they're big enough to require a different PR. I think there might also be a few things missing, like an update to

target_version = ['py310', 'py311', 'py312', 'py313']

or

classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Environment :: Other Environment",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",

So I can remove the sam-cli 3.15 support but only keep the runtime 3.15 support. Will that be ok?

Moves the changes that make SAM CLI itself run on Python 3.15 to a
separate PR (branch sam-cli-py315-support), so this PR only adds the
python3.15 Lambda runtime. Reverts:
- 53f64bf SAM CLI supports Python3.15
- 87e21a5 fix: preserve outside symlinks with --mount-symlinks on Python 3.14+

@aws-sam-tooling-bot aws-sam-tooling-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Lambda Tooling PR Reviewer: No high-confidence issues found.

1 lower-confidence observation: these passed verification at a lower score, so check before acting

1. [BUG] tests/integration/buildcmd/test_build_cmd_python.py:369: New python3.15 build rows still run sam local invoke against a Lambda image the PR itself describes as unreleased

BuildIntegPythonBase._test_with_default_requirements calls _verify_invoke_built_function whenever SKIP_DOCKER_TESTS is false, even with use_container=False. The invoke pulls public.ecr.aws/lambda/python:3.15-<arch>. The PR leaves 3.15 out of the image-based tests with the comment "add "3.15" once public.ecr.aws/lambda/python:3.15 is released". It still adds 3.15 rows that invoke: the non-container al2023 rows here, the architecture rows at lines 592-593, and the arm64 rows in test_build_cmd_arm64.py lines 43 and 50. Before merging, check whether that image is published. If it isn't, comment these rows out like the other 3.15 rows. If it is, the "once ... is released" comments are out of date.

@aws-sam-tooling-bot aws-sam-tooling-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧪 Hands-on test reproduced 1 new problem on commit 8a3c75b. Commands and evidence are in the hands-on comment.

  1. [BUG] sam build for python3.15 fails: pinned aws-lambda-builders 1.68.0 rejects 'Runtime python3.15 is not supported' · high · pyproject.toml:48

🤖 Automated hands-on test — not a review approval

reedham-aws
reedham-aws previously approved these changes Nov 13, 2026
@reedham-aws
reedham-aws enabled auto-merge (squash) November 13, 2026 21:50
@vicheey
vicheey disabled auto-merge November 13, 2026 23:47
@vicheey
vicheey merged commit 02a9ec3 into aws:develop Nov 13, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build sam build command area/local/invoke sam local invoke command area/local/start-api sam local start-api command area/local/start-invoke area/schema JSON schema file pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants