{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Basic Python Flow"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: instantgrade in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (0.1.0)\n",
      "Requirement already satisfied: openpyxl>=3.0.0 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from instantgrade) (3.1.5)\n",
      "Requirement already satisfied: pandas>=1.0.0 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from instantgrade) (2.3.3)\n",
      "Requirement already satisfied: nbformat>=5.0.0 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from instantgrade) (5.10.4)\n",
      "Requirement already satisfied: nbclient>=0.5.0 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from instantgrade) (0.10.2)\n",
      "Requirement already satisfied: click>=7.0 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from instantgrade) (8.3.1)\n",
      "Requirement already satisfied: jupyter-client>=6.1.12 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from nbclient>=0.5.0->instantgrade) (8.6.3)\n",
      "Requirement already satisfied: jupyter-core!=5.0.*,>=4.12 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from nbclient>=0.5.0->instantgrade) (5.9.1)\n",
      "Requirement already satisfied: traitlets>=5.4 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from nbclient>=0.5.0->instantgrade) (5.14.3)\n",
      "Requirement already satisfied: python-dateutil>=2.8.2 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from jupyter-client>=6.1.12->nbclient>=0.5.0->instantgrade) (2.9.0.post0)\n",
      "Requirement already satisfied: pyzmq>=23.0 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from jupyter-client>=6.1.12->nbclient>=0.5.0->instantgrade) (27.1.0)\n",
      "Requirement already satisfied: tornado>=6.2 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from jupyter-client>=6.1.12->nbclient>=0.5.0->instantgrade) (6.5.2)\n",
      "Requirement already satisfied: platformdirs>=2.5 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from jupyter-core!=5.0.*,>=4.12->nbclient>=0.5.0->instantgrade) (4.5.0)\n",
      "Requirement already satisfied: fastjsonschema>=2.15 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from nbformat>=5.0.0->instantgrade) (2.21.2)\n",
      "Requirement already satisfied: jsonschema>=2.6 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from nbformat>=5.0.0->instantgrade) (4.25.1)\n",
      "Requirement already satisfied: attrs>=22.2.0 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from jsonschema>=2.6->nbformat>=5.0.0->instantgrade) (25.4.0)\n",
      "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from jsonschema>=2.6->nbformat>=5.0.0->instantgrade) (2025.9.1)\n",
      "Requirement already satisfied: referencing>=0.28.4 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from jsonschema>=2.6->nbformat>=5.0.0->instantgrade) (0.37.0)\n",
      "Requirement already satisfied: rpds-py>=0.7.1 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from jsonschema>=2.6->nbformat>=5.0.0->instantgrade) (0.29.0)\n",
      "Requirement already satisfied: et-xmlfile in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from openpyxl>=3.0.0->instantgrade) (2.0.0)\n",
      "Requirement already satisfied: numpy>=1.26.0 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from pandas>=1.0.0->instantgrade) (2.3.5)\n",
      "Requirement already satisfied: pytz>=2020.1 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from pandas>=1.0.0->instantgrade) (2025.2)\n",
      "Requirement already satisfied: tzdata>=2022.7 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from pandas>=1.0.0->instantgrade) (2025.2)\n",
      "Requirement already satisfied: six>=1.5 in /Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages (from python-dateutil>=2.8.2->jupyter-client>=6.1.12->nbclient>=0.5.0->instantgrade) (1.17.0)\n"
     ]
    }
   ],
   "source": [
    "!pip install instantgrade\n",
    "\n",
    "from instantgrade import Evaluator"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "✅ Student notebook generated at: submissions/student_notebook.ipynb\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages/nbformat/__init__.py:96: MissingIDFieldWarning: Cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n",
      "  validate(nb)\n"
     ]
    }
   ],
   "source": [
    "from instantgrade.utils.io_utils import generate_student_notebook\n",
    "\n",
    "generate_student_notebook(\n",
    "    instructor_path=\"./sample_solutions.ipynb\",\n",
    "    output_path=\"./submissions/student_notebook.ipynb\"\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Volumes/MacSSD/Areas/Github_Repositories/evaluator/.venv/lib/python3.13/site-packages/nbformat/__init__.py:96: MissingIDFieldWarning: Cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n",
      "  validate(nb)\n"
     ]
    }
   ],
   "source": [
    "eval = Evaluator(\"./sample_solutions.ipynb\", \"./submissions\")\n",
    "result = eval.run()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "PosixPath('report/report_20251201_164652.html')"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from instantgrade.utils.path_utils import filename_safe_timestamp_format\n",
    "\n",
    "result.to_html(f\"./report/report_{filename_safe_timestamp_format()}.html\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "x2JVLvRAu_lX"
   },
   "source": [
    "# EOF"
   ]
  }
 ],
 "metadata": {
  "colab": {
   "provenance": []
  },
  "kernelspec": {
   "display_name": ".venv (3.13.7)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
