First Steps¶
Smyth is built to have minimal or no impact on the project you are working on. That said, it comes with features that allow you to customize Smyth to the needs of your Lambda project.
Following this guide will help you understand how to set up your development environment with Smyth.
Example Application¶
Throughout this guide, we will use two lambda handlers as an example application.
These handlers do the exact same thing, and the global COUNT
is there to illustrate how Smyth handles state between different requests (more about that in concurrency).
What is the project's structure?
If this is in question, here is the example project's directory structure:
Configuration¶
Now, in our project's pyproject.toml
, we can set up Smyth to instruct how the Lambdas will be executed. This setup reflects how your Lambdas will be deployed on AWS behind, for example, an API Gateway.
myproject/pyproject.toml | |
---|---|
- Define the host and port on which you want Uvicorn to listen.
Under tool.smyth.handlers
, you name and define your handlers. The only two required options are:
handler_path
- the Python path to the Lambda handler.url_path
- the path with which the handler is to be reached by Starlette - uses Starlette's URL resolving.
Custom Smyth Entrypoint
You don't have to use the TOML config - read more about Custom Entrypoint.
Run It¶
At this point, you can start Smyth from your project's root directory:
Visit http://localhost:8080/orders/ to get the Order Handler response.