Coverage for gco / stacks / lambda_assets.py: 100.00%
5 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-10-28 16:19 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-10-28 16:19 +0000
1"""Lambda code assets packaged from the ``lambda/`` source directories.
3A ``lambda/<name>`` source directory is zipped as it sits in the checkout, so
4the caches a local test or type-check run leaves in it would ship with the
5function and change its asset hash (see ``LAMBDA_SOURCE_ASSET_EXCLUDE``). The
6service images and the TLS certificate manager image keep the same caches out
7through their ``.dockerignore`` files. The CLI-built ``*-build`` directories
8are packaged with ``lambda_.Code.from_asset`` directly: the bytecode
9``pip install`` compiles there is part of the build, and the CLI already copies
10no source caches into it.
11"""
13from __future__ import annotations
15from aws_cdk import aws_lambda as lambda_
17from gco.stacks.constants import LAMBDA_SOURCE_ASSET_EXCLUDE
20def lambda_source_code(directory: str) -> lambda_.AssetCode:
21 """Package the source directory ``directory`` (``lambda/<name>``) without local caches."""
22 return lambda_.Code.from_asset(directory, exclude=list(LAMBDA_SOURCE_ASSET_EXCLUDE))