Skip to main content

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.

Project description

Smyth

Smyth Logo

docs pypi licence pypi downloads pyversion

Smyth is a tool designed to enhance your AWS Lambda development experience by mocking an AWS Lambda environment on your local machine. 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}"

[!TIP] Check the documentation for more configuration options.

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.

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.7.0.post1.tar.gz (45.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smyth-0.7.0.post1-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file smyth-0.7.0.post1.tar.gz.

File metadata

  • Download URL: smyth-0.7.0.post1.tar.gz
  • Upload date:
  • Size: 45.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for smyth-0.7.0.post1.tar.gz
Algorithm Hash digest
SHA256 aa2d2358b0d57237a1b553f5afa62a981195f458face3ac6d9e5c976eff557bf
MD5 fe3f5b1913d6da20937caad6962e64b5
BLAKE2b-256 03be44c94edfe781cd5c820bee15d84a8d6a29eba1ec7a080ee40cb6c8684f30

See more details on using hashes here.

Provenance

The following attestation bundles were made for smyth-0.7.0.post1.tar.gz:

Publisher: publish.yml on mirumee/smyth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smyth-0.7.0.post1-py3-none-any.whl.

File metadata

  • Download URL: smyth-0.7.0.post1-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for smyth-0.7.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 5d60c9639a13a1218c02e6dc4d91ea270153536be460cabd268e736b08775b55
MD5 03a639cf7cb12fb563c3f012d17a487b
BLAKE2b-256 8a9ef04d1814a318047029037f767d4ab9f65f59afddd329ef23b03e9d94bb0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for smyth-0.7.0.post1-py3-none-any.whl:

Publisher: publish.yml on mirumee/smyth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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