-
Notifications
You must be signed in to change notification settings - Fork 72
Convert dummy example into a concrete example #36
Comments
A few examples on things I find difficult which I think can help others:
|
hey @kbakk thank you so much for that. Now that Powertools has a Router functionality, @michaelbrewer and I have been discussing revamping this with two options: Monolithic and Micro function - both with shared and Lambda Layer (build optimization + dev dependency). The monolithic option would take an hour to add since we already have a good project structure that works in both PyCharm and VSCode. The latter requires an additional CLI (e.g. PyInvoke) to support building separate functions while supporting relative and absolute imports, since SAM CLI discards the top level directory - the latter also needs additional cycles to ensure C bindings are built within a Docker Container. |
You may want to look into Poetry. I'm experimenting with this currently: [tool.poetry]
# ...
packages = [
{ include = "my_app_dir", from = "functions/my_app_dir" },
{ include = "tests" }
] This creates a
My handler is in MyLogicFn:
Type: AWS::Serverless::Function
Properties:
CodeUri: functions/my_app_dir
Handler: my_app_dir.lambda_handler.create_asset |
Definitely - we use Poetry for Lambda Powertools and don’t look back.
…On Tue, 30 Nov 2021 at 18:59, Kristoffer Bakkejord ***@***.***> wrote:
You may want to look into Poetry. I'm experimenting with this currently:
[tool.poetry]# ...packages = [
{ include = "my_app_dir", from = "functions/my_app_dir" },
{ include = "tests" }
]
This creates a .pth in the site-packages folder, I believe this is
similar to modifying PYTHONPATH (for the local dev-environment).
cat $(poetry env info -p)/lib/python3.9/site-packages/my_project.pth
~/Code/my_project
~/Code/my_project/functions/my_app_parent
My handler is in functions/my_app_dir/my_app_dir/lambda_handler. The
double-dir is to be able to say import my_app_dir.sub_module in the
Lambda handler.
MyLogicFn:
Type: AWS::Serverless::Function
Properties:
CodeUri: functions/my_app_dir
Handler: my_app_dir.lambda_handler.create_asset
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#36 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZPQBCWOT7JBLOECLD2YOLUOUGH7ANCNFSM4RZUGLOQ>
.
|
Hi @heitorlessa, do you have any update on this? I'd like to see both approaches you described at your comments...
|
Ideas to pick from when time allows:
The text was updated successfully, but these errors were encountered: