aws / chalice

Python Serverless Microframework for AWS
Apache License 2.0
10.6k stars 1.01k forks source link

Suggestion: key for rebuilding package on "deploy" #1611

Open vfilimonov opened 3 years ago

vfilimonov commented 3 years ago

Often on the deploy chalice uses existing package:

Creating deployment package.
Reusing existing deployment package.
Updating lambda function: ....

What are the conditions on which the package is reused? I presume that it checks if the requirements.txt is changed?

It is possible to have local package in the requirements.txt, which is installed internally in editable mode (pip install -e .). In this case when the code of the library is changed, chalice will still reuse existing package on deployment. Same would happen if requirements.txt points to a branch in git repo.

It would be great if there was an option to force-rebuild package on deploy to cope with such cases.

jamesls commented 3 years ago

What are the conditions on which the package is reused?

It'll depend on if you're using automatic layers or not. If you're using the default of a single combined layer, then it's a combined has of the requirements.txt file along with all the app.py, chalicelib/ and vendor/. Otherwise, it's requirements.txt and vendor/ for the base layer and app.py and chalice/ for the app layer.

I agree a force option would be nice, I thought we had an existing feature request for it, but I'm not able to find it.

vfilimonov commented 3 years ago

Thanks, @jamesls

On those files/directories - Do I understand correctly that chalice compares actual hashes of the content and not modification times?

tdwright commented 1 year ago

@jamesls Chiming in here, as I'm getting this message a lot, even when I've made changes to app.py. Did the --force idea come to anything?

BPDanek commented 8 months ago

Thanks, @jamesls

On those files/directories - Do I understand correctly that chalice compares actual hashes of the content and not modification times?

I think yes. By modifying a file I am able to rebuild the package without issue.