bland-cpu-3662
04/29/2025, 1:26 PMgorgeous-winter-99296
04/29/2025, 2:30 PMdist/ is output-only, but I'd investigate using https://www.pantsbuild.org/stable/reference/targets/archive to bundle up multiple things.bland-cpu-3662
04/29/2025, 4:13 PMpython_aws_lambda_function. Was hoping for some clever way to reference the built artifacts.gorgeous-winter-99296
04/29/2025, 4:14 PMpackages field of the archive target? I'd expect that to package those lambda functions, then embed those into the archive.bland-cpu-3662
04/29/2025, 4:37 PMbland-cpu-3662
04/29/2025, 4:38 PMtarget() there it seems, yields zip error: zip error: Missing or empty zip file, would be ideal given I have multiple lambda functions as targets.
Perhaps there's a better way? Sorry for the newbie questionsgorgeous-winter-99296
04/29/2025, 4:41 PMtarget supports packaging... Are you doing something like this?
python_aws_lambda_function(
name="a",
)
python_aws_lambda_function(
name="b",
)
python_aws_lambda_function(
name="c",
)
target(
name="all",
dependencies=[":a", ":b", ":c"]
)
archive(
name="bundle",
packages=[":all"]
)bland-cpu-3662
04/29/2025, 4:41 PMgorgeous-winter-99296
04/29/2025, 4:42 PMpython_aws_lambda_function(...) # etc
all_lambdas = [":a", ":b", ":c"]
archive(
name="bundle",
packages=all_lambdas,
)bland-cpu-3662
04/29/2025, 4:43 PMbland-cpu-3662
04/29/2025, 4:49 PMgorgeous-winter-99296
04/29/2025, 4:52 PM# macros.py
def all_lambdas():
return ["//src/python/lambda1:package", "//src/python/lambda2:package"]
# whatever/BUILD
archive(
name="bundle",
packages=all_lambdas()
)
A macro file works a bit like "builtins" in Python, so it runs before the build file itself and imports all symbols. So you'd have the same all_lambdas function everywhere. I'm not aware if variables are visible from macro files, but maybe that does.bland-cpu-3662
04/29/2025, 4:56 PM