So, since my happy little sst app is a skills expo...
# sst
l
So, since my happy little sst app is a skills exposition project, I'm considering writing one of my microservices in Python (The rest is in Typescript). My project uses the monorepo with Lerna, blah, blah template. I've already experimented briefly with
npx create-serverless-stack@latest [project name] --language python
. Some thoughts on this: • The above creates a hybrid of Javascript sst code, Javascript sst tests for
MyStack.js
, and Python for the lambdas. The usual package.json, etc. • Where/how are the Python dependencies needed in my Lambdas managed (since I'm seeing node stuff everywhere else)? • What happens when I run
npx sst test
? I know Jest is a part of serverless stack, so what happens with whatever Python testing framework I'll end up using (for domain object unit tests)? Does the test command detect that and respond accordingly, or do I have to wire that up? Or, do I just run a separate command to run the Python tests? • My guess is that sst knows how to bundle and deploy Python Lambdas by detecting the
.py
extension. • Integration tests can still still be in typescript, since that's what they are for my typescript microservices and don't intrude into the guts of my Lambdas.
f
Hey @Luke Wyman, for Python, you can use plain
requirements.txt
, PipFile or Poetry to manage the dependencies. Just point
srcPath
to where
requirements.txt
or
Pipfile
or
poetry.lock
is.
sst test
in this case doesn’t run the python tests. Having a separate command for Python tests is probably the best way to go about it.
Btw, lemme open an issue and put down some of ur questions. Something we can look at when we get a chance to improve Python doc/support https://github.com/serverless-stack/serverless-stack/issues/667
l
That's awesome, @Frank! Will definitely be following that effort. Which of of
requirements.txt
,
Pipfile
, or
poetry.lock
would you guess is the most popular/progressive, and compatible with my sst effort? Same question for the a unit testing library for Python.
f
They should all work well out of the box. On
sst deploy
, if you have
Pipfile
or
poetry.lock
, they simply get converted to
requirements.txt
, and the steps after that are exactly the same.
As for unit testing, I haven’t worked with Python extensively so I don’t want to give u wrong info 🤪
I’ve used pytest. But whichever framework u end up using, to SST it’s probably just an external command.
l
Thanks 🙂