Framework Setup#

As you might have guessed, you will need to write some programs for the Lab part of this course. While you could write the programs in any text editor, you will probably also want to run them (without waiting for CodeGrade to run your program for you every time). For that, you will need to set up an environment that is suitable for executing the assignment programs of this course. Depending on the operating system (OS) that you are using, this setup is a bit different.

Step 1: Install VSCode and WSL (if on Windows)#

Install VSCode. If you are on Windows, make sure to install the WSL extension for VSCode and set up WSL on your computer (run wsl --install in a Windows terminal and follow the instructions). You will need WSL to run the framework on Windows.

Step 2: Follow the GitHub SSH Setup guide#

Clone the repository you created from the framework template on GitHub to your computer using the git clone command. Make sure to use the SSH URL of your repository (which should look like git@github.com:<username>/<repo>.git) and not the HTTPS URL.

Take note of the directory you are cloning the repository into using the pwd command, as you will need to navigate to this directory in the next step.

Step 2: Open the framework in VSCode#

Use the keybind Ctrl + K followed by Ctrl + O to open a folder in VSCode. Alternatively, on macOS, you can use Cmd + K followed by Cmd + O. Then, navigate to the folder where you have cloned the framework repository from GitHub and select it.

If you are on Windows, make sure to select the WSL remote window, by clicking on the green icon in the bottom left corner of VSCode and selecting Remote-WSL: New Window. Ensure the following icon is present in the bottom left corner of VSCode to confirm that you are in the WSL remote window:

WSL Remote

After you opened the framework in VSCode, you should be prompted to install the recommended extensions for the framework. Make sure to install all the recommended extensions.

Step 3: Activate the environment#

This step may be required every time you open a new terminal instance (i.e., every time you open a new terminal window or tab). If you are on Windows, make sure to open the terminal in the WSL remote window of VSCode.

Execute the following command in a new terminal to activate the environment for the lab:

source setup.sh

If everything went right, you should see the prefix (computer-networks-lab) in front of your shell prompt, and your Python version should be 3.11.11 when you run the following command:

(computer-networks-lab) [daniel@archlinux ~]$ python3 --version
# Should output: Python 3.11.11

Execute#

You may now execute any assignment by using the following syntax in the terminal:

python -m <assignment_directory>

For example, to run the chat client assignment, you may run python -m a1_chat_client.