Skip to content

Python script automation that covers clone repo, assignment info integration (due date / late), terminal interactive grading & commenting, and upload to google spreadsheet for view.

Notifications You must be signed in to change notification settings

SI669-internal/mass_clone

 
 

Repository files navigation

Batch Clone

1st version automation tool that integrates three things:

  • Github API: Batch clone repo
  • Google Sheet API: Display grades / Read roster
  • Interactive Terminal: run code, grade and comment all in one place

How it works

  • Batch clone student repos
    • Support late detection when using Github classroom.
    • You can also provide a list of github repo names in your Google spreadsheet, but no late detection.
  • Interactive grading and commenting on students' repo submits.
    • Can batch apply terminal commands on each repo.
    • Can open code editor or run code for you when you are grading students' submits.
    • TODO: late penalty
  • Can keep track of multiple assignments, and show all the grades and comments you made in your Google spreadsheet.
  • Will clone student repos next to the mass_clone directory as follows:

/mass_clone
/<generated assignment prefix here>
---/<generated repo clones for the assignment>
---/<generated repo clones for the assignment>
---/<generated repo clones for the assignment>
---/...

Prerequisite

You should have node ionic cordova installed globally for SI 669. It's best to have Visual Studio Code installed, but you can also use your own editor of preference.

Quickstart

  1. Clone the project. At project root, run . ./setup-project.sh
  2. Setup Google Sheet API - download credentials.json.
    1. Go to Sheet API Doc and press "Enable the google sheets api" to download. After you have the json credential, place in folder python-script.
    2. Prepare a google spreadsheet where you'll use it to store your grading and comments.
    3. Copy the spreadsheet ID and put it in python-script/credentials.py as os.environ['SPREADSHEET_ID'] = 'YOUR SPREADSHEET ID'
  3. Enter your github account/password in python-script/credentials.py. This file is for github API that can search and get repo info. Not needed if the assignment you are working on does not use Github Classroom (in such case, you'll have to feed the repo info using a google spreadsheet).
    1. Don't worry - all your credentials are gitignored and won't be pushed to the repo.
  4. cd python-script and turn on the virtual environment by . ./venv/bin/activate
  5. python main.py to run the program.
    1. When the tool is setting up repos and opening project in editor for you, please refrain from switching and using to other application. This is because some of the automation simulates keyboard input and will not work if the tool lose focus.

Configuration

  • There're two config files, python-script/settings_local.py and python-script/script-session/local-config.json. local-config.json has higher priority and will overwrite the settnigs in settings_local.py.

  • settings_local.py provides a setting base for default. On the other hand, local-config.json lets you preserve and reuse settings for each assignment.

  • The recommended workflow will be to test your settings in settings_local.py for the assignment you're workin on first. When you feel comfortable with that setting, you can copy that setting to local-config.json and specify the assingment prefix accordingly.

  • The default setting assume you have vscode installed and PATH setup to open a project in vscode by code . . See python-script/settings_local.py, there's a "grade_additional_command": "code .", line. If you want to use your own editor, you'll need to change the command to the one that will fire up your editor. You can assume that the command is executed in the student's repo root folder.

  • (Optional) Using iterm2 if you want to use grade_additional_command, which lets you run command that will be executed in the repo directory when you're grading submits.

    • otherwise won't open iterm2 for you even when you set grade_additional_command

Future TODOs

  • Late penalty. Since for Github Classroom we already have a late boolean and hook for late delta, we can apply penalty based on the duration over due date.
  • Read record from google spreadsheet instead of local cache. This can let us be machine-indenpedent and easier to grade using public computer.
    • Set dynamic for main sheet range, expose range to config.

Lab 2 Part A Grading Insights

  • [Ramdom] sometimes node toss warning about not using catch(). onrejected vs catch in Promise?
  • [Case D] Reject immediately even before loop.
  • [Case C] setTimeout(resolve(), bignum); is wrong use of setTimeout since the 1st arg should be a function instead of a value! See this SO post
  • [Case B] some student's loop is blocking and not using Promise async feature.
  • [Case A] reject in the first loop round, but the loop still keeps going. (resolve() and reject() will not stop loop? Should instead explicitly do return after resolve() or reject(). See this post)
  • [Performance] countBig(): putting resolve() outside of while is much faster (10ms). If you put if in while then do resolve(), you have to keep checking for each round, which is much slower (500-1200ms).

Run On A Public Computer

TL;DR

  • Download this script, or see install-env-lrc-and-run.sh in the project root folder.

  • Run the script

  • Download mass-clone-local-needs.zip

  • Wait for installation to complete

What does the script do?

  1. Run in user permission, no need for sudo.
  2. Install brew
  3. Install python3 and venv
  4. Prompt you to prepare some of the dependencies.
  5. Start the script for you at the end.

About

Python script automation that covers clone repo, assignment info integration (due date / late), terminal interactive grading & commenting, and upload to google spreadsheet for view.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 88.1%
  • Shell 11.9%