aws-sam-cli icon indicating copy to clipboard operation
aws-sam-cli copied to clipboard

Feature request: Add uv support for building

Open JonZeolla opened this issue 11 months ago • 6 comments
trafficstars

Describe your idea/feature/enhancement

Currently you can sam build with a --manifest requirements.txt but it would be nice to add support for uv.lock files as described here

JonZeolla avatar Nov 26 '24 18:11 JonZeolla

Hey, thanks for raising this up with us. Would it be fair to expand this further to supporting uv in general with SAM CLI's build processes? Currently, as you might already be aware, we only support pip as the tool to install and build Python projects, but we are open to requests.

lucashuy avatar Nov 27 '24 21:11 lucashuy

Yes, exactly. In the interim, uv does have a pip-compatible interface at uv pip ... which could be stepping stone

JonZeolla avatar Nov 30 '24 14:11 JonZeolla

so far, pip is the official tool for python packages, and the python ecosystem still not solidified on which tooling we should use, there is raw pip, poetry, uv, etc I think the best aproach is for sam-cli to just support requirements.txt and those tooling export to requirements.txt

in uv case:

uv pip compile -o src/requirements.txt pyproject.toml running this just before sam build should suffice

hellupline avatar Dec 10 '24 17:12 hellupline

There is a pretty extensive documentation on using uv with AWS Lambda: https://docs.astral.sh/uv/guides/integration/aws-lambda/

trallnag avatar Jan 20 '25 12:01 trallnag

Yes, but nothing for SAM. I think with all the traction uv is getting, this would be a very good addition to the SAM tooling if it could be added.

mbtx2 avatar Mar 31 '25 21:03 mbtx2

Please correct me if I am wrong. After I have analyzed the code in aws sam cli. There are two things before this can be supported:

  1. make lambda-builders to support uv, this command is used to build the lambda code. There is an request_json will be generated then parsed by the lambda-builers, related github repo: https://github.com/aws/aws-lambda-builders
  2. (Optional) Make the build image of sam to support uv, since there is no UV installed by default build image.

jinxiao avatar May 11 '25 09:05 jinxiao