Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for uv to package python lambda function #654

Open
mazzma12 opened this issue Jan 8, 2025 · 0 comments
Open

Add support for uv to package python lambda function #654

mazzma12 opened this issue Jan 8, 2025 · 0 comments

Comments

@mazzma12
Copy link

mazzma12 commented Jan 8, 2025

Is your request related to a new offering from AWS?

No 🛑 , this is related to using an alternative Python package installer (UV) that would improve the efficiency and reliability of Lambda deployments.

Is your request related to a problem? Please describe.

The current process of installing Python dependencies for AWS Lambda functions using pip can be slow and sometimes unreliable. Common issues include:

  • Pip is notoriously not handling safely packages resolution through multiple indices, exposing the user to potential "dependency confusion" attack (see https://docs.astral.sh/uv/pip/compatibility/#packages-that-exist-on-multiple-indexes )
  • Slow installation times during deployments, especially with large dependency trees
  • Inconsistent package resolution across different environments
  • High memory usage during package installation
  • Longer cold starts due to suboptimal dependency handling

Describe the solution you'd like.

Add support for using UV (https://github.com/astral-sh/uv) as an alternative Python package installer in the Lambda module. UV is a new, extremely fast package installer written in Rust that offers:

  • Up to 10-30x faster package installation compared to pip
  • Reliable dependency resolution
  • Lower memory usage
  • Deterministic builds
  • Full pip compatibility

The module could support UV through:

  1. A new option in the module configuration to specify UV as the package installer - similar to poetry
  2. Integration with UV's lockfile support for reproducible builds
  3. Documentation on how to use UV with the module

Describe alternatives you've considered.

  1. Using custom Docker builds to pre-install dependencies with UV
  2. Creating a separate Lambda layer with UV-installed dependencies

However, native module support would provide a much better developer experience and ensure consistent behavior across teams.

Additional context

UV has gained significant adoption in the Python community due to its performance benefits. Companies like Datadog have reported significant improvements in their Python dependency management after switching to UV. Supporting UV in the Terraform AWS Lambda module would align with the community's move toward more efficient Python tooling and improve the developer experience for teams building Lambda functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant