Workspace Repository Setup


Before beginning these instructions you should have first updated your operating system and then installed the required software (Python 3.9, Visual Studio Code, and git).

0. Find Your Official UNC E-mail Address

Primary UNC e-mail addresses typically end in @live.unc.edu or @email.unc.edu!

Find your primary e-mail address by logging into Sakai, clicking on your name / profile picture / avatar in the top right corner, selecting Profile, and looking under the Email field: https://sakai.unc.edu/

Use your primary e-mail address when you register for GitHub.

1. Register for GitHub

GitHub is for backing up your course Workspace Repository and for downloading course materials.

You can think of GitHub as a social network where people and organizations share and collaborate on code with one another. Organizations like NASA, NOAA, Peace Corps, Washington Post, New York Times, and so on, host projects publicly (and privately) on GitHub. It’s a valuable service for data scientists, software engineers, research teams, and more.

Your coursework will have its own private “git repository”. The technology we use for backing up versions of our projects and transmitting them to or from the internet, hosted on GitHub, is called git. Visual Studio Code has git support built into it. Git is a professional version control tool we use in limited ways in COMP110, but if you continue on in a field that involves programming and data you’ll likely encounter it again.

  1. Register for a GitHub account with your primary UNC address: https://github.com/
    • You are encouraged to choose your ONYEN as your username, if it is available (not required)
  2. After registering, edit your profile from this page: https://github.com/settings/profile
    • Be sure your name and email match what you used on Course.Care
    • Fill out the rest of your GitHub profile with a high quality photo of yourself, a brief bio, UNC Chapel Hill as your “company”, and Chapel Hill (or home) as your location if you are going to continue in a field that involves programming (computer science, data science, information science, and so on). Think of this as a secondary LinkedIn when it comes to future opportunities, because that’s often how employers and graduate schools look at it.

2. Setup your Workspace in Visual Studio Code

  1. Open Visual Studio Code
  2. Open the View menu and select Command Palette
    • You’ll use the Command Palette a lot so it’s worth trying to remember its shortcut!
    • Windows: Control+Shift+P
    • Mac: Command+Shift+P
  3. Type in “Git: Clone” (without the quotes) and press Enter.
    • If you do not see this option after installing course software previously, try rebooting your computer.
  4. Copy the following URL: https://github.com/comp110-21f/comp110-21f-workspace.git
    • Right Click and Paste the copied URL into the text box that appeared in VS Code after the previous step.
    • Or use the Paste keyboard shortcut: Control+V Windows / Command+V Mac
  5. Press Enter and you will be asked where you want your course workspace repository to be saved on your computer. Just accepting the default suggestion is OK.
  6. Visual Studio Code may ask you to enter your GitHub username and password in the same place you just entered your Workspace Repository URL. If you don’t see this prompt you can proceed to step 7.
    • If it asks for your GitHub username, type it in and press enter. Your username can be found in the top left of your GitHub profile at https://github.com/settings/profile.
    • If it asks for your GitHub password, type it in and press enter. Your password will show up as dots as you type.
  7. Press OK when asked if you would like to Open the repository after it downloads.

3. Installing VSCode Extensions

VSCode can be customized with extensions specific to the types of work you use it for. We will install extensions that help us this this course. We recommend limiting the number of additional extensions you install, you shouldn’t need any more for our course, because they can slow down VSCode and not cooperate with one another nicely in some configurations.

  1. If you see a popup notifying you “This workspace has extension recommendations.” then click “Install All”
    • VSCode will ask you to restart for the Pylance extension. Allow it to.
    • Press ignore for any additional prompts to install additional plugins such as pytest or flake8. For these you can click the gear icon and ask VSCode to stop recommending them.
  2. Confirm you have the correct VS Code extensions installed by clicking the View menu and selecting Extensions. If you do not see the following listed under “Installed”, find them under Recommended, click on each, and click install.
    1. Python
    2. Pylance
    3. Jupyter
    4. Edit csv
  3. Restart VSCode by going to File > Exit and then opening VSCode.

4. Installing Python Libraries

We will use some popular 3rd party libraries this semester in COMP110. These are freely available, open source packages that other software developers made and shared. The packages installed will help us with some data science concerns when we reach that segment of the course.

  1. Open the File menu, followed by Open Recent and you should see the top entry listed as something like “comp110-21f-workspace”
    • If you do not, try closing and reopening VSCode.
  2. In the future, if you open VS Code and need to get back to your COMP110 Workspace, the easiest way is to repeat step 1 above.
  3. In the bottom “status bar” of VSCode, to the right of “master” and a refresh icon, you should now see Python followed by a version number. If the version number is not there or is not 3.9 or greater, follow the next bullet:
    • Open the View menu and Command Palette. Type “Python: Select Interpreter” (without the quotes) and press Enter. From the list that pops up choose Python 3.9 or greater.
  4. Open the View menu and select Terminal to bring up the built-in terminal.

