PyKubeGrader 0.2.6__tar.gz → 0.2.7__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {pykubegrader-0.2.6/src/PyKubeGrader.egg-info → pykubegrader-0.2.7}/PKG-INFO +2 -1
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/setup.cfg +1 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7/src/PyKubeGrader.egg-info}/PKG-INFO +2 -1
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/PyKubeGrader.egg-info/SOURCES.txt +1 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/PyKubeGrader.egg-info/requires.txt +1 -0
- pykubegrader-0.2.7/src/pykubegrader/submit/submit_assignment.py +80 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/.coveragerc +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/.github/workflows/main.yml +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/.gitignore +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/.readthedocs.yml +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/AUTHORS.rst +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/CHANGELOG.rst +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/CONTRIBUTING.rst +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/LICENSE.txt +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/README.rst +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/docs/Makefile +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/docs/_static/Drexel_blue_Logo_square_Dark.png +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/docs/_static/Drexel_blue_Logo_square_Light.png +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/docs/_static/custom.css +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/docs/authors.rst +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/docs/changelog.rst +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/docs/conf.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/docs/contributing.rst +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/docs/index.rst +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/docs/license.rst +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/docs/readme.rst +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/docs/requirements.txt +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/examples/.responses.json +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/examples/true_false.ipynb +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/pyproject.toml +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/setup.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/PyKubeGrader.egg-info/dependency_links.txt +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/PyKubeGrader.egg-info/entry_points.txt +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/PyKubeGrader.egg-info/not-zip-safe +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/PyKubeGrader.egg-info/top_level.txt +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/__init__.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/build/__init__.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/build/api_notebook_builder.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/build/build_folder.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/build/clean_folder.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/graders/__init__.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/graders/late_assignments.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/initialize.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/log_parser/__init__.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/log_parser/parse.ipynb +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/log_parser/parse.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/telemetry.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/utils.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/validate.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/widgets/__init__.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/widgets/multiple_choice.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/widgets/reading_question.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/widgets/select_many.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/widgets/student_info.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/widgets/style.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/widgets/true_false.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/widgets/types_question.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/widgets_base/__init__.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/widgets_base/multi_select.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/widgets_base/reading.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/src/pykubegrader/widgets_base/select.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/tests/conftest.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/tests/import_test.py +0 -0
- {pykubegrader-0.2.6 → pykubegrader-0.2.7}/tox.ini +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: PyKubeGrader
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.7
|
4
4
|
Summary: Add a short description here!
|
5
5
|
Home-page: https://github.com/pyscaffold/pyscaffold/
|
6
6
|
Author: jagar2
|
@@ -28,6 +28,7 @@ Requires-Dist: types-python-dateutil
|
|
28
28
|
Requires-Dist: types-pyyaml
|
29
29
|
Requires-Dist: types-requests
|
30
30
|
Requires-Dist: types-setuptools
|
31
|
+
Requires-Dist: httpx
|
31
32
|
Provides-Extra: testing
|
32
33
|
Requires-Dist: setuptools; extra == "testing"
|
33
34
|
Requires-Dist: pytest; extra == "testing"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: PyKubeGrader
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.7
|
4
4
|
Summary: Add a short description here!
|
5
5
|
Home-page: https://github.com/pyscaffold/pyscaffold/
|
6
6
|
Author: jagar2
|
@@ -28,6 +28,7 @@ Requires-Dist: types-python-dateutil
|
|
28
28
|
Requires-Dist: types-pyyaml
|
29
29
|
Requires-Dist: types-requests
|
30
30
|
Requires-Dist: types-setuptools
|
31
|
+
Requires-Dist: httpx
|
31
32
|
Provides-Extra: testing
|
32
33
|
Requires-Dist: setuptools; extra == "testing"
|
33
34
|
Requires-Dist: pytest; extra == "testing"
|
@@ -46,6 +46,7 @@ src/pykubegrader/graders/late_assignments.py
|
|
46
46
|
src/pykubegrader/log_parser/__init__.py
|
47
47
|
src/pykubegrader/log_parser/parse.ipynb
|
48
48
|
src/pykubegrader/log_parser/parse.py
|
49
|
+
src/pykubegrader/submit/submit_assignment.py
|
49
50
|
src/pykubegrader/widgets/__init__.py
|
50
51
|
src/pykubegrader/widgets/multiple_choice.py
|
51
52
|
src/pykubegrader/widgets/reading_question.py
|
@@ -0,0 +1,80 @@
|
|
1
|
+
import os
|
2
|
+
import httpx
|
3
|
+
import asyncio
|
4
|
+
|
5
|
+
|
6
|
+
def get_credentials():
|
7
|
+
"""
|
8
|
+
Fetch the username and password from environment variables.
|
9
|
+
"""
|
10
|
+
username = os.getenv("user_name_student")
|
11
|
+
password = os.getenv("keys_student")
|
12
|
+
if not username or not password:
|
13
|
+
raise ValueError(
|
14
|
+
"Environment variables 'user_name_student' or 'keys_student' are not set."
|
15
|
+
)
|
16
|
+
return {"username": username, "password": password}
|
17
|
+
|
18
|
+
|
19
|
+
async def call_score_assignment(
|
20
|
+
assignment_title: str, file_path: str = ".output_reduced.log"
|
21
|
+
) -> dict:
|
22
|
+
"""
|
23
|
+
Submit an assignment to the scoring endpoint.
|
24
|
+
|
25
|
+
Args:
|
26
|
+
assignment_title (str): Title of the assignment.
|
27
|
+
file_path (str): Path to the log file to upload.
|
28
|
+
|
29
|
+
Returns:
|
30
|
+
dict: JSON response from the server.
|
31
|
+
"""
|
32
|
+
# Fetch the endpoint URL from environment variables
|
33
|
+
base_url = os.getenv("DB_URL")
|
34
|
+
if not base_url:
|
35
|
+
raise ValueError("Environment variable 'DB_URL' is not set.")
|
36
|
+
url = f"{base_url}score-assignment"
|
37
|
+
|
38
|
+
# Get credentials
|
39
|
+
credentials = get_credentials()
|
40
|
+
|
41
|
+
# Send the POST request
|
42
|
+
async with httpx.AsyncClient() as client:
|
43
|
+
try:
|
44
|
+
with open(file_path, "rb") as file:
|
45
|
+
response = await client.post(
|
46
|
+
url,
|
47
|
+
data={"cred": credentials, "assignment_title": assignment_title},
|
48
|
+
files={"log_file": file},
|
49
|
+
)
|
50
|
+
|
51
|
+
# Handle the response
|
52
|
+
response.raise_for_status() # Raise an exception for HTTP errors
|
53
|
+
response_data = response.json()
|
54
|
+
return response_data
|
55
|
+
except FileNotFoundError:
|
56
|
+
raise FileNotFoundError(f"The file {file_path} does not exist.")
|
57
|
+
except httpx.RequestError as e:
|
58
|
+
raise RuntimeError(f"An error occurred while requesting {url}: {e}")
|
59
|
+
except Exception as e:
|
60
|
+
raise RuntimeError(f"An unexpected error occurred: {e}")
|
61
|
+
|
62
|
+
|
63
|
+
# Importable function
|
64
|
+
def submit_assignment(
|
65
|
+
assignment_title: str, file_path: str = ".output_reduced.log"
|
66
|
+
) -> None:
|
67
|
+
"""
|
68
|
+
Synchronous wrapper for the `call_score_assignment` function.
|
69
|
+
|
70
|
+
Args:
|
71
|
+
assignment_title (str): Title of the assignment.
|
72
|
+
file_path (str): Path to the log file to upload.
|
73
|
+
"""
|
74
|
+
response = asyncio.run(call_score_assignment(assignment_title, file_path))
|
75
|
+
print("Server Response:", response.get("message", "No message in response"))
|
76
|
+
|
77
|
+
|
78
|
+
# Example usage (remove this section if only the function needs to be importable):
|
79
|
+
if __name__ == "__main__":
|
80
|
+
submit_assignment("Week 1 Assignment", "path/to/your/log_file.txt")
|
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
|
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
|