Skip to content

Feat Request: Add support for uv based Python builds #673

Open
@jussapaavo

Description

@jussapaavo

Describe the solution you'd like.

The module now supports adding Python dependencies and requirements through pip and poetry. Is it possible to support uv as well? Note that uv also has good support for building AWS Lambda specific packages.

Describe alternatives you've considered.

As a workaround, I'm using these commands in source_path for building with uv:

  source_path = [
    {
      path = "${path.module}/../../${var.source_dir_path}/src/"
      commands = [
        ":zip . app",
      ]
      patterns = [
        "!.*/__pycache__.*",
        "!.*/.*terragrunt.*",
      ]
    },
    {
      path = "${path.module}/../../../${var.source_dir_path}"
      commands = [
        "uv export --frozen --no-dev --no-editable -o requirements.txt",
        join(" ", [
          "uv pip install",
          "--no-installer-metadata",
          "--no-compile-bytecode",
          "--python-platform x86_64-manylinux2014",
          "--python ${replace(var.runtime, "python", "")}",
          "--target packages",
          "-r requirements.txt"
        ]),
        "cd packages",
        ":zip"
      ]
    }
  ]

This works as intended and is a viable solution. However, it would be nice to have this as an officially supported feature, something like how poetry is supported.

Additional context

I created this feature request also for knowledge-sharing purposes, so other people can benefit from this implementation as a reference.

Thank you for already making this module so flexible that builds like this is possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions