builder¶
Base command classes for Lambda layer building — Step 1 of the layer workflow.
Why Command Pattern?
Layer builds have many configuration knobs (paths, credentials, Python version, architecture, Docker options, …). A plain function would accumulate these as positional/keyword arguments; every subclass or wrapper that adds a knob must change the function signature, which ripples through all callers.
With the Command Pattern each knob is a dataclass field on the instance.
Subclasses add fields freely without touching run()’s signature (always
zero-arg). Callers construct → optionally override steps → call run().
This module provides two abstract bases:
BaseLambdaLayerLocalBuilder— builds directly on the hostBaseLambdaLayerContainerBuilder— builds inside a Docker container
Both follow a standardized 4-step workflow. Downstream packages (e.g.
aws_lbd_art_builder_uv) subclass and implement the tool-specific steps.
- class aws_lbd_art_builder_core.layer.builder.BaseLambdaLayerContainerBuilder(verbose: bool = True, printer: ~typing.Callable[[str], None] = <built-in function print>, path_pyproject_toml: ~pathlib.Path = REQ, py_ver_major: int = REQ, py_ver_minor: int = REQ, is_arm: bool = REQ)[source]¶
Base command class for containerized Lambda layer builds.
Uses official AWS SAM Docker images to ensure the built layer matches the Lambda runtime environment exactly. This is important for packages with C extensions that must be compiled for the target architecture.
Usage: Subclass and provide a tool-specific build script via
path_script. Callrun()to execute containerized build, or customize individual steps as needed.- property path_layout: LayerPathLayout¶
LayerPathLayoutobject for managing build paths.
- property image_tag: str¶
Docker image tag based on target architecture.
- Returns:
Architecture-specific tag for AWS SAM build images
- property image_uri: str¶
Full Docker image URI for AWS SAM build container.
- Returns:
Complete Docker image URI from AWS public ECR
- property platform: str¶
Docker platform specification for target architecture.
- Returns:
Platform string for docker run –platform argument