This project creates a Google Doc from a Colab notebook by pairing each question number with evidence (code + output), then submits it to a Google Classroom assignment.
- Reads a Colab
.ipynbfrom Google Drive - Parses question numbers from markdown cells (ex:
Q1,Question 2) - Collects evidence from code cells and their outputs
- Creates a Google Doc with
Question → Evidence - Attaches the Doc to a Classroom assignment and turns it in
- Enable APIs in your Google Cloud project:
- Google Classroom API
- Google Docs API
- Google Drive API
- Configure OAuth consent screen for your school account.
- Create OAuth Client ID (Desktop App) and download
credentials.json.
Place credentials.json in this project folder.
Copy config.example.json to config.json and fill in:
class_idassignment_idnotebook_file_id
If the assignment ID isn’t visible in the URL, use the built-in API helper:
python lab_agent.py --list-assignments --config config.json
It will show pending assignments with IDs so you can copy the one you want.
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python -m playwright install
python lab_agent.py --config config.json
Start the local web app:
python app.py
Open http://localhost:5055 in your browser.
Railway requires a Web OAuth flow (not the local desktop flow).
- Create Web App OAuth credentials in Google Cloud.
- Add these Redirect URIs:
https://YOUR-APP.up.railway.app/oauth2callback
- Set Railway environment variables:
WEB_OAUTH=1GOOGLE_CLIENT_ID=...GOOGLE_CLIENT_SECRET=...GOOGLE_REDIRECT_URI=https://YOUR-APP.up.railway.app/oauth2callbackFLASK_SECRET_KEY=...
- Deploy the repo on Railway and open the app URL.
Railway will use the Procfile which runs:
gunicorn app:app --bind 0.0.0.0:$PORT
- Question numbers can be detected in markdown, code comments, or output text (ex:
Q3,Question 4). - For full output screenshots, set
"screenshot_outputs": truein your config. - Drive access uses read-only scope, so you may need to re-auth the first time after changes.