aws-sam-cli
aws-sam-cli copied to clipboard
Feature request: Add uv support for building
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
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.
Yes, exactly. In the interim, uv does have a pip-compatible interface at uv pip ... which could be stepping stone
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
There is a pretty extensive documentation on using uv with AWS Lambda: https://docs.astral.sh/uv/guides/integration/aws-lambda/
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.
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:
- 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
- (Optional) Make the build image of sam to support uv, since there is no UV installed by default build image.