for python based lambda functions is there a way t...
# help
r
for python based lambda functions is there a way to specify a
requirements.txt
file?
t
it should be picked up automatically if you have one
r
oh really???
That's awesome
and should it go in the same directory where the lambda is defined?
t
It should go where the functions
srcPath
is specified - if you're not setting this then it should go in the root of your proj
r
ok cool!
thanks!
and does it install when doing
npx sst start
?
t
no I think that you'll need to manage yourself but I believe it does do it when deploying for prod
I've never really used python so I'm a bit unfamiliar here
r
is there anyone familiar with running python lambdas? I'm a little confused with how the packages would get built
t
I'd suggest trying out a deploy - everything should just work
r
kk
t
we zip up the whole srcPath folder and ship it to lambda - unfortunately python isn't great at being bundled efficiently
would strongly suggest using ts if this is a new project
serverless world at least at the moment is more built for it
r
yeah we're going to typescript for this part of the backend.
but have python currently.
k
https://github.com/kritstabs/sst-python-example This is how I currently structure Python applications. This example also includes a lambda layer where I put common code among lambda functions. Root requirements.txt includes all requirements.txt files from all lambdas for local development.
r
Oh thanks for sharing this!
g
@kritstabs https://github.com/kritstabs/sst-python-example is 404 now. 🤷. Did you delete it?
k
@Gordon DuQuesnay It’s outdated and many things could be done better. Made repository public again. I personally switched to typescript - much faster bundling and does not require docker in the background.