Makefiles. I always dismissed them as a C compiler thing. Something that could never be useful for Python programming. But nowadays every project I create has a Makefile to bind together all task involved on that project. From bootstrapping the dev environment, running checks/test, starting a devserver, building releases and container images. Makefiles are just such a nice place to put scripts for these common tasks compared to normal shell scripts. The functional approach and dependency resolving of Make allows you to express them with minimal boilerplate and you get tab completion for free.
Sometimes I try to take more native solutions (eg. Tox, docker) but I always end up wrapping those tools in a Makefile somewhere forthe road since there are always missing links and because Make is ubiquitous on nearly every Linux and macOS it is just all you need to get a project started.
Example: https://gitlab.com/internet-cleanup-foundation/web-security-... Running the 'make' command in this repo will setup all requirements and then run code checks and tests. Running it again will skip the setup part unless one of the dependency files has changed (or the setup env is removed).
WSL is currently horrendously (unusably, IMO) slow. WSL2 promises a 20x speed up, but it was already 100x slower than native Linux at some actually-realistic workloads that happen all the time when you're developing (e.g. `git grep`), so it's probably still too slow to be tolerable.
I had the opposite problem of wanting to develop some stuff for Windows from a Linux environment, and I settled on running a linux VM and copying binaries over by scping to WSL, which works reasonably well.
> One of the worst problems with using windows (in my opinion) is that there’s no native GNU make.
GNU Make even comes with a vcproj file for building a native binary with Visual Studio. Worked fine for me. Building it with Guile support though is difficult, but fortunately Eli Zaretskii provides native binaries through his ezwinports, and they worked pretty much flawlessly for me. Of course you will usually need a shell to execute recipes, but Make itself runs natively. For more information, see README.W32 in the sources.
fabfile.py (Fabric) could be used as a Makefile in Python. If you don't ever need to ssh to other machines ti run your tasks, you could use pyinvoke library directly (tasks.py).
https://www.fabfile.org/
It is easy to add command line arguments to the tasks, configure them using files (json, yaml), environment variables, to split the task definitions into several modules/namespaces.
Having used fabric in the past, I've always found it just as easy to use a shell script and make files.
There's always some level of bootstrapping a project (installing packages/software, compiling libraries and dependencies) where it's easier to just to write a shell script than to program python to do. E.g. How do you get fabric installed on a system? There's also been this longevity of sorts that Make seems to have gotten right. People just keep going back to it because it's simple.
I've been moving away from using shell scripts in a tools/ directory to using Python Invoke (http://www.pyinvoke.org), which is the library underlying fabric.
I used bash scripts for years, but for a lot of reasons made the switch: - It was always painful to create small libraries of functions used across multiple scripts in a project - It's difficult to consistently configure them with per-user settings. I've written bash implementations of settings management, Invoke handles this for me. - I'd still have to reach for Python whenever I needed to do anything with arrays or dicts, etc. - Getting error handling correct can be a chore Invoke has a lot of nice to haves to: - Autogenerated help output - Autocomplete out of the box - Very easy to add tasks, just a Python function - Easy to run shell code when needed - Very powerful config management when needed - Supports namespacing, task dependencies, running multiple tasks at once and deduplicating them It's not perfect, but it's a lot better than my hand rolled scripts were.
Wow I've never seen such bloated python project before. It has 10 dependancies with 2 additional optional dependancies and the introduction/tutorial is absurdly overspecific.
The first example they use to describe the tool is: > Cufflinks is a tool to assemble transcripts, calculate abundance and conduct a differential expression analysis on RNA-Seq data. his example shows how to create a typical Cufflinks workflow with Snakemake. It assumes that mapped RNA-Seq data for four samples 101-104 is given as bam files. This is epitome of non-programmer programming, colour me disappointed.
In 2019 Makefiles are a useful tool for automating project-level things. Too often webapps will require you to install X to install Y to run producing artifact Z. Since Make is old and baked and everywhere, specifying "make Z" is a useful project-level development process. It's not tied to a language (e.g. Tox) nor a huge runtime (Docker). Make is small enough in scope to be easy, and large enough to be capable without a lot of incantations.
The big downside of Make, alas, is Windows compatibility.
> The big downside of Make, alas, is Windows compatibility.
You'd have to give me a _very_ compelling reason to support developers who use Windows, when Windows lacks these essential tools. Besides, don't people who develop on Windows live in WSL?
Nope. I develop in Python, Java, and Kotlin on Windows and never touch WSL. Make is available natively through Chocolatey (a Windows package installer), but I prefer Gradle.
(I also write code to run on Linux, but still prefer Gradle.)
More developers are coding in Windows than any other operating system -- almost more than Mac and Linux combined. The Hacker News filter bubble might lead us to believe otherwise.
https://insights.stackoverflow.com/survey/2019#technology-_-... Windows
47.5% MacOS
26.8% Linux-based
25.6% BSD
0.1% 87,851 responses (The Stack Overflow survey is a poor representation of the entire development community, but it's worth something, maybe the best we have.)
>The big downside of Make, alas, is Windows compatibility.
Isn't the big problem that you have no idea what it's doing to your system? Also that you aren't expected to be able to undo it. You can read the makefiles, of course, but it seems simpler not to have to. (Just update the necessary packages yourself, to the latest version.) Forgive me if this is naive of me.
>Isn't the big problem that you have no idea what it's doing to your system?
As opposed to what exactly? Any other alternative, e.g. separate shell scripts, "npm run" scripts in package.json, running a Docker image, hell even cmake or other make-like tools - does stuff you don't know about without reading the files either.
> The big downside of Make, alas, is Windows compatibility.
GNU Make works fine on Windows. The sources come with a vcproj to build it natively, or you get it from ezwinports. At my dayjob, we have a pretty complicated build with GNU Make for cross-compiling our application to Arm and PowerPC, and it works on Windows, even with special Guile scripts to reduce the number of shell calls which are extremely slow on Windows.
Example: https://gitlab.com/internet-cleanup-foundation/web-security-...
Running the 'make' command in this repo will setup all requirements and then run code checks and tests. Running it again will skip the setup part unless one of the dependency files has changed (or the setup env is removed).
I had the opposite problem of wanting to develop some stuff for Windows from a Linux environment, and I settled on running a linux VM and copying binaries over by scping to WSL, which works reasonably well.
Continue this thread — 1 reply
If you just want a Make, there is [2] which can be installed separately and is part of the GNUWin32 collection.
[1] https://www.msys2.org/ [2] http://gnuwin32.sourceforge.net/packages/make.htm
GNU Make even comes with a vcproj file for building a native binary with Visual Studio. Worked fine for me. Building it with Guile support though is difficult, but fortunately Eli Zaretskii provides native binaries through his ezwinports, and they worked pretty much flawlessly for me. Of course you will usually need a shell to execute recipes, but Make itself runs natively. For more information, see README.W32 in the sources.
It is easy to add command line arguments to the tasks, configure them using files (json, yaml), environment variables, to split the task definitions into several modules/namespaces.
There's always some level of bootstrapping a project (installing packages/software, compiling libraries and dependencies) where it's easier to just to write a shell script than to program python to do. E.g. How do you get fabric installed on a system?
There's also been this longevity of sorts that Make seems to have gotten right. People just keep going back to it because it's simple.
I used bash scripts for years, but for a lot of reasons made the switch:
- It was always painful to create small libraries of functions used across multiple scripts in a project
- It's difficult to consistently configure them with per-user settings. I've written bash implementations of settings management, Invoke handles this for me.
- I'd still have to reach for Python whenever I needed to do anything with arrays or dicts, etc.
- Getting error handling correct can be a chore
Invoke has a lot of nice to haves to:
- Autogenerated help output
- Autocomplete out of the box
- Very easy to add tasks, just a Python function
- Easy to run shell code when needed
- Very powerful config management when needed
- Supports namespacing, task dependencies, running multiple tasks at once and deduplicating them
It's not perfect, but it's a lot better than my hand rolled scripts were.
Continue this thread — 2 replies
The first example they use to describe the tool is:
> Cufflinks is a tool to assemble transcripts, calculate abundance and conduct a differential expression analysis on RNA-Seq data. his example shows how to create a typical Cufflinks workflow with Snakemake. It assumes that mapped RNA-Seq data for four samples 101-104 is given as bam files.
This is epitome of non-programmer programming, colour me disappointed.
Continue this thread — 1 reply
The big downside of Make, alas, is Windows compatibility.
You'd have to give me a _very_ compelling reason to support developers who use Windows, when Windows lacks these essential tools. Besides, don't people who develop on Windows live in WSL?
(I also write code to run on Linux, but still prefer Gradle.)
Continue this thread — 7 replies
VS2019 supports Clang and cmake now.
https://insights.stackoverflow.com/survey/2019#technology-_-...
Windows 47.5%
MacOS 26.8%
Linux-based 25.6%
BSD 0.1%
87,851 responses
(The Stack Overflow survey is a poor representation of the entire development community, but it's worth something, maybe the best we have.)
Continue this thread — 1 reply
Isn't the big problem that you have no idea what it's doing to your system? Also that you aren't expected to be able to undo it. You can read the makefiles, of course, but it seems simpler not to have to. (Just update the necessary packages yourself, to the latest version.)
Forgive me if this is naive of me.
Continue this thread — 4 replies
As opposed to what exactly? Any other alternative, e.g. separate shell scripts, "npm run" scripts in package.json, running a Docker image, hell even cmake or other make-like tools - does stuff you don't know about without reading the files either.
Continue this thread — 8 replies
GNU Make works fine on Windows. The sources come with a vcproj to build it natively, or you get it from ezwinports. At my dayjob, we have a pretty complicated build with GNU Make for cross-compiling our application to Arm and PowerPC, and it works on Windows, even with special Guile scripts to reduce the number of shell calls which are extremely slow on Windows.
Continue this thread — 9 replies
Continue this thread — 1 more reply
Continue this thread — 13 more replies