PyKubeGrader 0.2.24__tar.gz → 0.2.26__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/.github/workflows/main.yml +25 -7
- {pykubegrader-0.2.24/src/PyKubeGrader.egg-info → pykubegrader-0.2.26}/PKG-INFO +1 -1
- {pykubegrader-0.2.24 → pykubegrader-0.2.26/src/PyKubeGrader.egg-info}/PKG-INFO +1 -1
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/build/build_folder.py +3 -6
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/initialize.py +5 -3
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/log_parser/parse.ipynb +4 -23
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/log_parser/parse.py +11 -2
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/submit/submit_assignment.py +5 -4
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/tokens/validate_token.py +7 -5
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/.coveragerc +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/.gitignore +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/.readthedocs.yml +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/AUTHORS.rst +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/CHANGELOG.rst +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/CONTRIBUTING.rst +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/LICENSE.txt +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/README.rst +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/docs/Makefile +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/docs/_static/Drexel_blue_Logo_square_Dark.png +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/docs/_static/Drexel_blue_Logo_square_Light.png +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/docs/_static/custom.css +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/docs/authors.rst +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/docs/changelog.rst +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/docs/conf.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/docs/contributing.rst +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/docs/index.rst +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/docs/license.rst +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/docs/readme.rst +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/docs/requirements.txt +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/examples/.responses.json +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/examples/true_false.ipynb +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/pyproject.toml +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/setup.cfg +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/setup.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/PyKubeGrader.egg-info/SOURCES.txt +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/PyKubeGrader.egg-info/dependency_links.txt +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/PyKubeGrader.egg-info/entry_points.txt +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/PyKubeGrader.egg-info/not-zip-safe +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/PyKubeGrader.egg-info/requires.txt +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/PyKubeGrader.egg-info/top_level.txt +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/__init__.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/build/__init__.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/build/api_notebook_builder.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/build/clean_folder.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/graders/__init__.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/graders/late_assignments.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/log_parser/__init__.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/telemetry.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/tokens/tokens.py +3 -3
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/utils.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/validate.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/widgets/__init__.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/widgets/multiple_choice.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/widgets/reading_question.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/widgets/select_many.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/widgets/student_info.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/widgets/style.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/widgets/true_false.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/widgets/types_question.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/widgets_base/__init__.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/widgets_base/multi_select.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/widgets_base/reading.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/src/pykubegrader/widgets_base/select.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/tests/conftest.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/tests/import_test.py +0 -0
- {pykubegrader-0.2.24 → pykubegrader-0.2.26}/tox.ini +0 -0
@@ -2,20 +2,22 @@ name: CI/CD
|
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
5
|
-
branches:
|
6
|
-
|
7
|
-
pull_request:
|
8
|
-
|
9
|
-
|
5
|
+
branches: [main]
|
6
|
+
# Comment out until we have real tests
|
7
|
+
# pull_request:
|
8
|
+
# branches: [main]
|
9
|
+
workflow_dispatch:
|
10
10
|
|
11
11
|
jobs:
|
12
12
|
build:
|
13
13
|
runs-on: self-hosted
|
14
|
+
|
14
15
|
permissions:
|
15
16
|
contents: write
|
17
|
+
|
16
18
|
steps:
|
17
|
-
- name:
|
18
|
-
uses: actions/checkout@
|
19
|
+
- name: Check out repository
|
20
|
+
uses: actions/checkout@v4
|
19
21
|
|
20
22
|
- name: Set up Python
|
21
23
|
uses: actions/setup-python@v2
|
@@ -59,6 +61,22 @@ jobs:
|
|
59
61
|
python -m pip install --upgrade twine
|
60
62
|
twine upload dist/*
|
61
63
|
|
64
|
+
- name: Trigger JupyterHub image rebuild
|
65
|
+
if: |
|
66
|
+
contains(github.event.head_commit.message, '#patch') ||
|
67
|
+
contains(github.event.head_commit.message, '#minor') ||
|
68
|
+
contains(github.event.head_commit.message, '#major')
|
69
|
+
env:
|
70
|
+
JHUB_TOKEN: ${{ secrets.JHUB_REBUILD_TOKEN }}
|
71
|
+
run: |
|
72
|
+
curl -L \
|
73
|
+
-X POST \
|
74
|
+
-H "Accept: application/vnd.github+json" \
|
75
|
+
-H "Authorization: Bearer $JHUB_TOKEN" \
|
76
|
+
-H "X-GitHub-Api-Version: 2022-11-28" \
|
77
|
+
https://api.github.com/repos/theodore-s-beers/engr-131-jhub/actions/workflows/docker.yml/dispatches \
|
78
|
+
-d '{"ref":"main"}'
|
79
|
+
|
62
80
|
- name: Deploy to GitHub Pages
|
63
81
|
env:
|
64
82
|
HOME: "${{ github.workspace }}/../" # Because self-hosted runner is root
|
@@ -22,13 +22,11 @@ try:
|
|
22
22
|
except: # noqa: E722
|
23
23
|
print("Passwords not found, cannot access database")
|
24
24
|
|
25
|
-
import nbformat
|
26
|
-
|
27
|
-
from .api_notebook_builder import FastAPINotebookBuilder
|
28
25
|
from typing import Optional
|
29
26
|
|
27
|
+
import nbformat
|
30
28
|
|
31
|
-
import
|
29
|
+
from .api_notebook_builder import FastAPINotebookBuilder
|
32
30
|
|
33
31
|
os.environ["JUPYTERHUB_USER"] = "jca92"
|
34
32
|
os.environ["TOKEN"] = "token"
|
@@ -180,9 +178,7 @@ class NotebookProcessor:
|
|
180
178
|
self.update_initialize_function()
|
181
179
|
|
182
180
|
def update_initialize_function(self):
|
183
|
-
|
184
181
|
for key, value in self.total_point_log.items():
|
185
|
-
|
186
182
|
assignment_tag = f"week{self.week_num}-{self.assignment_type}"
|
187
183
|
|
188
184
|
update_initialize_assignment(
|
@@ -724,6 +720,7 @@ class NotebookProcessor:
|
|
724
720
|
with open(notebook_path, "w", encoding="utf-8") as f:
|
725
721
|
nbformat.write(notebook, f)
|
726
722
|
|
723
|
+
@staticmethod
|
727
724
|
def add_validate_token_cell(notebook_path: str, require_key: bool) -> None:
|
728
725
|
"""
|
729
726
|
Adds a new code cell at the top of a Jupyter notebook if require_key is True.
|
@@ -2,14 +2,16 @@ import hashlib
|
|
2
2
|
import os
|
3
3
|
import shutil
|
4
4
|
from pathlib import Path
|
5
|
+
from typing import Optional
|
5
6
|
|
6
7
|
import panel as pn
|
7
8
|
import requests
|
8
9
|
from IPython import get_ipython
|
9
|
-
|
10
|
+
|
10
11
|
from .telemetry import ensure_responses, log_variable, telemetry, update_responses
|
11
12
|
|
12
|
-
|
13
|
+
|
14
|
+
# TODO: could cleanup to remove redundant imports
|
13
15
|
def initialize_assignment(
|
14
16
|
name: str,
|
15
17
|
week: str,
|
@@ -33,7 +35,7 @@ def initialize_assignment(
|
|
33
35
|
Raises:
|
34
36
|
Exception: If the environment is unsupported or initialization fails.
|
35
37
|
"""
|
36
|
-
|
38
|
+
|
37
39
|
if assignment_tag is None:
|
38
40
|
assignment_tag = f"{week}-{assignment_type}"
|
39
41
|
|
@@ -6,17 +6,12 @@
|
|
6
6
|
"metadata": {},
|
7
7
|
"outputs": [],
|
8
8
|
"source": [
|
9
|
+
"# ruff: noqa\n",
|
10
|
+
"\n",
|
9
11
|
"# Get the public/private keypair for decryption\n",
|
10
12
|
"key_box = get_keybox()"
|
11
13
|
]
|
12
14
|
},
|
13
|
-
{
|
14
|
-
"cell_type": "code",
|
15
|
-
"execution_count": null,
|
16
|
-
"metadata": {},
|
17
|
-
"outputs": [],
|
18
|
-
"source": []
|
19
|
-
},
|
20
15
|
{
|
21
16
|
"cell_type": "code",
|
22
17
|
"execution_count": null,
|
@@ -151,7 +146,7 @@
|
|
151
146
|
"parser = LogParser(log_lines=log_lines, week_tag=\"week1-readings\")\n",
|
152
147
|
"parser.parse_logs()\n",
|
153
148
|
"parser.calculate_total_scores()\n",
|
154
|
-
"results = parser.get_results()
|
149
|
+
"results = parser.get_results()\n",
|
155
150
|
"\n",
|
156
151
|
"results"
|
157
152
|
]
|
@@ -192,13 +187,6 @@
|
|
192
187
|
"results"
|
193
188
|
]
|
194
189
|
},
|
195
|
-
{
|
196
|
-
"cell_type": "code",
|
197
|
-
"execution_count": null,
|
198
|
-
"metadata": {},
|
199
|
-
"outputs": [],
|
200
|
-
"source": []
|
201
|
-
},
|
202
190
|
{
|
203
191
|
"cell_type": "code",
|
204
192
|
"execution_count": null,
|
@@ -218,7 +206,7 @@
|
|
218
206
|
"time_stamp = results[\"student_information\"][\"timestamp\"]\n",
|
219
207
|
"\n",
|
220
208
|
"week_num = results[\"week_num\"]\n",
|
221
|
-
"assignment_type = results[
|
209
|
+
"assignment_type = results[\"assignment_type\"]\n",
|
222
210
|
"\n",
|
223
211
|
"assignments_graded = results[\"assignment_information\"].keys()\n",
|
224
212
|
"total_score = 0\n",
|
@@ -253,13 +241,6 @@
|
|
253
241
|
"source": [
|
254
242
|
"student_email"
|
255
243
|
]
|
256
|
-
},
|
257
|
-
{
|
258
|
-
"cell_type": "code",
|
259
|
-
"execution_count": null,
|
260
|
-
"metadata": {},
|
261
|
-
"outputs": [],
|
262
|
-
"source": []
|
263
244
|
}
|
264
245
|
],
|
265
246
|
"metadata": {
|
@@ -1,5 +1,14 @@
|
|
1
1
|
from dataclasses import dataclass, field
|
2
|
-
from typing import Optional
|
2
|
+
from typing import Any, Optional, TypedDict
|
3
|
+
|
4
|
+
|
5
|
+
class LogParserResults(TypedDict):
|
6
|
+
student_information: dict[str, str]
|
7
|
+
week: Optional[str]
|
8
|
+
week_num: Optional[int]
|
9
|
+
assignment_type: Optional[str]
|
10
|
+
assignment_information: dict[str, Any]
|
11
|
+
assignment_scores: dict[str, Any]
|
3
12
|
|
4
13
|
|
5
14
|
@dataclass
|
@@ -160,7 +169,7 @@ class LogParser:
|
|
160
169
|
total_score = sum(q["score_earned"] for q in data["questions"].values())
|
161
170
|
data["total_score"] = total_score
|
162
171
|
|
163
|
-
def get_results(self) ->
|
172
|
+
def get_results(self) -> LogParserResults:
|
164
173
|
"""
|
165
174
|
Returns the parsed results as a hierarchical dictionary with three sections:
|
166
175
|
"""
|
@@ -1,8 +1,9 @@
|
|
1
|
-
import os
|
2
|
-
import httpx
|
3
1
|
import asyncio
|
4
|
-
import nest_asyncio
|
5
2
|
import base64
|
3
|
+
import os
|
4
|
+
|
5
|
+
import httpx
|
6
|
+
import nest_asyncio # type: ignore
|
6
7
|
|
7
8
|
# Apply nest_asyncio for environments like Jupyter
|
8
9
|
nest_asyncio.apply()
|
@@ -43,7 +44,7 @@ async def call_score_assignment(
|
|
43
44
|
# Get credentials
|
44
45
|
credentials = get_credentials()
|
45
46
|
username = credentials["username"]
|
46
|
-
password = credentials["password"]
|
47
|
+
password = credentials["password"]
|
47
48
|
|
48
49
|
# Encode credentials for Basic Authentication
|
49
50
|
auth_header = (
|
@@ -1,8 +1,10 @@
|
|
1
|
-
import
|
1
|
+
import asyncio
|
2
2
|
import base64
|
3
|
+
import os
|
4
|
+
from typing import Optional
|
5
|
+
|
3
6
|
import httpx
|
4
|
-
import
|
5
|
-
import nest_asyncio
|
7
|
+
import nest_asyncio # type: ignore
|
6
8
|
|
7
9
|
# Apply nest_asyncio for environments like Jupyter
|
8
10
|
nest_asyncio.apply()
|
@@ -39,7 +41,7 @@ def get_credentials():
|
|
39
41
|
return {"username": username, "password": password}
|
40
42
|
|
41
43
|
|
42
|
-
async def async_validate_token(token: str = None) -> None:
|
44
|
+
async def async_validate_token(token: Optional[str] = None) -> None:
|
43
45
|
"""
|
44
46
|
Asynchronously validate a token by making a GET request to the validation endpoint.
|
45
47
|
|
@@ -103,7 +105,7 @@ async def async_validate_token(token: str = None) -> None:
|
|
103
105
|
raise TokenValidationError(f"An unexpected error occurred: {e}")
|
104
106
|
|
105
107
|
|
106
|
-
def validate_token(token: str = None) -> None:
|
108
|
+
def validate_token(token: Optional[str] = None) -> None:
|
107
109
|
"""
|
108
110
|
Synchronous wrapper for the `async_validate_token` function.
|
109
111
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import requests
|
2
|
-
import os
|
3
1
|
import json
|
2
|
+
import os
|
4
3
|
|
4
|
+
import requests
|
5
5
|
|
6
|
-
def build_token_payload(token: str, duration: int) -> dict:
|
7
6
|
|
7
|
+
def build_token_payload(token: str, duration: int) -> dict:
|
8
8
|
if os.getenv("JUPYTERHUB_USER", None) is None:
|
9
9
|
raise ValueError("JupyterHub user not found")
|
10
10
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|