Hi everyone, just another question. I am trying to...
# general
r
Hi everyone, just another question. I am trying to deploy an aws lambda with serverless and pants package but the lambda has some image files (.png and .jpg). I've tried adding them with the
resources
and
files
targets but when looking into the generated zip file the images aren't there. Am i doing something wrong?
Copy code
python_sources()

resources(name='resources', sources=['back_cover.jpg'])

python_awslambda(
    name="x-areas",
    output_path='api/x-areas.zip',
    handler="handler.py:*",
    complete_platforms=["api/lambda_config:aws_lambda_python_3_10"],
    dependencies=['!!//:pipenv#numpy', '!!//:pipenv#pandas'],
)
1
h
Add an explicit dependency from your
python_sources()
on to the resources target
dependencies=[":resources"]
Pants can't infer that dep, as there no
import
statement to infer it from
I'm assuming that the
python_sources()
owns whatever code loads the jpeg at runtime?
r
Okay that makes sense
And yeah, the python_sources() owns the python code which loads the image
Thanks for the help!
h
Did it work?
r
Yes it did
h
great