Skip to content

Instantly share code, notes, and snippets.

@janetriley
Last active September 9, 2015 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janetriley/356d9a6ac3b1007d1c04 to your computer and use it in GitHub Desktop.
Save janetriley/356d9a6ac3b1007d1c04 to your computer and use it in GitHub Desktop.
Additional resources following Software Carpentry workshop.

#GIT

Some topics we didn’t cover:

###Git in groups

A few of the pre-class surveys mentioned wanting to use git within your teams. I'm slow to recommend expensive tech books, but I believe Git for Teams: A User-Centered Approach to Creating Efficient Workflows in Git by Emma Jane Hogbin Westby is worth a look. Westby describes common ways teams use git, as well as choices to make for project structure.

Chapter 5, "Teams of One", and Chapter 6, "Rollbacks, Reverts, Resets, and Rebasing", cover the hands-on mechanics of committing, pushing, and branching in greater depth.

Chapter 7 onwards focuses on how to collaborate. It walks through the decisions around project setup, how to add other developers, and some example workflows. Part 3 shows an example project in GitHub, BitBucket, and GitLab, including how to set up your own GitLab server if you need to host it internally.

There's additional free material at the Git For Teams site that may be of use for your project.

#Python Resources

##People

  • Local Python user group

Documentation

Books

Videos

Skill Progression

There was a wide range of experience levels at the workshop. Here's a roadmap of skill progression.

  • For those totally new to programming: getting familiar with programming techniques and computational thinking. Naming things, making decisions, repeating actions, creating functions.
  • Python syntax. For those with experience in another language, google "Python for ____ programmers" to find the things that will trip you up. Think Python or the official Python Tutorial are good resources, as is "The Quick Python Book" by Naomi Cedar.
  • Write small scripts. Pick something useful to you. Gradually shifting from grammar to composition: from two or three lines of code to functions and scripts. Automate the Boring Stuff with Python is a good resource.
  • Browse the standard libraries so you know what functions are built in. Don't memorize, just become aware of what tools already exist. These are the ones most commonly used in a data processing script:
  • file and directory access for reading and writing files
  • text processing for cleaning text
  • collections "implements specialized container datatypes providing alternatives to Python’s general purpose built-in containers", especially Counter if you need to count occurrences of things
  • parseargs for passing arguments in from the command line.
  • logging

The Python Module of the Week is a more descriptive tour of the standard libraries with examples. It's written for Python2, but most of it applies to Python 3.

  • Browse documentation or a short tutorial for more specialized libraries that are specific to your work - pandas, numpy, matplotlib, etc.
  • Make your code sturdier with error handling and defensive programming.
  • Want to go farther? Some intermediate Python features:
  • generators
  • lambdas - one line functions, seen most frequently in...
  • map, filter, and reduce
  • list, dictionary, and set comprehensions create collections on the fly These are popular topics for conference talks, search PyVideo. The last couple PyCons have included a three hour tutorial.
  • Make your scripts more modular and reusable: //TODO: this needs a separate resource file
  • Pythonic style - PEP8, style books like "Effective Python" or "Idiomatic Python"

#How to get back an old version of a file

The SWC git lesson includes an overview of working with versions

Here's a longer walkthrough for specific situations. Read the git status messages; in all these examples it will suggest a solution.

Let's say I'm working on my_script.py . I've committed a few versions of it. Since my last commit, I've made some changes but want to get rid of them.

Cancel changes on a specific file

Situation 1: Made changes, haven't staged them with git add my_script.py, haven't committed them.

More info: git status shows the current status:

dyn-199-92-166-142:whoi-swc-workshop me$ git status
On branch master
Your branch is up-to-date with 'origin/master' 
  
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   my_script.py

Solution: use git checkout my_script.py or git checkout -- my_script.py to undo your changes.

Situation 2: Made changes, HAVE staged them with git add my_script.py, haven't committed them.

git status shows this:

dyn-199-92-166-142:whoi-swc-workshop me$ git status
On branch master
Your branch is up-to-date with 'origin/master' 

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

	modified:   my_script.py
	

Solution: use git reset HEAD my_script.py to reset it to the last committed version.

Reset all changes to an earlier local or remote version

Situation 3: Reset everything to the last commit I made in my local repository.

Use git reset --hard HEAD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment