Using Makefiles in Python projects

Chris Angelico rosuav at gmail.com
Sat Nov 9 15:30:01 EST 2019


On Sun, Nov 10, 2019 at 2:10 AM Thomas Jollans <tjol at tjol.eu> wrote:
>
> 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.
>

Are you assuming that every Windows system has Python, but that you
can't get make or bash? Because neither half of that is true. I've
happily used makefiles on Windows, and these days, bash is as easy to
get hold of as Python is.

ChrisA


More information about the Python-list mailing list