Skip to main content

No project description provided

Project description

Smyth

Smyth is a versatile tool designed to enhance your AWS Lambda development experience. It is a pure Python tool that allows for easy customization and state persistence, making your Lambda development more efficient and developer-friendly.

Features

  • Pure Python: Entirely written in Python, allowing flexibility to tailor it to your specific requirements.
  • Customizability: Modify both the event and context data structures as needed.
  • State Persistence: Simulates both cold and warm starts, retaining state across invocations, mimicking actual AWS Lambda behavior.
  • Efficiency: Streamlined and efficient, relying solely on Python for code execution.
  • Inspired by Serverless Framework: Designed with insights from the Serverless framework, effectively managing serverless applications.
  • Developer-Friendly: Integrates seamlessly with common development tools and practices, such as PDB, iPDB, VSCode debugging, and .env file support.

Installation

Install Smyth as a development dependency using Poetry or pip:

Poetry

poetry add --group dev smyth

pip

pip install smyth

Define the following settings in your Lambda project's pyproject.toml file:

[tool.smyth]
host = "0.0.0.0"
port = 8080

[tool.smyth.handlers.saleor_handler]
handler_path = "my_project.handlers.saleor.handler.saleor_http_handler"
url_path = "/saleor/{path:path}"

Run Smyth with:

python -m smyth

Working with Docker

Assuming you have this already installed by Poetry you can use the Dockerfile.example and docker-compose.example.yml files from this repository to get started.

Working with VS Code

To utilize the VS Code debugger with the Smyth tool, you can set up your launch.json configuration file as follows. This setup will enable you to debug your Lambda functions directly within VS Code, providing a seamless development experience.

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python Debugger: Module",
            "type": "debugpy",
            "request": "launch",
            "module": "smyth",
            "args": ["run"],
        }
    ]
}

Caveats

The combination of Uvicorn reload process and HTTP server process with what is being done with the Lambda processes is tricky. If a Lambda process is doing something and the HTTP server is killed in the wrong moment it's likely going to bork your terminal. This is not solved yet. It's best to use in a Docker container or have the ability to kill -9 {PID of the Uvicorn reload process} at hand.

TODO

  • Write tests
  • Properly handle Uvicorn exit, kill the LambdaProcesses gracefully
  • Publish on PyPi

Name

This name blends "Smith" (as in a blacksmith, someone who works in a forge) with "Py" for Python, altering the spelling to "Smyth". Blacksmiths are craftsmen who work with metal in a forge, shaping it into desired forms. Similarly, "Smyth" suggests a tool that helps developers craft and shape their serverless projects with the precision and skill of a smith, but in the realm of Python programming. This name retains the essence of craftsmanship and transformation inherent in a forge while being associated with Python.

Crafted with ❤️ by Mirumee Software hello@mirumee.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smyth-0.5.0.tar.gz (43.5 kB view details)

Uploaded Source

Built Distribution

smyth-0.5.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file smyth-0.5.0.tar.gz.

File metadata

  • Download URL: smyth-0.5.0.tar.gz
  • Upload date:
  • Size: 43.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for smyth-0.5.0.tar.gz
Algorithm Hash digest
SHA256 0d334b104e131ebdff34081a9b29c8496d6de9a762890e39d08f57fe7f1c854d
MD5 498845ae336e588a9f13bee9e347f73d
BLAKE2b-256 b49994252a3e3f3cccf7fbdfb3adf678e0cb096880562d60a6dd2c73e85c8a13

See more details on using hashes here.

File details

Details for the file smyth-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: smyth-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for smyth-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6fa2e36c4d80ee482d6d463862580202948184e8b89f01b65ed2a80bd35c4571
MD5 5251b4eccca2a7e0a4ec14243108dfe9
BLAKE2b-256 2e35ed5c83e06f87efb8bd06eea7ffb25fc131cfbcc0dc27fac0f60a55557b0d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page