Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any interest in changing scripts from python to bash? #48

Open
pschloss opened this issue Jun 13, 2016 · 9 comments
Open

Any interest in changing scripts from python to bash? #48

pschloss opened this issue Jun 13, 2016 · 9 comments

Comments

@pschloss
Copy link

@pschloss pschloss commented Jun 13, 2016

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?

@mikej888
Copy link
Contributor

@mikej888 mikej888 commented Jun 14, 2016

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 ...
@tpoisot
Copy link

@tpoisot tpoisot commented Oct 24, 2016

Agreed. Should we break this into a list of smaller tasks?

@castelao
Copy link

@castelao castelao commented Dec 18, 2016

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?

@gcapes
Copy link
Contributor

@gcapes gcapes commented Jan 9, 2017

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:

  1. the python scripts are "nicer" in terms of being able to save/ display an image rather than an ASCII plot
  2. the bash scripts don't require a python installation.
  3. The objective of the lesson is to teach Make, rather than plotting, so perhaps 1. and 2. above don't matter.
@lexnederbragt
Copy link
Member

@lexnederbragt lexnederbragt commented Jan 23, 2017

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...

@castelao
Copy link

@castelao castelao commented Feb 6, 2017

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.

@gcapes
Copy link
Contributor

@gcapes gcapes commented Feb 6, 2017

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.

rgaiacs pushed a commit to rgaiacs/swc-make-novice that referenced this issue May 6, 2017
@akleinhesselink
Copy link
Contributor

@akleinhesselink akleinhesselink commented Aug 28, 2017

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.

@castelao
Copy link

@castelao castelao commented Aug 28, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants
You can’t perform that action at this time.