workflow¶
End-to-end Lambda layer workflow — Build → Package → Upload → Publish.
This module provides a single LayerDeploymentWorkflow class that orchestrates
the complete 4-step pipeline for creating and deploying an AWS Lambda layer:
Build — install dependencies via a builder (duck-typed, e.g. uv, pip, poetry)
Package — create
layer.zipfrom the build artifactsUpload — upload
layer.zipto S3 stagingPublish — create a versioned Lambda layer in AWS
Usage:
deployment = LayerDeploymentWorkflow(
builder=my_builder, # duck type: needs .run() and .path_layout
path_manifest=Path("uv.lock"),
s3dir_lambda=S3Path("s3://bucket/lambda/"),
layer_name="my_layer",
s3_client=bsm,
lambda_client=lambda_client,
)
layer_deployment = deployment.run()
- class aws_lbd_art_builder_core.layer.workflow.T_BUILDER(*args, **kwargs)[source]¶
Protocol for Lambda layer builders.
Any builder that has a
run()method and apath_layoutattribute satisfies this protocol.
- class aws_lbd_art_builder_core.layer.workflow.LayerDeploymentWorkflow(verbose: bool = True, printer: ~typing.Callable[[str], None] = <built-in function print>, builder: ~aws_lbd_art_builder_core.layer.workflow.T_BUILDER = REQ, path_manifest: ~pathlib.Path = REQ, s3dir_lambda: S3Path = REQ, layer_name: str = REQ, s3_client: S3Client = REQ, lambda_client: LambdaClient = REQ, ignore_package_list: list[str] | None = None, publish_layer_version_kwargs: dict[str, ~typing.Any] | None = None)[source]¶
One-stop orchestrator for the complete Lambda layer lifecycle.
This class combines the 4 steps — Build, Package, Upload, Publish — into a single
run()call. Each step can also be called individually.- Parameters:
builder – A builder object that satisfies
T_BUILDERprotocol (i.e. has a.run()method and a.path_layoutattribute). Downstream packages (uv, pip, poetry) each provide their own builder.path_manifest – Path to the dependency manifest file used for change detection (e.g.
uv.lock,poetry.lock,requirements.txt).s3dir_lambda – S3 directory where Lambda artifacts are stored (e.g.
S3Path("s3://my-bucket/projects/my_app/lambda/")).layer_name – Name of the Lambda layer to create / update (e.g.
"my_app").s3_client – Boto3 S3 client (or
BotoSesManager) for S3 operations.lambda_client – Boto3 Lambda client for publishing the layer version.
ignore_package_list – Packages to exclude from
layer.zip. Defaults todefault_ignore_package_list(boto3, botocore, setuptools, pip, pytest, etc.).publish_layer_version_kwargs – Extra keyword arguments passed to
lambda_client.publish_layer_version()(e.g.{"CompatibleRuntimes": ["python3.12"], "Description": "..."}).verbose – If True, log progress messages. Inherited from
BaseLogger.printer – Callable for emitting log messages. Inherited from
BaseLogger.
Example:
import aws_lbd_art_builder_uv.api as aws_lbd_art_builder_uv from boto_session_manager import BotoSesManager from s3pathlib import S3Path from aws_lbd_art_builder_core.layer.workflow import LayerDeploymentWorkflow bsm = BotoSesManager(region_name="us-east-1") # 1. Create a builder (downstream package provides this) builder = aws_lbd_art_builder_uv.layer_api.UvLambdaLayerLocalBuilder( path_pyproject_toml=Path("pyproject.toml"), skip_prompt=True, ) # 2. Run the full pipeline in one call workflow = LayerDeploymentWorkflow( builder=builder, path_manifest=Path("uv.lock"), s3dir_lambda=S3Path("s3://my-bucket/projects/my_app/lambda/"), layer_name="my_app", s3_client=bsm, lambda_client=bsm.lambda_client, publish_layer_version_kwargs={ "CompatibleRuntimes": ["python3.12"], "Description": "my_app dependencies layer", }, ) result = workflow.run() print(result.layer_version_arn)
- run() LayerDeployment[source]¶
Execute the full Build → Package → Upload → Publish pipeline.
- Returns:
LayerDeploymentrecord with layer version details
- step_4_publish() LayerDeployment[source]¶
Step 4 — Publish: create a new Lambda layer version from the uploaded zip.
- Returns:
LayerDeploymentrecord with layer version details