Python Coding Workflow

So far, I have never been using Python too much. However, I always want to understand it in and out for every day uses such as quick prototyping and complex scripting. Python is used a lot in some domain such as machine learning. Python has many libraries in different domains as well. When I took cryptography course I also use Python with it excellent pycryptodome library.

This post is a reference that I will use the typical workflow when you want to code in python.

Version

Which python version to use? My quick answer is focus on Python 3 and forget Python 2.

Editor/IDE

I am using vim so far. But I have never optimised the editor usage by installing plugins that can improve productivity. As a comparison, I am very comfortable writing Golang using vim-go and writing Java or Kotlin using Intellij Idea. However, I am still not finding ideal setup for Python.

Package Manager

By default python will install library to its system folder. Therefore it will be difficult if we need to use different libraries with conflicting dependencies. The easy solution is pipenv.

In MacOS, we can install it easy using brew.

brew install pipenv

Once pipenv installed, we just need to navigate to working directory that we want to use. For example, we want to install pandas.

pipenv install pandas

pipenv will install pandas library locally. Next we just need to invoke shell command so that python script or python shell will run in the pipenv context.

pipenv shell