When working with python functions and `sst start`...
# help
d
When working with python functions and
sst start
is there any way for the local runner to use the correct virtualenv for each handler? I'm using poetry to install dependencies and have managed to get it working using the
VIRTUAL_ENV
environment variable but it would be nice if the runner could either automatically add the virtual env to the path or run the handler using
poetry run
instead of using the system python version.
d
I’m not super familiar with Python but I had a little dig on this as I was interested in how it works. You can find the code for the python runner here, and can see how the path and command is constructed. https://github.com/serverless-stack/serverless-stack/blob/master/packages/core/src/runtime/runner.ts#L42-L73 This is the python bootsrap (the wrapper for your handler). https://github.com/serverless-stack/serverless-stack/blob/master/packages/core/src/runtime/shells/bootstrap.py You might want to add your comments re. poetry and virtualenv to this issue, which is tracking improvements for better python support. https://github.com/serverless-stack/serverless-stack/issues/667
d
Thanks! I did find that runner code and was able to get dependencies working locally by passing through the
VIRTUAL_ENV
variable but that doesn't feel like a great way of doing it. Thanks for the link to that issue, I'll add a a comment there.