Diving Into the Deluge of Data :: Lab 1 :: Workflow and the Toolchain

Lab 1: Workflow and Toolchain

This labs focuses on the tools, techniques, and workflows used by Python programmers and programmers in general. We will adopt most of these best practices and use them for lab distribution, comments, and feedback

Step 0: Lab Preparation

  • Sign up for a GitHub account. Please thoughtfully choose a username so that I can reasonably infer who you are from it. Make sure to choose the free plan (it's the default) and don't set up an organization. After you've registered, please send me an email with your GitHub username. I will add you to the GitHub Williams CS organization and to the CS 135 Students team.
  • Read a virtualenv tutorial up to Why not virtualenv.
  • Read a bit about pip and virtualenv

Step 1: SSH Keys

We will use SSH keys to idenitfy ourselves as trusted sources. This means you won't have to type a password every time you interact with GitHub. It's very convenient, secure and a good best practice.

Follow the instructions on GitHub to generate an SSH keypair and add your public key to your GitHub account.

Step 2: Forking

Navigate to the Lab 1 GitHub repository. Fork the repository by using the Fork button in the top right-hand corner. This copies the repository to your GitHub account.

Step 3: Cloning

You should now have a copy of the repository in your own GitHub account. Now clone the repository to your local disk.

Step 4: virtualenv

virtualenv is a program that isolates collections of python libraries for a particular programming project. It also allows you to associate a specific python verion with a project.

Step 5: pip

Use pip to install the goslate package, which uses Google translation services to translate sentences from one language into another.

Step 6: Text Editors

There are many good text editors. People swear by emacs and vim. In a pinch, you can also use nano. Currently, many people like sublime. Today we will use Atom, but in the future feel free to use whatever you want.

Step 7: Python

Opening the rain.py file in the text editor should reveal the following code.
    '''
    Use Google translate API via the goslate python package to translate
    the phrase "the rain in spain stays mainly on the plain" from english
    to spanish and then back to english again.
    '''

    # make the goslate package available
    import goslate

    # create an instance of the Goslate class
    gs = goslate.Goslate()

    # our phrase
    english = 'the rain in spain stays mainly on the plain'

    # translate from english to spanish and store the result
    spanish = gs.translate(english, 'es')

    # translate from spanish back to english and store the result
    english2 = gs.translate(spanish, 'en')

    # print out the original and translated sentences
    print(english)
    print(spanish)
    print(english2)
    

Step 8: Submitting Code

We will use Git and GitHub for submitting lab assignments.