0% found this document useful (0 votes)
2 views6 pages

Codespaces Tutorial for DSA Course

This tutorial provides guidance on navigating GitHub Codespaces for a Data Structures and Algorithms course, including accessing the environment, opening folders, transferring work, running tests, submitting assignments, and checking for updates from the instructor. Key steps include committing and syncing changes to GitHub, verifying submissions, and handling repository access issues. The document also includes a Q&A section addressing common concerns related to progress saving and repository access.

Uploaded by

Erick Chavez
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views6 pages

Codespaces Tutorial for DSA Course

This tutorial provides guidance on navigating GitHub Codespaces for a Data Structures and Algorithms course, including accessing the environment, opening folders, transferring work, running tests, submitting assignments, and checking for updates from the instructor. Key steps include committing and syncing changes to GitHub, verifying submissions, and handling repository access issues. The document also includes a Q&A section addressing common concerns related to progress saving and repository access.

Uploaded by

Erick Chavez
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Tutorial: Navigating Codespaces

Data Structures and Algorithms


Prof. Reza Skandari, Imperial College Business School

By the end of this tutorial, you should be able to:


• Understand the Codespaces layout and repository structure;
• Navigate to the correct folder for each activity (classes, homework, TA);
• Run OK tests and interpret the score summary;
• Submit your work from Codespaces (Commit + Sync);
• Verify your submission on GitHub;
• Add instructor’s updated files and folders.

1 Codespaces Access
To access the coding environment for the classroom, go to:
[Link]

Then, click on the Open in Github Codespaces .


Issue: If you encounter a ‘Repository Access Issue’ error, see the last
question in the Q & A section at the end.
This course repository is organised into simple folders so you always know
where to work. Each activity has its own place; when we say open the class
folder or open the homework folder, this is what we mean:
• Classes: cl-01, cl-02, . . .
• Homework: hw-01, hw-02, . . .
• TA classes: all materials are in a single folder, ta-classes

1
2 Opening a Folder in GitHub Codespaces
To start working, open the specific folder for today’s activity inside your
Codespace.

Method 1 (Quick Start). Right-click on the folder for the activity (for
example, cl-01). Then, click Open In Integrated Terminal.

Method 2 (New Workbench).


1. In the Explorer (left panel), right-click the target folder (e.g. cl-02 or
hw-01).
2. Select “Open New Workbench Here”. This launches a new
Codespaces/VS Code window focused on that folder, while your
original window stays at the repo root.
3. In the new window, check the Explorer root: it should display your cho-
sen folder (e.g. cl-02). If needed, open a terminal and confirm the path.
It will typically be: /workspaces/dsa-msc-ba-25-GH-UNAME/cl-02/.

Don’t see “Open New Workbench Here”? Wait a few minutes for
Codespaces to finish loading. If it still does not appear, follow Method 3.

Method 3 (Reopen / Advanced). You may also see “Reopen Workbench


Here”. This works, but it replaces your current window with the subfolder
view (you will “lose” the repo root). If you choose this by mistake, use the
steps below to return.

Advanced Steps.
1. In Codespaces, click the top-left sandwich menu (≡).
2. Choose File → Open Folder. . .
3. In the dialog, clear the current text and type /workspaces/. Select
dsa-msc-ba-25-GH-UNAME, then choose your target folder (e.g. cl-03,
hw-01, or ta-classes).
4. Click OK.

2
5. Check: the Explorer (left panel) should now show the files
from that folder. In the terminal, you should see a prompt like
/workspaces/dsa-msc-ba-25-GH-UNAME/cl-01 (main) when inside
the Class 1 folder.
1. In the Explorer (left panel), right-click the target folder (e.g. cl-02 or
hw-01).
2. Click “Open New Workbench Here”. This opens a new Codespaces/VS
Code window focused on that folder, while your original window re-
mains at the repo root.
3. In the new window, check that the Explorer root shows the folder you
chose (e.g. cl-02). If needed, open a Terminal and confirm the path.
It will typically be /workspaces/dsa-msc-ba-25-GH-UNAME/cl-02/,
where GH-UNAME is your GitHub username.

3 Transfer Your Earlier Work


