Sitemap
Press enter or click to view image in full size
Photo by Kelly Sikkema on Unsplash

What Does A Makefile Do In My Python Projects?

About what a Makefile is and how it can help development and team collaboration in Python projects

--

Not a Medium member? Use the Friend Link to read this article!

Whenever we work on a Python project we tend to run the same commands multiple times, from docker run to pytest and formatting. A Makefile, while initially developed to speed up development for building and compiling programs, can help the development and collaboration in Python projects by:

  • adding consistency in how a project is run, formatted, tested;
  • automating certain tasks.

More about the Makefile on Wikipedia or GNU make official documentation. The examples in this article will be executed with the GNU make (which is the standard for Linux/macOS, but it can be installed on Windows too!)

Makefile

The simplest way is to create in the root directory of your Python project a file called Makefile which will contain a set of rules. A rule is defined by:

  • target (or rule name);
  • dependencies (enumeration of other rules);
  • command(s) the rule should execute.

--

--

Responses (8)