srp33 / CodeBuddy

CodeBuddy: A programming assignment management system for short-form exercises
https://codebuddy.byu.edu
GNU Affero General Public License v3.0
11 stars 9 forks source link
learning-management-system programming

CodeBuddy

CodeBuddy is a programming-assignment management system (a type of learning management system that instructors can use to deliver computer-programming exercises. It was developed by the Piccolo Lab and has been used since 2019 in programming-oriented courses. It uses HTML/CSS/JavaScript on the client side and Python on the server side. It executes students' code securely within on the back end.

Here are some of CodeBuddy's features:

How to run a CodeBuddy instance

We have a live server running CodeBuddy here. If you would like to run your own instance, follow the instructions below.

Open a terminal

You will need to have basic familiarity with executing commands through a terminal.

If you are using MacOS or Linux, you should already have a terminal. Open it. Then make sure you have installed the git command-line tool.

If you are using a Windows operating system, install git for windows. Then open Git Bash and use that as your terminal.

Install dependencies
  1. Install Docker Desktop. Make sure it is up and running.
  2. Install Python (version 3.9+) and the pip package manager. After installing them, Python should be available at the command line as python3. You might need to close and reopen the terminal before this command will be available to you.
Clone the GitHub repository

From a terminal window, use the cd command to change your working directory to the location on your file system where you wish to store the CodeBuddy code.

git clone <cloneURL>

Replace <cloneURL> with the GitHub clone address for this project (for example, https://github.com/srp33/CodeBuddy.git).

This will create a directory called CodeBuddy in your current working directory. Use the cd command to navigate to that directory. Then do the following:

  1. At the terminal, execute the following command to install the Python packages: pip install -r front_end/requirements.txt.
  2. Modify Settings.yaml according to your preferences. The default settings should work in most cases.
  3. Create a text file in front_end/secrets/front_end.yaml. It should contain three key/value pairs, as illustrated below. The first is a password for encrypting cookies (use a strong password). The second and third are a client ID and secret that enable CodeBuddy to perform Google authentication. You can obtain these from here.
cookie: "abcdefg"
google_oauth_key: "123456789012-abc123a12aa12aaaa1aaaaa1aaaa1aa.apps.googleusercontent.com"
google_oauth_secret: "ABCDEFGHIJKLMNOP"

[Optional] If you would like to contribute to developing CodeBuddy, complete these additional steps. Otherwise, you can skip these steps.

  1. Install npm.
  2. Install Make. (Try these instructions for Windows.)
Running the front end

For most users, the preferred option is to run the front end within Docker. To do this, execute the run_front_end script at the terminal.

[Optional] If you want to contribute to developing CodeBuddy, it might be helpful to run CodeBuddy outside of Docker so that you do not need to rebuild the Docker image each time you make a change. To do so, follow these steps.

  1. Use the cd command to change your current working directory to front_end.
  2. Execute the following command: make build-watch. After waiting about 30 seconds, hit Ctrl-C to interrupt this command.
  3. Execute the following command: make dev. This will rebuild the HTML pages and start the front-end server.

[Optional] When you modify files in the front_end/templates directory, you will need to re-run make dev. When you change any of the Python code, you will need to hit Ctrl-C to stop the development server and then re-execute make dev.

Running the middle layer

From the CodeBuddy directory, execute the run_middle_layer script. Example: bash run_middle_layer.

Setting up a course

Here you will learn how to create a course in CodeBuddy. When you first run CodeBuddy, it will show a screen that allows you to specify settings for an initial course. We hope this page is self explanatory, but below is a short description of these settings.

After submitting this information, a course will be created, and you can create assignments and exercises. To simplify this process, we have created an example assignment that you can import, rather than specifying the assignment details by hand. To import the example assignment, do the following:

  1. Download the example assignment file from here.
  2. On the page for the course that you just created, click on the "Import assignment" button.
  3. Select the file that you just downloaded.
  4. Click on Continue.

You should see the assignment. If you click on the assignment, you should see a variety of exercises that illustrate some of CodeBuddy's functionality.