Using Makefiles in Python projects

Thomas Jollans tjol at tjol.eu
Sat Nov 9 10:08:31 EST 2019


On 07/11/2019 20:20, Vitaly Potyarkin wrote:
> What do you think of using Makefiles for automating common chores in
> Python projects? Like linting, type checking and testing?
>
> I've come up with a reusable Makefile for automating virtual environment
> management in Python projects. I think it can be useful for simplifying
> the onboarding of new developers (both new to project and new to Python)
> and for documenting project's development practices.
>
> Here it is:
> - Repo: https://github.com/sio/Makefile.venv
> - Demo screencast: https://asciinema.org/a/279646
>
> What do you think? Is this useful or I'm just unaware of some tool that
> abstracts venv chores away better?
>
As others have said, make is a useful tool and many people use it for 
different purposes in their Python projects. Nothing wrong with that.

HOWEVER, at risk of stating the obvious, using Makefiles written for/on 
*nix systems on Windows is a bit of a hassle. If, for some reason, your 
software is *nix-only anyway, that's fine. If not, using make means 
sacrificing some portability.

If your software runs on Windows, of you think it might run on Windows 
in the future, maybe consider writing simple Python scripts for 
platform-independent tasks rather than makefiles and shell scripts.


-- Thomas




More information about the Python-list mailing list