Repository navigation
feat(build): pass UvCompileBytecode to Lambda Builders - #9449
Conversation
🧪 Hands-on test: No problems observed in 6 scenariosCommit Scenarios
Runner's notes in full
🤖 Automated hands-on test — not a review approval · model claude-opus-5.5 · Kiro kiro-cli 2.33.1 · build History (2)
|
There was a problem hiding this comment.
🧪 Hands-on test reproduced 1 new problem on commit 5b312f1. Commands and evidence are in the hands-on comment.
- [COMPATIBILITY] UvCompileBytecode on python-uv functions/layers now fails sam build: pinned aws_lambda_builders 1.70.0 (and develop) rejects uv_compile_bytecode · medium · samcli/lib/build/app_builder.py:115
🤖 Automated hands-on test — not a review approval
| "UvExtras": "uv_extras", | ||
| "UvAllExtras": "uv_all_extras", | ||
| "UvPrune": "uv_prune", | ||
| "UvCompileBytecode": "uv_compile_bytecode", |
There was a problem hiding this comment.
🧪 Hands-on: [COMPATIBILITY] UvCompileBytecode on python-uv functions/layers now fails sam build: pinned aws_lambda_builders 1.70.0 (and develop) rejects uv_compile_bytecode (reproduced 2 times in S1). Commands and evidence: hands-on comment.
Which issue(s) does this change fix?
Related: aws/aws-lambda-builders#924
Why is this change necessary?
SAM zips use fixed timestamps. A
.pycfile that is checked by timestamp never matches its source in the zip, so Python recompiles it on every cold start. A.pycbuilt with unchecked hashes is used as-is. Lambda Builders is adding auv_compile_bytecodeoption to the python-uv workflow for this (aws/aws-lambda-builders#924), and SAM CLI needs a way to set it.How does it address the issue?
It adds
UvCompileBytecodetoUV_BUILD_PROPERTIES, soMetadata.BuildProperties.UvCompileBytecodeis passed to Lambda Builders asuv_compile_bytecode. It works for functions and python-uv layers, like the otherUv*properties. The value is passed through as-is; Lambda Builders checks the type.Setting it on a resource not built with python-uv fails with
InvalidBuildProperties, as the otherUv*properties do.Needs aws-lambda-builders 1.71.0, which adds the
uv_compile_bytecodeoption (aws/aws-lambda-builders#973); the pin was bumped in #9453. Checked end to end with 1.71.0: asam buildwithUvCompileBytecode: trueoutputssix.cpython-312.pycwith PEP 552 flags 1 (unchecked hash).What side effects does this change have?
None for templates that do not set
UvCompileBytecode.Tests:
InvalidBuildProperties.pytest tests/unit/lib/build_module tests/unit/commands/buildcmd: 576 passed, 1 skipped.black --check,ruff check samcliandmypy samcli/lib/build/app_builder.pyare clean.Mandatory Checklist
PRs will only be reviewed after checklist is complete
make prpassesmake update-reproducible-reqsif dependencies were changedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.