00:00 AM
00:00 AM

To get the most out of the tutorials, you will need to have the correct software installed and running. Specific requirements for each tutorial are specified in the detailed description for each tutorial. But it's best to start with one of the scientific Python distributions to ensure an environment that includes most of the packages you'll need.

Version Control and Unit Testing for Scientific Software

Matt Davis - Space Telescope Science Institute
Katy Huff - University of Wisconsin - Madison


Part 1

Part 2

Part 3


Matt Davis
Matt works on scientific Python applications at the Space Telescope Science Institute where he is active in teaching Python, git, and software engineering to colleagues. He has taught at several boot camps for Software Carpentry and has developed teaching materials on Python, testing, software engineering, and git/GitHub for the Software Carpentry community. He has attended SciPy regularly since 2010 and gave a talk at PyCon 2013 titled "Teaching with the IPython Notebook" (video: http://pyvideo.org/video/1744/teaching-with-the-ipython-notebook).

Katy Huff
Katy Huff is a nuclear engineering Ph.D. candidate at the University of Wisconsin - Madison where she helped to found The Hacker Within, a peer educating scientific computing interest group. In the last four years with THW and, later, Software Carpentry, she helped to create and teach curriculum for over a dozen boot camps and engineering classrooms to a total of approximately six hundred students. Boot camps varied from two to ten hours per day and from two days to two weeks in length, addressing topics such as the shell, version control, databases, C++, unit testing, and Python (with NumPy, SciPy, MatPlotLib, etc.). During this time, she has taught very heterogeneous groups who traversed disciplines from physics to limnology and included researchers and professionals as well as students at the undergraduate, graduate, and faculty levels.


Writing software can be a frustrating process but developers have come up with ways to make it less stressful and error prone. Version control saves the history of your project and makes it easier for multiple people to participate in development. Unit testing and testing frameworks help ensure the correctness of your code and help you find errors by quickly executing and testing your entire code base. These tools can save you time and stress and are valuable to anyone writing software of any description.

This collaborative, hands-on tutorial will cover version control with Git plus writing and running unit tests in Python (and IPython!) using the nose testing framework. Attendees should be comfortable with the basics of Python and the command line but no experience with scientific Python is necessary.


The tutorial will be split into two two-hour lessons. The first lesson will cover git/GitHub and the second lesson will cover unit testing. Throughout the entirety of the tutorial students will be working in pairs. Our teaching style is to have frequent, short exercises for students. Ideally instructors aren't talking for more than a few minutes before they stop and students do something on their own machines. Instructors then give an explanation and example, then move on to the next item.

Lesson 1: git/GitHub

Students will work in pairs and in each pair one student will make a GitHub repo, then give the other student commit access on that repo. Students will take turns making modifications to learn various bits of git functionality.

Lesson 2: Unit Testing

Continuing to work in pairs, students will use test driven development to construct a small scientific program in the IPython Notebook and then take their work to .py files to see how nose works from the command line.

Required Packages

In addition to standard Python this tutorial will require the nose testing framework, the IPython Notebook, and the command line interface to Git. Installing Git varies by platform. Windows users should install Git Bash (aka msysgit), Mac users should install the Mac OS X Command Line Tools, and Linux users should use the packaging system for their particular Linux distribution. The Anaconda CE Python installer includes nose and the IPython Notebook.


Material will be adapted from existing Software Carpentry lessons, especially: https://github.com/swcarpentry/boot-camps/tree/master/version-control/git/git-and-github https://github.com/swcarpentry/boot-camps/tree/master/python/sw_engineering

Other links: http://software-carpentry.org/ - The software carpentry organization with links to many lessons and past boot camps. https://github.com/swcarpentry/boot-camps - Standard Software Carpentry boot camp curriculum. https://github.com/thehackerwithin/PyTrieste/wiki - Early Software Carpentry curriculum from a two week boot camp at the International Center for Theoretical Physics. https://code.google.com/p/hacker-within/w/list - Lesson notes for a three hour lightning lesson at the American Nuclear Society Conference 2011. http://software-carpentry.org/blog/2012/02/trieste-italy-workshop-week-1.html - A blog post about the first week of the two week ICTP boot camp. http://software-carpentry.org/blog/2012/04/lessons-learned-at-the-university-of-chicago.html - A blog post about a two day boot camp at the University of Chicago. http://software-carpentry.org/blog/2011/11/knowledge-of-the-second-kind.html - A blog post about what the hacker within did before it was absorbed into Software Carpentry (it's no longer really its own entity).