If you have work in another Codespace and need to move it into this one (e.g.
[Link]), follow these steps.
1. In the old Codespace Explorer, download the file: either drag it to your
desktop, or right–click the file (e.g. [Link]) and choose Download.
2. In the new Codespace Explorer, upload the file: either drag–and–drop it
into the correct folder, or right–click an empty area and choose Upload.
3. If prompted, confirm the overwrite (Replace/Overwrite) to update the
existing file.
4. Check that the file now appears in the intended folder (e.g. cl-01 or
hw-01).
Note: Copy only the Python file(s) you have modified—do not copy the
entire repository or unrelated files (e.g., copy [Link], not the whole cl-02/
folder).
Tip: After transferring, run python ok --score again to confirm everything
still passes.
Important: You cannot transfer the interactive questions between
Codespaces. If you want to practice them again, please redo them in the new
Codespace; otherwise you may ignore them for the previous classes.

3
4 Run the Checks
Before submitting, you should always test your work to make sure everything
runs correctly. Use the integrated terminal in Codespaces to run the OK tests
and see your results:
• Full report with all details:
python ok --score
• Points only (quick summary):
python ok --score | sed -n '/Point breakdown/,$p'
Important: In this version, you also get feedback regarding the interactive
questions.

5 Submit from Codespaces (Commit + Sync)


Once your work passes the checks, you need to save and upload it to GitHub.
In Codespaces this is a two–step process: first Commit, then Sync Changes.
1. Open Source Control (left sidebar icon with branches, Ñ).
2. Type a short message, e.g., finished session 1.
3. Click Commit. If you forgot to write a message, VS Code opens an
editor for the commit message. In that case, click Undo ˜ (top right),
close the editor, add a short message in Source Control, and try again.
4. After committing, click Sync Changes L. This pushes your work to
GitHub.
5. Success check: no files remain under Changes.
Tip (one step): If you want to commit and sync in a single action, click the
small dropdown  next to Commit (to reveal more commit options), then
choose Commit & Sync.

6 Check on GitHub
After syncing, verify that your work is online in your private repository (replace
GH-UNAME with your GitHub username):
[Link]

4
You should see your latest commit under Code → Recent commits, or go
directly to the commits page:
[Link]

If you do not see updates, return to Codespaces and click Sync Changes L
again.

Find your GitHub username Go to [Link] click your profile


picture (top-right). Your username appears next to it.

7 Get Instructor Updates


Sometimes the instructor will share new materials with you (a single file or a
.zip). Here’s how to add them to your Codespace while keeping the folder
structure correct.

A) Single file (e.g., [Link])


1. Save the file on your computer.
2. In Codespaces, open the correct folder in the Explorer (e.g., cl-02 or
hw-02).
3. Drag the file into that folder, or right-click in the folder and choose
Upload.
4. If prompted, confirm Replace/Overwrite.

B) Zipped file (e.g., [Link])


1. On your computer, unzip the file. You should get a folder such as hw-02.
2. In Codespaces, upload the entire folder (not just its contents): drag the
folder into the Explorer, or right-click the repository root and choose
Upload.
3. You should now see a new folder hw-02/ alongside your other folders.

Example If you receive [Link], unzip it and upload the resulting hw-02
folder. Your repository should then include hw-02/ with its files inside.

5
8 Q&A
How can I save my progress?
Save files with ctrl + S (Windows/Linux) or + S (macOS).
Do I need to Commit and Sync for each question?
No. You can make many small commits or a single commit. We will
assess the latest state of your files. We recommend committing and
syncing when you finish a session of work or before switching tasks.
Is my progress saved when I close Codespaces?
If you saved your files, you can safely close the browser tab. Best practice:
Commit and Sync Changes L so your work is definitely on GitHub.
What do I do if I get a repository access issue?
First, locate your GitHub username (see next question), then provide it
to the instructor and request a repository access reset. The instructor
will send a link to the email address associated with your GitHub account
(note: this may differ from your College email, depending on how you
registered).
This reset usually only needs to be done once; afterwards, your student
repository and Codespaces should work normally.
Where can I find my GitHub username?
Go to [Link] click your profile picture (top-right), and
your username will appear next to it.

You might also like