Dillon Peterson
03/03/2021, 11:01 PMFrank
Frank
Jay
Dillon Peterson
03/04/2021, 3:50 AMJay
José Ribeiro
04/07/2021, 3:21 PMJay
Dillon Peterson
04/07/2021, 5:24 PMFrank
Frank
Dillon Peterson
04/07/2021, 6:54 PMJosé Ribeiro
04/07/2021, 6:54 PMDillon Peterson
04/07/2021, 6:55 PMFrank
Frank
José Ribeiro
04/07/2021, 9:52 PMpoetry
, but requirements.txt
works good as well as it’s easy to export from poetryJosé Ribeiro
04/07/2021, 9:52 PMserverless-python-requirements
doesFrank
poetry
when looking into packagers. Is that what most folks use?Frank
poetry
pipenv
and pip
, or if there’s something most ppl use, maybe I can start with that.José Ribeiro
04/07/2021, 10:02 PMFrank
serverless-python-requirements
does, it generates the requirements.txt
file from pyproject.toml
or Pipefile
. Install all dependencies locally in a directory, and zips up the directory with the Lambda code all together.José Ribeiro
04/07/2021, 10:05 PMFrank
José Ribeiro
04/07/2021, 10:37 PMFrank
José Ribeiro
04/08/2021, 8:56 PMFrank
sst start
, so when you save a file, the console will complaint any errors in the code. For Node, on file save, sst start
transpiles the code, lints it, and type checks it if it’s a Typescript file. Transpile and type check are likely irrelevant for Python, I’m trying to figure out the linting part.Frank
José Ribeiro
04/11/2021, 3:58 PMpy_compile
works well. I’m used to using flake8, but that’s more on the style enforcement/static code analysis side of things (also, it’s not shipped with the default python install). I feel like adding flake8/pylint would be adding some opinionatedness to serverless-stack without really adding any value. Does that make sense?José Ribeiro
04/11/2021, 4:00 PMJosé Ribeiro
04/13/2021, 2:24 AMFrank
npx create-serverless-stack@latest my-sst-app --language python
Point the srcPath
for sst.Function
to the directory containing the poetry.lock
. And on build/deploy, SST will generate a requirements.txt
and install the modules inside a docker container.Frank
srcPath
and handle
takes for Python functions - https://docs.serverless-stack.com/constructs/Function#functionpropsFrank
Frank
José Ribeiro
04/13/2021, 7:38 PMFrank
José Ribeiro
04/22/2021, 2:49 PMFrank
sst.Bucket
and sst.Queue
constructs?Frank
sst.Function
(triggers created by sst.Api
, sst.Bucket
, sst.Queue
, etc are all using sst.Function
) they will be invoked locally when running sst start
Frank
José Ribeiro
04/22/2021, 8:02 PMaddEventSource
instead?
new Function(this, "Processor", {
handler: "handler.process",
srcPath: "src",
});
new Queue(this, "ProcessorQueue", {
handler: "handler.process",
srcPath: "src",
consumerProps: {
batchSize: 1,
},
});
José Ribeiro
04/22/2021, 8:03 PMFrank
Queue
definition to this:
new Queue(this, "ProcessorQueue", {
consumer: {
function: {
handler: "handler.process",
srcPath: "src",
},
consumerProps: {
batchSize: 1,
},
},
});
Frank
José Ribeiro
04/27/2021, 2:05 AM