local_builder¶
UV-based local Lambda layer builder.
UvLambdaLayerLocalBuilder runs uv sync directly on the host
machine to install dependencies into a Lambda-compatible layer structure.
See docs/source/99-Maintainer-Guide/03-Build-Lambda-Layer-using-UV-in-Container
for the containerized variant’s architecture guide.
- class aws_lbd_art_builder_uv.layer.local_builder.UvLambdaLayerLocalBuilder(verbose: bool = True, printer: ~typing.Callable[[str], None] = <built-in function print>, path_pyproject_toml: ~pathlib.Path = REQ, credentials: ~aws_lbd_art_builder_core.layer.foundation.Credentials | None = None, skip_prompt: bool = False, path_bin_uv: ~pathlib.Path | None = None)[source]¶
Build a Lambda layer using uv on the local machine.
Runs
uv sync --frozen --no-dev --no-install-project --link-mode=copyon the host, then movessite-packages/intoartifacts/python/.The local builder does not require
py_ver_major/py_ver_minorbecause it always uses the host’s current Python — there is no way to target a different Python version without a container. The container builder requires them to select the correct AWS SAM base image.Note
Local builds produce host-native binaries. For packages with C extensions, use
UvLambdaLayerContainerBuilderinstead.- step_2_1_setup_build_dir()[source]¶
Delete
build/lambda/layer/and recreate the directory structure.
- step_3_execute_build()[source]¶
Credentials are set up here in Step 3 (right before
uv sync) rather than in Step 2, becauseuv_login()sets process-level environment variables. Doing it in Step 2 would pollute the env during directory setup, and if Step 2 failed, the env vars would be left dangling. Keeping credential setup adjacent to the command that needs them minimizes the window of exposure.(In the container builder, credentials are written to a JSON file in Step 2 because the container is a separate process — writing a file is a prepare action, not an execute action.)