upload¶
Upload functions for Lambda source deployment artifacts.
Provides three functions that form the upload/publish half of the source deployment lifecycle:
upload_source_zip()— upload a pre-built source zip to S3build_and_upload_source_using_pip()— all-in-one: build dir (pip) → zip → uploadbuild_and_upload_source_using_uv()— all-in-one: build dir (uv) → zip → upload
These functions depend on builder (build step) and
foundation (path/S3 layout conventions) but are kept in a separate
module so that callers can import only the upload logic without pulling in the
build tooling.
- aws_lbd_art_builder_core.source.upload.upload_source_zip(s3_client: S3Client, source_version: str, source_sha256: str, path_source_zip: ~pathlib.Path, s3dir_source: S3Path, metadata: dict[str, str] | None = OPT, tags: dict[str, str] | None = OPT, verbose: bool = True, printer: ~typing.Callable[[str], None] = <built-in function print>) S3Path[source]¶
Upload a pre-built Lambda source zip to S3 with versioning and metadata.
- Parameters:
s3_client – Boto3 S3 client for upload operations
source_version – Semantic version for the source code, e.g.,
"0.1.1"source_sha256 – SHA256 hash of the source build directory for integrity verification
path_source_zip – Local path to the source zip file to upload
s3dir_source – S3 directory scoped to source artifacts, i.e.
dir_root, e.g.s3://bucket/path/to/lambda/source/metadata – Optional custom S3 object metadata to attach
tags – Optional S3 object tags to attach
verbose – If True, display upload progress and URLs; if False, run quietly
printer – Function to handle output messages, defaults to built-in print
- Returns:
S3Path object pointing to the uploaded source.zip file
- class aws_lbd_art_builder_core.source.upload.BuildAndUploadSourceResult(source_sha256: str, s3path_source_zip: S3Path)[source]¶
Result of building and uploading Lambda source artifacts.
- aws_lbd_art_builder_core.source.upload.build_and_upload_source_using_pip(s3_client: S3Client, dir_project_root: ~pathlib.Path, s3dir_source: S3Path, skip_prompt: bool = False, verbose: bool = True, printer: ~typing.Callable[[str], None] = <built-in function print>) BuildAndUploadSourceResult[source]¶
Build, zip, and upload Lambda source artifacts to S3 using pip.
All-in-one convenience function. Uses the project’s venv pip (
{dir_project_root}/.venv/bin/pip) and reads the version frompyproject.tomlautomatically.- Parameters:
s3_client – Boto3 S3 client for upload operations
dir_project_root – Root directory of the Python project (contains pyproject.toml)
s3dir_source – S3 directory scoped to source artifacts, i.e.
dir_root, e.g.s3://bucket/path/to/lambda/source/skip_prompt – If True, clean the build directory without user confirmation
verbose – If True, display detailed progress information
printer – Function to handle output messages, defaults to built-in print
- Returns:
- aws_lbd_art_builder_core.source.upload.build_and_upload_source_using_uv(s3_client: S3Client, path_bin_uv: ~pathlib.Path, dir_project_root: ~pathlib.Path, s3dir_source: S3Path, skip_prompt: bool = False, verbose: bool = True, printer: ~typing.Callable[[str], None] = <built-in function print>) BuildAndUploadSourceResult[source]¶
Build, zip, and upload Lambda source artifacts to S3 using uv.
All-in-one convenience function. Reads the version from
pyproject.tomlautomatically.- Parameters:
s3_client – Boto3 S3 client for upload operations
path_bin_uv – uv executable, e.g.
Path(shutil.which("uv"))dir_project_root – Root directory of the Python project (contains pyproject.toml)
s3dir_source – S3 directory scoped to source artifacts, i.e.
dir_root, e.g.s3://bucket/path/to/lambda/source/skip_prompt – If True, clean the build directory without user confirmation
verbose – If True, display detailed progress information
printer – Function to handle output messages, defaults to built-in print
- Returns: