mammoth-dawn-85816
09/25/2025, 12:10 PM./migrations/ directory in a pants-built python_aws_lambda_function() — so that I can have that lambda execute my migrations. Details in 🧵 — I’d appreciate your help!mammoth-dawn-85816
09/25/2025, 12:11 PMlamda_function.py & BUILD files, plus a migrations/ directory, which is exactly as Alembic sets it out.
I’ve tried both of these two variants of my `BUILD`:
python_sources(
name="lambda",
dependencies=[":migrations"], # <- variant 1: put the dependency on :migrations here, and not below
)
python_aws_lambda_function(
handler="lambda_function.py:handler",
dependencies=[":migrations"], # <- variant 2: put the dependency on :migrations here, and not above
)
poetry_requirements(
name="poetry",
)
files(
name="migrations",
description="Alembic migration files",
sources=["migrations/*.py", "migrations/**/*.py"],
)
But in both cases pants package :: builds a zip file without the directory migrations or any of its contents.
I’m a bit lost, as I thought this is what the files target is intended for, but I have a hunch that may only pull the files into the build, and not necessarily into the lambda! (I’ll keep researching)
How can I get the contents of the migrations directory along side wherever my lambda_function.py ends up? (mirroring how things are set up in my repo)mammoth-dawn-85816
09/25/2025, 12:45 PMpython_sources(
name="lambda",
)
python_aws_lambda_function(
handler="lambda_function.py:handler",
dependencies=[
"./migrations:migrations",
"./migrations/versions:versions",
]
)
poetry_requirements(
name="poetry",
)
And making sure I have BUILD files containing python_sources() in both my ./migrations/ and ./migrations/versions directories (exactly as auto created by pants tailor ::)mammoth-dawn-85816
09/25/2025, 12:46 PMhappy-kitchen-89482
09/26/2025, 7:49 PMmammoth-dawn-85816
10/08/2025, 6:56 AMwhatever.docker-info.json should also be including architecture information?
Mine has the form (I’m using the git sha as a tag)
{
"version": 1,
"image_id": "sha256:…",
"registries": [
{
"alias": null,
"address": "<account_id>.dkr.ecr.eu-west-2.amazonaws.com",
"repository": "<repo_name>",
"tags": [
{
"template": "01b835632a5216176bd4c2f09b4ef69e9aea9628",
"tag": "01b835632a5216176bd4c2f09b4ef69e9aea9628",
"uses_local_alias": false,
"name": "<account_id>.dkr.ecr.eu-west-2.amazonaws.com/<repo_name>:01b835632a5216176bd4c2f09b4ef69e9aea9628"
}
]
}
]
}
which doesn’t state the architecture anywhere.
Even when specifying the platform directly:
docker_image(
name="api",
dependencies = [":api_lambda"],
# Only add a registry if the ECR_DOMAIN is not empty; this is a bit of a dance btw
registries=[r for r in [env("ECR_DOMAIN", default="")] if r],
repository="whatever",
# Similarly here, it would be great to have access to the GIT SHA without having to pre-load an env var
image_tags=[l for l in [env("GIT_SHA", default="")] if l],
instructions=[
"FROM public.ecr.aws/lambda/python:3.13-arm64",
"COPY src.lambdas.api ${LAMBDA_TASK_ROOT}",
"CMD [\"lambda_function.handler\"]",
],
build_platform=["arm64"],
)
I’d love to be able to pull the architecture info from the docker-info.json, just like with the stuff above! Were you expecting this to work with the work you already completed?happy-kitchen-89482
10/09/2025, 3:35 AMmammoth-dawn-85816
10/09/2025, 11:42 AMhappy-kitchen-89482
10/10/2025, 2:58 AM