chwilk / teaching09-make

New repo to work on make lesson for swcarpentry project
Other
0 stars 0 forks source link

Providing some hands-on examples with make lesson #5

Open mqwilber opened 10 years ago

mqwilber commented 10 years ago

I am new to make and after working through the lessons what I would really like to do is be able to try the builds as the lesson progresses. In most of the other software carpentry lessons there are short exercises every 10 minutes or so to keep people engaged. I think this would really improve these lessons. I like the general format of data -> summary -> stats.py -> figures -> paper. We would just need to alter some of the command tools (i.e srg) to something that exists so that students could actually use the make files.

chwilk commented 10 years ago

I whole-heartedly agree. I even got as far as looking through the software-carpentry pre-requisite software installs, to find that there really isn't a huge set of utilities we can expect an attendee to have available. It would have to be something that even Windows users who are using powershell or a setup like cygwin might reasonably be expected to have available.

Perhaps we can do something really simple, e.g. file.dat contains columns of data, which we then use sort to turn into file.sorted which then can be run through cut to pull out a specific column of data?

mqwilber commented 10 years ago

Yeah, that sounds great! Windows users also usually download Git bash which has most of the basic functionality of the Unix shell. Since most bootcamps are teaching a bit of Python we could also could potentially use commands like python stats.py data1.data data2.dat. Definitely need to make sure that this works on Git bash or cygwin (Issue #6). So maybe our steps could be

  1. Data formatting (file.sorted)
  2. Summarize data (python stats.py *) and output summary.dat
  3. Create some figures (another basic python script?)
  4. Create paper (this will be difficult to impossible to allow everyone to do so maybe this should just stay conceptual)
mqwilber commented 10 years ago

@chwilk, I will mock up a make example based on the lessons that are currently in the repo, submit it for you to review, and then you fix/extend it however you see fit. It might be helpful to have the beginner eyes on it to start (mine) and then the expert eyes on it to polish it up and extend it (yours). What do you think?

chwilk commented 10 years ago

That sounds good. I just discovered that all the glossary links are actually missing from the actual glossary, so I can work on those for now.

I did some wording edits to 00-intro.md, you'll likely have some big changes to make in the rest, so I'll stay out of those until you've gotten them in a good state.

mqwilber commented 10 years ago

Pushed up make examples in branch adding_make_examples. I changed the wording and added make examples for parts 00 - 03 of the lessons. The lesson 04-macros.md still needs to be updated, but @chwilk should first confirm that these examples are ok before we spend time editing the macro section. @chwilk, run python generate_dataset.py to generate the datasets used in the examples.

TODO: Still need to include student exercises in the lessons.

chwilk commented 10 years ago

What's the proper order to run the make files? Starting with the first example, hello.mk, doesn't work because we haven't got summary-1.dat yet.

mqwilber commented 10 years ago

Good point. After running python generate_dataset.py, run false-dependencies.mk to generate everything and then you can work from there. Lol, I need a make file for the make file lesson.

chwilk commented 10 years ago

That's a really good idea actually. Should name it Makefile and have first a make lesson target, and the default with no arguments should direct you to that and mention how to run the other lesions, 'did you mean to run make -f make file.Mk?' On Jul 8, 2014 5:55 PM, "mqwilber" notifications@github.com wrote:

Good point. After running python generate_dataset.py, run false-dependencies.mk to generate everything and then you can work from there. Lol, I need a make file for the make file lesson.

— Reply to this email directly or view it on GitHub https://github.com/chwilk/teaching09-make/issues/5#issuecomment-48409903 .

mqwilber commented 10 years ago

Run

  1. python generate_dataset.py
  2. make -f false-dependencies.mk And that should give you all of the data files, summary files, and figures. false-dependencies.mk is one of the last make files we discuss in lesson 3. You should now be able to run all the other *.mk files, but you might want to touch some of them so hello.mk actually gives you something other than all files up to date

Could you expand on your idea for the lesson makefile? I didn't quite follow.

chwilk commented 10 years ago

I was just thinking that it would be useful to have a default make file called Makefile that would have two targets:

  1. A default target (i.e. what gets invoked when you call make with no options) that prints a useful message.
  2. A lesson target that invokes the generate_dataset.py script, and creates all the intermediate data files you need to run the rest of the lesson, as well as running touch on the files that need it to allow hello.mk to run.

I'll try to throw something together.

chwilk commented 10 years ago

I'm getting an error on false_dependencies.mk on the create_figure.py where it's trying to create a graphical window. (I'm ssh'd into my workstation from a chromebook, so I can't throw back X11 connections right now) Is it necessary for it to display a GUI window to create the figure?

chwilk commented 10 years ago

Just pushed 8606ae3..0a6cb85 with fix for create_figure.py requiring windows...

mqwilber commented 10 years ago

Excellent, good catch! Just saw the change. I tried to do the same thing before seeing your changes so a48b80f is me returning to your solution with the comment. Apologies for dirtying the commit history.

chwilk commented 10 years ago

Nice, that's what version control's all about.

I just pushed a default Makefile. It needs a little tweaking still so we're properly set up for hello.mk.

I'm getting caught by something in either a makefile or python script that deletes the summary.dat after creating it, which makes hello.mk unhappy.

mqwilber commented 10 years ago

Apparently you need to add the special target .SECONDARY so make doesn't delete the intermediate files. I made this change in be58c5e.

We should probably add a brief section in the lesson explaining special targets like .SECONDARY (Issue #7 )

mqwilber commented 10 years ago

Looking good. Following up on some previously mentioned TODOs

TODO: Still need to include student exercises in the lessons.

I will add these this weekend and push them for review

...should first confirm that these examples are ok before we spend time editing the macro section.

I will see what I can do with the macro lesson in terms of allowing students to interact with it a bit more.