While deploying a python code as lambda function, the runtime automatically assigned to the function is "python 3.6"
The issue with this is - all of my layer code directory structure is built in this manner
< python/lib/python3.7/site-packages/{layer code} >
With runtime = python 3.6, lambda functions errors out with
"Import error: Unable to import module _"
Is there a way, I can specify lambda runtime in config.json file ? or if that's not possible then a workaround to attach a specific runtime version at the time of deployment ?
Awaiting inputs. Thanks!
The runtime is based on the version of python you're using to run the "chalice" command. Is there a particular reason you're using python3.6? The easiest fix would be to install the Chalice CLI into a python 3.7 environment.
multiple people contributing to the application use python 3.6 which makes the deploys unpredictable. One of the deploys led to configuration for python runtime being set as 3.6.
What I'm looking for is -- whether this is going to be on chalice feature roadmap in future ?
Now that you've clarified the reason for 3.6 runtime, a valid workaround for us is to force people to use python 3.7 only.
The main complication in supporting switching to a different python version is that we actually import your application in order to see what routes/events you have configured. While we can add a config option to support a different runtime, it's still possible that your deploy will fail because we'd be using python3.6 to import your chalice app which is meant to run on python3.7. If you use something that's 3.7 only, importing your app on 3.6 will fail so the deploy will fail.
I'll go ahead and leave this issue open and label it is as feature-request. If others would like this feature please feel free to upvote the feature. If there's no interest after a while I'll go ahead and close it out. Thanks for the feedback!
Most helpful comment
The main complication in supporting switching to a different python version is that we actually import your application in order to see what routes/events you have configured. While we can add a config option to support a different runtime, it's still possible that your deploy will fail because we'd be using python3.6 to import your chalice app which is meant to run on python3.7. If you use something that's 3.7 only, importing your app on 3.6 will fail so the deploy will fail.
I'll go ahead and leave this issue open and label it is as feature-request. If others would like this feature please feel free to upvote the feature. If there's no interest after a while I'll go ahead and close it out. Thanks for the feedback!