Repository navigation
feat(python-uv): add build options (groups, extras, prune) and show uv warnings - #966
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 (6)
|
There was a problem hiding this comment.
🧪 Hands-on test reproduced 2 new problems on commit 67405ec. Commands and evidence are in the hands-on comment.
- [BUG] uv_install_project on a tool.uv.package=true project without [build-system] leaves build/ and *.egg-info in the source dir, and build/ is copied into the Lambda artifacts · medium · aws_lambda_builders/workflows/python_uv/packager.py:517
- [UX] New build-option validation errors read 'PythonUvBuilder:None - ...' because _fail passes action_name=None · low · aws_lambda_builders/workflows/python_uv/workflow.py:146
🤖 Automated hands-on test — not a review approval
There was a problem hiding this comment.
🧪 Hands-on test reproduced 1 new problem on commit cdfac24. Commands and evidence are in the hands-on comment.
- [BUG] uv_install_project (setuptools) fails with configparser InterpolationSyntaxError when the scratch path contains '%' · low · aws_lambda_builders/workflows/python_uv/packager.py:176
🤖 Automated hands-on test — not a review approval
94f821b to
640f2b7
Compare
…v warnings Add uv_groups, uv_extras, uv_all_extras and uv_prune build options to the python_uv workflow. They are passed to uv export; bad values, unknown uv_* keys, combining uv_extras with uv_all_extras, options on a requirements.txt build, and uv_prune names missing from uv.lock fail the build with a clear PythonUvBuilder:Validation error. Log uv warning blocks at WARNING level, once per build, so problems such as an unknown [tool.uv] key are visible in a normal sam build. Document which pyproject.toml and UV_* settings reach the build.
640f2b7 to
7e73f78
Compare
vicheey
left a comment
There was a problem hiding this comment.
Thanks for this, the validation and the prune pre-check read well.
- Could you add
uv_all_extras: Trueto the workflow test that checks options reach the config (test_options_are_passed_to_the_build_action)? Today the value is only asserted asFalse, so a change that stops forwarding it would not fail any test. - uv warnings now print at WARNING for every build, including ones with no options set. For example, uv's "Failed to hardlink files; falling back to full copy" notice will now show on builds where the cache and target are on different filesystems. Could you mention that in the PR description and DESIGN.md, or limit the promoted warnings to the settings-related ones?
Optional: uv_prune with the project's own name passes the lock check and produces an empty dependency set. Rejecting it, or failing on an empty export, would make that mistake visible.
Issue #, if available: #839
Description of changes
Adds four build options to the
python_uvworkflow (groups, extras, all extras, prune), documents whichpyproject.tomlsettings apply, and shows uv warnings in the build log.The build options are read from the workflow
optionsand passed touv export. SAM CLI will map them fromMetadata.BuildPropertiesin a follow-up.uv exportuv_groups(list of str)UvGroups--group <name>per entryuv_extras(list of str)UvExtras--extra <name>per entryuv_all_extras(bool)UvAllExtras--all-extrasuv_prune(list of str)UvPrune--prune <name>per entry: drops the package and any dependency only it needsWith no options set, the export command is unchanged. The project itself is still never exported (
--no-emit-project); only its dependencies are installed.uv_pruneis for packages the Lambda runtime already ships, such asboto3: pruning it also dropsbotocore,s3transferandjmespath, but keepsurllib3whenrequestsneeds it. The function then runs with the runtime's boto3, whose version AWS picks, not the one inuv.lock.Bad input fails the build with a clear message (
PythonUvBuilder:Validation - ...) instead of being ignored:uv_*key (catches typos likeuv_group)uv_extrastogether withuv_all_extrasrequirements.txtbuild (they only apply to pyproject.toml / uv.lock projects)uv_prunename that is not a package inuv.lock(uv export --pruneignores unknown names silently)uv warnings now show in the build log. Until now the workflow logged uv's output only at debug level, so a normal
sam buildhid every uv warning. That matters because an unknown key in[tool.uv]or[tool.uv.pip]makes uv ignore every setting in thatpyproject.toml, and uv's warning was the only sign. Eachwarning:block uv prints (with its indented detail lines) is now logged at WARNING level, once per build, even though uv repeats it on lock, export and install. Other uv output stays at debug level, and error handling is unchanged. Example:DESIGN.md gets a short "Build options" section and a "Settings from pyproject.toml" section: which
[tool.uv],[tool.uv.pip]andUV_*settings reach the build, that the workflow's own flags win, and that only the workspace root's settings count in a uv workspace.Not in this PR: bytecode compilation (#926); and an index option.
uv pip installalready reads non-explicit[[tool.uv.index]]andindex-urlfrom the project's pyproject.toml, because it runs from the project directory. Explicit indexes pinned through[tool.uv.sources]are not honored on this path yet; that needs a separate change.Description of how you validated changes
uv exportand do not leak intouv pip install..pth. A second test prunesboto3from a project that also depends onrequests:boto3,botocore,s3transferandjmespathare gone,requestsandurllib3stay, and an unknown prune name fails the build.error:lines not promoted, repeats logged once, also on a failed command). An integration test builds a project with an unknown[tool.uv]key throughLambdaBuilderwith real uv 0.13.8 and checks the warning is logged exactly once at WARNING level.make lint,make black-checkandmake testpass (1135 passed, 95.30% coverage). All 62python_uvintegration tests pass.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.