Cheat Sheet

This is a quick summary of the "technical" steps we've followed so far:

Fork the Github Repository

You'll be given a repository from our organization (highlighted in the picture below). Use the Fork button to create your own "copy".

image

After that, the repo will be copied in your own Github profile:

image

Get your Clone URL

This is really important. We'll use this URL in the next step. In your fork, click on the Clone or download green button and Copy the "Clone URL" as shown below. Make sure you select HTTPS. A valid clone URL looks something like this: https://github.com/santiagobasulto/itp-w1-basic-calculator.git (note the .git at the end).

image

Create the Cloud9 Workspace

Go to https://ide.c9.io and click on the + Create new Workspace button. Put a meaningful name, mark it as Public, select the "Python" template and more importantly, use the Clone URL (retrieved before) to clone from your Github fork.

image

Getting familiarized with Cloud9

Explore your C9 workspace. At the left side you have the file-tree navigation view, at the bottom the terminal and in the center the editor.

image

Create a virtualenv

In the C9 terminal, use the mkvirtualenv command to create a virtual environment. Choose a friendly name that's easy to remember. Don't include spaces or quotes. Virtual environments are a Python standard. You can read more here.

image

Virtualenvs need to be "activated" in order to work. When a virtualenv is active, you'll see the name at the left side of your prompt surrounded by parentheses:

image

Virtualenv commmand list:

  • mkvirtualenv $NAME: Creates a NEW virtualenv named $NAME
  • deactivate: Deactivates the current virtualenv
  • workon $NAME: Activates the virtualenv $NAME.

Install Python dependencies/requirements

In the terminal, run pip install -r dev-requirements.txt. IMPORTANT! Make sure your virtualenv is active!.

Pip is the standard dependency manager for Python and a widely used tool. Make sure you get familiar with it: https://pip.pypa.io/en/stable/

image

Run your code and tests!

Now that everything is installed, we can start running our code and tests. You'll use the command make for this. Here are a few examples:

  • make test: Run all your tests
  • make run: Run code in main.py (code under the if __name__ == '__main__': block)

image

Pushing your changes to Github

Once you've completed the project you'll want to push your changes to Github and submit your Pull Request. Git is a key tool in Software Development. We seriously encourage you to get familiar with Git. This is a good start point: https://try.github.io. Even though Git is a powerful and complex tool, what we need to push our code are just a few commands.

Review the changes made

git status will tell you what files you've changed:

image

Also, git diff will show you the changes made in those files.

Create a commit

Start by adding your files to the index with the git add command. After you add the files, git status will show them in green, as "added":

image

Now it's time to create the commit using the git commit -m command. After the -m flag you need to provide a human-friendly message specifying what changes you've made:

image

If you run git status again, you'll see that there are no more changes (as you've already committed the previous).

Push your code

Just run the command git push and your changes will be pushed to your Fork on GitHub.