make-novice
make-novice copied to clipboard
Any interest in changing scripts from python to bash?
Admittedly, I'm not a pythonista, but I wonder whether there would be value in using bash versions of the three python scripts. For whatever reason, I'm running into problems with getting python installed correctly on my Mac. Once I got it pointed in the right direct, I ran into problems with installing numpy. It's quickly becoming a tutorial on installing python rather than make :)
I suspect there might be less installation issues and things might run more smoothly using something written in bash. Any thoughts?
I think it's a good idea to explore. It's always bugged me a little bit that a Python install is a prerequisite for this lesson, which is a heavyweight prerequisite (in terms of time to install and space taken).
The blocker would be replicating the graphs currently visualised by numpy and the .png files it creates. Doing that in bash would likely require a library that could be even more challenging to install (especially on Git Bash under Windows) than Python/numpy is. However, plotcount.py now has an "ascii" flag which prints a plain-text bar chart at the terminal:
$ python plotcount.py isles.dat ascii
the ########################################################################
of ##############################################
and ################################
...
That functionality could, I'd assume, be replicated in bash, so these plain-text plots could be used instead of .png files (as the principle of going from text file to a file of numerical counts to a plot file would still remain). So, the Make lesson would be based on the scripts:
$ bash wordcount.sh books/isles.txt isles.dat
$ bash plotcount.sh isles.dat isles.plt | ascii # Using a made-up .plt extension for plain text plot.
$ bash zipf_test.sh abyss.dat isles.dat ...
Agreed. Should we break this into a list of smaller tasks?
I have a prototype for wordcount.sh. It's not the most elegant solution, but it works.
How is the best way to do this? Maybe create a working branch here to receive my PR without mess up with the gh-pages?
Regarding #74, What do we think? Should the bash scripts (when finished) replace the python scripts, or should we keep both?
The considerations I would think are simply:
- the python scripts are "nicer" in terms of being able to save/ display an image rather than an ASCII plot
- the bash scripts don't require a python installation.
- The objective of the lesson is to teach Make, rather than plotting, so perhaps 1. and 2. above don't matter.
I would be in favour of keeping both. We could actually add some tests to make sure both versions give the correct output. In fact, the whole lesson lends itself to automatic testing...
I agree with @lexnederbragt. Is there any good reason to do not keep both?
I guess that most of the students will already have Python running on their laptops (even if they don't know that), but if not, the Bash scripts would be a plan B ready to go.
We could have an alternative download in the setup section containing the bash scripts, but leave the lesson text unchanged. Then the bash script lesson would just involve replacing *.py with *.sh.
No one has commented on this in a while. But if it's still an issue, I just thought I'd add my perspective having seen a lot of sw-carpentry classes.
Any scientists/students taking this lesson are almost certainly going to be generating figures routinely. And they almost certainly will not be generating text-based figures with the shell.
In my opinion, having realistic examples of figure generation, such as with Python or R, adds to the value of this lesson. Generating figures in Python or R helps students really "see" the value of using Make.
Rather than creating shell versions of the data visualization, one option is to make a parallel set of R exercises for this tutorial. R is in someways easier to install than python (only one repository to worry about) and doesn't require any additional packages for basic plotting. In most of the software carpentry classes I've been to it's been widely used.
I'm sorry that I haven't concluded the text-based figures alternative. I've been busy at work, but I'll make it happens in the following days.
@akleinhesselink, I have no question that text-based figures are outdated in modern times, but the goal was not to replace Python but to provide a last minute plan B for a student without a functional Python. An environment with Makefile certainly satisfies the requirements for the text-based solution being proposed.
Closing as inactive in preparation for #169