Thu 01 Apr 2021

Writing Makefiles for Python Projects

Makefiles give your contributors an entry point on how to do certain things like, building, testing, deploying. And if done correctly, they can massively simplify your CI/CD pipeline scripts as they can often just stupidly call the respective make targets. Most importantly, they are a very convenient shortcut for you as a developer as well.

For Python projects, where I'm almost always using virtual environments, I've been using two different strategies for Makefiles:

  1. assuming that make is executed inside the virtual environment
  2. wrapping all virtual environment calls inside make

Both strategies have their pros and cons.

Source: Writing Makefiles for Python Projects, an article by Bastian Venthur.