Using Python & Poetry inside Docker

Poetry is a great build system. And in 2023, I believe, no one should use the pip for a private Python codebase. Getting it right inside Docker is a different issue, however. Consider a simple Flask-based web server as an example Bash 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 # Install poetry $ pip3 install poetry==1.7.1 $ poetry --version Poetry (version 1.7.1) # Create a sample package $ poetry init --python=~3.10 --name=src --description='Flask Hello world' --dependency=Flask@3.0.0 --author='Ashish' --license='Apache 2.0' --no-interaction $ poetry install $ touch README.md $ mkdir src # Create a file src/server.py in your favorite editor $ cat src/server.py from flask import Flask app = Flask(__name__) @app.route("/") def hello_world(): return "<p>Hello, World!</p>" if __name__ == "__main__": app.run() Let’s finish the build process Now, let’s add a simple Dockerfile titled Dockerfile1 ...

How to send HTML mails using Amazon SES (Simple Email Service) in python

As the title suggests, I was looking for a way to send HTML mails in python using Amazon SES but did not find anything (or maybe my search skills are bad). So, once I found the solution, I thought I might share it with everyone. The basic idea is that contents of the mail (raw-message) must be a JSON dictionary with “Data” as main key whose value is a key value pair containing entries with keys like “From”, “To” etc. Sample code can be seen below.