FOR STUDENTS WITH A NEW M1 Macbook ONLY, follow these steps 5-6:

  1. In the Terminal type the following command, being careful to match it exactly to install the numpy library.
  1. Press Enter to run the command. This command installs additional Python libraries, which give you functionalities we’ll use later in the course.

Everyone else, follow these steps 7-8:

  1. In the Terminal type the following command, being careful to match it exactly.
  1. Press Enter to run the command. This command installs additional Python libraries, which give you functionalities we’ll use later in the course.

5. Setup your Backup Workspace on GitHub

  1. Navigate a web browser to https://classroom.github.com/a/zgjDwIVk
  2. Clicking “Skip to the next step” when prompted to select your user / identification
  3. Click “Accept this Assignment”
  4. When the workspace is getting setup you may need to refresh until it tells you you’re ready to go!
  5. Click the link to your personal backup repository that looks something like this https://github.com/comp110-21f/comp110-workspace-krisjordan (except instead of krisjordan you will see your GitHub username).
  6. Toward the top of the page there will be a green button that says Code. Click this and you will see two options: HTTPS and SSH. Click HTTPS.
  7. Copy the text in the box to the right of the HTTPS/SSH buttons (or click the clipboard icon). This is the URL to your backup repository.
  8. In VSCode, ppen the View menu and select Command Palette, the shortcut for this menu is:
    • Windows: Control+Shift+P
    • Mac: Command+Shift+P
  9. In VSCode, type in Git: Add Remote and press enter with the option selected.
  10. In the blank text box that appears, paste in the URL to your backup repository that you just copied. Press enter.
  11. When asked for “Remote name” type in: backup
  12. Open up the Command Palette once more, just as in step 8.
  13. Begin typing in: Git: Push to... and press Enter once it is the first option.
  14. Select the backup remote that is your personal workspace on GitHub.
    • You may see a spinning “refresh” icon in your status bar at the bottom of VSCode. Unless an error backing up occurs, you will not see any confirmation. It succeeds silently.
    • If you want to see your backed up work on Github, back in your web browser, refresh the page you had open and you should see files in it now.
  15. If steps 13 and 14 do not work, do the following:
    • If your Terminal window from above is still open from section 3, great! If not, open a new Terminal pane in VS Code.
    • At the prompt, type the following command and press enter: git push --force backup main

6. Configure your git Name and E-mail

  1. If your Terminal window from above is still open from section 3, great! If not, open a new Terminal pane in VS Code.
  2. At the prompt, type the following command and press enter with your primary e-mail address inside the double quotes:
  1. Then, type tye following command and press enter with your first and last name inside the double quotes:

After doing this, when you make backup commits in git (which you’ll do shortly!) they’ll be correctly attributed to you.

7. Operating System Specific Configuration

Windows

If your laptop is running Windows, you should change the default shell in VSCode to be Git Bash.

  1. Open the View menu and select Command Palette (or press Control + Shift + P)
  2. Type: Select Default Profile
  3. Press Enter
  4. From the dropdown list, you should see Git Bash. Select it.

macOS

If your laptop is running macOS, you should confirm the default shell in VSCode is zsh. This should already be the case, but to be sure, run these steps:

  1. Open the View menu and select Command Palette (or press Command + Shift + P)
  2. Type: Select Default Profile
  3. Press Enter
  4. From the dropdown list, you should see zsh in one of the options. Select it.

It is handy to be able to open Visual Studio Code from your Terminal using the code command in the future. To register this:

  1. Open the View menu and select Command Palette (or press Command + Shift + P)
  2. Type: Install code command
  3. Press Enter

8. Confirm Everything is Good to Go

From the View Menu, select Explorer. You should see a left-hand sidebar with comp110-WORKSPACE at the top and if you expand it you should see exercises, lessons, projects, sandbox, and README.md. These are folders, which we refer to more technically as directories, and files in your workspace.

Let’s be sure you are able to exit out of VSCode and find your work again. Go ahead and close VSCode. Then open new window. If you see the same files in the left-hand sidebar: great! Keep reading, though, so you know what to do in the future if you do not see your workspace.

If you do not see your workspace files in the Explorer sidebar, go to File, select Open Recent, and look for the topmost entry that is comp110-21f-workspace and select it. This is how you can get back to your workspace most easily in the future.

Great work! Your software setup is now ready for COMP110!

Contributor(s): Kris Jordan