Migrate a Python application into a Docker container

To avoid repetition, for overview and language agnostic examples on application migration to containers see Migrate your application into a Docker container Update your application Exclude downloadable libraries Add a Python-specific .gitignore file to the root of the Git repository. Read configuration values from environment variables Python natively supports the reading of environment variables. The …

Integrate Anaconda into Pyenv

If you use Pyenv to install multiple Python versions side-by-side and installed Anaconda to create virtual environments for each of your projects, install pyenv-virtualenv to integrate them. Anaconda without the pyenv-virtualenv integration overwrites the PATH, and places itself to the front before pyenv would be able to handle the Python command calls. pyenv-virtualenv seamlessly combines …

Install multiple Python versions with Pyenv

Pyenv is a Python version manager. It is recommended, because it does not depend on Python, (written in Bash) and using it we can install and utilize multiple Python versions without affecting the Python version used by MacOS. The Pyenv source code is at https://github.com/pyenv/pyenv Install Pyenv We will use Homebrew to install Pyenv Install …

Use virtual environments with Anaconda

Anaconda (conda) can create a python bubble for you with no preinstalled packages. You can create a Python virtual environment for each of your projects to isolate them and only install the required packages. When we distribute our code, we should specify the list of referenced Python packages including their versions in the requirements.txt file. …

ModuleNotFoundError: No module named ‘googleapiclient’

When we start to use a Python module, we need to install it on our workstation, and on the server, or in the Docker container where the application will run. ModuleNotFoundError: No module named ‘googleapiclient’ Usually, we install the module with the pip install MODULE_NAME command, but when we try it for the googleapiclient we …

Install Python 3 on MacOS

The MacOS comes with an old version of Python 2. For new software development Python 3 is the recommended version. Replacing the original Python 2 with Python 3 can cause instability in the MacOS. There are multiple ways to install Python 3 and keep Python 2 pn the Mac. This is the most recommended process: …

Read and Update Google Sheet data with Python

In this example we will use python to read data from Google Sheets and update another one using the Google API. Enable the Google API Navigate to https://console.developers.google.com/ Log in with your Google account Click the Create Project link Enter a project name, you can have 12 free project. Click the API panel Click the …

Blue-green deployment in AWS ECS Fargate with CodeDeploy

We will use CodeDeploy to automate the application deployment in our AWS ECS Fargate cluster. Create an AIM role for CodeDeploy to assume the ECS service role In the AWS console navigate IAM and click the Roles link Click the Create role button Click the CodeDeploy link Select CodeDeploy ECS Keep the default setting Enter …