PyKubeGrader 0.3.6__py3-none-any.whl → 0.3.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: PyKubeGrader
3
- Version: 0.3.6
3
+ Version: 0.3.8
4
4
  Summary: Add a short description here!
5
5
  Home-page: https://github.com/pyscaffold/pyscaffold/
6
6
  Author: jagar2
@@ -1,22 +1,23 @@
1
1
  pykubegrader/__init__.py,sha256=AoAkdfIjDDZGWLlsIRENNq06L9h46kDGBIE8vRmsCfg,311
2
2
  pykubegrader/grading_tester.ipynb,sha256=wwT9jyhpR6GGM8r4todaGfrsUxS6JxM0qIqMcDYKM7w,18839
3
3
  pykubegrader/initialize.py,sha256=Bwu1q18l18FB9lGppvt-L41D5gzr3S8t6zC0_UbrASw,3994
4
- pykubegrader/telemetry.py,sha256=vZK9p3XqnqacwtiVyZgjI2mcIr5ZcxRRwW5sAZsrJkE,16631
4
+ pykubegrader/telemetry.py,sha256=oFw27YfTLYZvn7iZKh4jzYXjD726MuUoIQ-9twbXxXk,16632
5
5
  pykubegrader/utils.py,sha256=jlJklKvRhY3O7Hz2aaU1m0y3p_n9eMAXNnAF7LUEaPY,1275
6
6
  pykubegrader/validate.py,sha256=OKnItGyd-L8QPKcsE0KRuwBI_IxKiJzMLJKZiA2j3II,11184
7
7
  pykubegrader/build/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
8
8
  pykubegrader/build/api_notebook_builder.py,sha256=EZG4Ow4YATzOWPPNLkdQEdWt7hkpbaI5ZD1Bf2KEWeY,25622
9
- pykubegrader/build/build_folder.py,sha256=9aewc4dcYKS5kNaDS3gTwCnzRTmHT6Ooio5TF258q_8,86963
9
+ pykubegrader/build/build_folder.py,sha256=HDccW597shBhAd-jxvMUPpsiNj2S4DlKRGMDH_6U9nQ,87590
10
10
  pykubegrader/build/clean_folder.py,sha256=8N0KyL4eXRs0DCw-V_2jR9igtFs_mOFMQufdL6tD-38,1323
11
11
  pykubegrader/build/collate.py,sha256=cVvF7tf2U3iiH4R_dbghTcieedIx5w3Fyw9L_llInM8,6754
12
12
  pykubegrader/build/markdown_questions.py,sha256=cSh8mkHK3hh-etJdgrZu9UQi1WPrKQtofkzLCUp1Z-w,4676
13
+ pykubegrader/grade_reports/get_my_grades_testing.py,sha256=JNgaHK1eMDPxJASrPpIcXxwMYE0kB0r4p5EgD6GICl4,2359
13
14
  pykubegrader/grade_reports/grade_reports.py,sha256=n8H_n9jdZRSPn2zlIf-GQt_Y8w91p6M8ZbdVH76Sg5k,2303
14
15
  pykubegrader/graders/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
15
16
  pykubegrader/graders/late_assignments.py,sha256=_2-rA5RqO0BWY9WAQA_mbCxxPKTOiJOl-byD2CYWaE0,1393
16
17
  pykubegrader/log_parser/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
17
18
  pykubegrader/log_parser/parse.ipynb,sha256=5e-9dzUbJk2M8kPP55lVeksm86lSY5ocKfWOP2RSWH0,11921
18
19
  pykubegrader/log_parser/parse.py,sha256=dXzTEOTI6VTRNoHFDAjg6hZUhvB3kHtMb10_KW3NPrw,7641
19
- pykubegrader/submit/submit_assignment.py,sha256=cqVu7US8GVaCdJdaU2yjawlVBtAKP5XJc4oAvX5FeRU,2575
20
+ pykubegrader/submit/submit_assignment.py,sha256=EJkdADfihojJxAPZEmEiEEg1Vo-FBFHHEjAGzSmK5UA,2660
20
21
  pykubegrader/tokens/token_panel.py,sha256=NNA5ZV3Q9jB_lz2aSwMyViXV0ESu6V_7T92Qji7UpSQ,1377
21
22
  pykubegrader/tokens/tokens.py,sha256=qcYMFgNPimbfeS7lXOtbgquGgeJCgOGx5hvXewIs0oQ,1474
22
23
  pykubegrader/tokens/validate_token.py,sha256=kvHX0NJBm21xzb2p67j7vq1La6J1XbmobEJQ3fTMdZA,3289
@@ -33,9 +34,9 @@ pykubegrader/widgets_base/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-
33
34
  pykubegrader/widgets_base/multi_select.py,sha256=KtfAP0PyEbcjWlKNpI5_5-PLMtcUbbNX0Es_-w-H34Q,4226
34
35
  pykubegrader/widgets_base/reading.py,sha256=ChUS3NOTa_HLtNpxR8hGX80LPKMvYMypnR6dFknfxus,5430
35
36
  pykubegrader/widgets_base/select.py,sha256=uMncmVIqjvJkffMQY1L_PokrFCidK1PeVITX0i70fho,2750
36
- PyKubeGrader-0.3.6.dist-info/LICENSE.txt,sha256=YTp-Ewc8Kems8PJEE27KnBPFnZSxoWvSg7nnknzPyYw,1546
37
- PyKubeGrader-0.3.6.dist-info/METADATA,sha256=RVMHbbz9895jEBhpogU7TM5keqyf-kUKhKJhJ1Hk168,2729
38
- PyKubeGrader-0.3.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
39
- PyKubeGrader-0.3.6.dist-info/entry_points.txt,sha256=RR57KvzDRJrP4omy5heS5cZ3E7g56YxcxJhDnp57ZU0,253
40
- PyKubeGrader-0.3.6.dist-info/top_level.txt,sha256=e550Klfze6higFxER1V62fnGOcIgiKRbsrl9CC4UdtQ,13
41
- PyKubeGrader-0.3.6.dist-info/RECORD,,
37
+ PyKubeGrader-0.3.8.dist-info/LICENSE.txt,sha256=YTp-Ewc8Kems8PJEE27KnBPFnZSxoWvSg7nnknzPyYw,1546
38
+ PyKubeGrader-0.3.8.dist-info/METADATA,sha256=qrucw04y1mZfpYfKihEEtqTjQ9SLh5YKDgBA_GNQJ2s,2729
39
+ PyKubeGrader-0.3.8.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
40
+ PyKubeGrader-0.3.8.dist-info/entry_points.txt,sha256=RR57KvzDRJrP4omy5heS5cZ3E7g56YxcxJhDnp57ZU0,253
41
+ PyKubeGrader-0.3.8.dist-info/top_level.txt,sha256=e550Klfze6higFxER1V62fnGOcIgiKRbsrl9CC4UdtQ,13
42
+ PyKubeGrader-0.3.8.dist-info/RECORD,,
@@ -578,7 +578,7 @@ class NotebookProcessor:
578
578
 
579
579
  if self.require_key:
580
580
  # Add an additional line for validate_token()
581
- validate_token_line = "from pykubegrader.tokens.validate_token import validate_token\nvalidate_token()\n"
581
+ validate_token_line =f"from pykubegrader.tokens.validate_token import validate_token\nvalidate_token(assignment = '{self.assignment_tag}')\n"
582
582
 
583
583
  # Define the Code cell
584
584
  code_cell = nbformat.v4.new_code_cell(
@@ -681,6 +681,7 @@ class NotebookProcessor:
681
681
  self.week,
682
682
  self.assignment_type,
683
683
  require_key=self.require_key,
684
+ assignment_tag = self.assignment_tag,
684
685
  )
685
686
 
686
687
  NotebookProcessor.replace_temp_in_notebook(
@@ -711,6 +712,7 @@ class NotebookProcessor:
711
712
  self.week,
712
713
  self.assignment_type,
713
714
  require_key=self.require_key,
715
+ assignment_tag = self.assignment_tag
714
716
  )
715
717
  NotebookProcessor.replace_temp_no_otter(
716
718
  temp_notebook_path, temp_notebook_path
@@ -742,7 +744,7 @@ class NotebookProcessor:
742
744
  nbformat.write(notebook, f)
743
745
 
744
746
  @staticmethod
745
- def add_validate_token_cell(notebook_path: str, require_key: bool) -> None:
747
+ def add_validate_token_cell(notebook_path: str, require_key: bool, **kwargs) -> None:
746
748
  """
747
749
  Adds a new code cell at the top of a Jupyter notebook if require_key is True.
748
750
 
@@ -756,18 +758,24 @@ class NotebookProcessor:
756
758
  if not require_key:
757
759
  print("require_key is False. No changes made to the notebook.")
758
760
  return
759
-
760
- NotebookProcessor.add_validate_block(notebook_path, require_key)
761
+
762
+ NotebookProcessor.add_validate_block(notebook_path, require_key, assignment_tag = kwargs.get("assignment_tag", None))
761
763
 
762
764
  # Load the notebook
763
765
  with open(notebook_path, "r", encoding="utf-8") as f:
764
766
  notebook = nbformat.read(f, as_version=4)
765
767
 
766
768
  # Create the new code cell
767
- new_cell = nbformat.v4.new_code_cell(
769
+ if kwargs.get("assignment_tag", None):
770
+ new_cell = nbformat.v4.new_code_cell(
771
+ "from pykubegrader.tokens.validate_token import validate_token\n"
772
+ f"validate_token('type the key provided by your instructor here', assignment = '{kwargs.get('assignment_tag')}')\n"
773
+ )
774
+ else:
775
+ new_cell = nbformat.v4.new_code_cell(
768
776
  "from pykubegrader.tokens.validate_token import validate_token\n"
769
777
  "validate_token('type the key provided by your instructor here')\n"
770
- )
778
+ )
771
779
 
772
780
  # Add the new cell to the top of the notebook
773
781
  notebook.cells.insert(0, new_cell)
@@ -777,7 +785,7 @@ class NotebookProcessor:
777
785
  nbformat.write(notebook, f)
778
786
 
779
787
  @staticmethod
780
- def add_validate_block(notebook_path: str, require_key: bool) -> None:
788
+ def add_validate_block(notebook_path: str, require_key: bool, **kwargs) -> None:
781
789
  """
782
790
  Modifies the first code cell of a Jupyter notebook to add the validate_token call if require_key is True.
783
791
 
@@ -811,7 +819,7 @@ class NotebookProcessor:
811
819
 
812
820
  @staticmethod
813
821
  def add_initialization_code(
814
- notebook_path, week, assignment_type, require_key=False
822
+ notebook_path, week, assignment_type, require_key=False, **kwargs,
815
823
  ):
816
824
  # finds the first code cell
817
825
  index, cell = find_first_code_cell(notebook_path)
@@ -823,7 +831,7 @@ class NotebookProcessor:
823
831
  replace_cell_source(notebook_path, index, cell)
824
832
 
825
833
  if require_key:
826
- NotebookProcessor.add_validate_token_cell(notebook_path, require_key)
834
+ NotebookProcessor.add_validate_token_cell(notebook_path, require_key, assignment_tag = kwargs.get("assignment_tag", None))
827
835
 
828
836
  def multiple_choice_parser(self, temp_notebook_path, new_notebook_path):
829
837
  ### Parse the notebook for multiple choice questions
@@ -0,0 +1,79 @@
1
+
2
+
3
+ # ##### CONFIGURATION #####
4
+
5
+ # weights = {
6
+ # "homework": 0.15,
7
+ # "lab": 0.15,
8
+ # "lecture": 0.15,
9
+ # "quiz": 0.15,
10
+ # "readings": 0.15,
11
+ # "labattendance": 0.05,
12
+ # "practicequiz": 0.015,
13
+ # "practicemidterm": 0.015,
14
+ # "midterm": 0.15,
15
+ # "practicefinal": 0.02,
16
+ # "final": 0.2,
17
+ # }
18
+
19
+ # ##### END CONFIGURATION #####
20
+
21
+
22
+ # class GradeReport:
23
+
24
+ # def __init__(self, start_date="2025-01-06", verbose=True):
25
+ # self.start_date = start_date
26
+ # self.verbose = verbose
27
+ # self.weights = weights
28
+
29
+ # self.assignments, self.student_subs = get_assignments_submissions()
30
+ # self.new_grades_df = setup_grades_df(self.assignments)
31
+ # self.new_weekly_grades = fill_grades_df(
32
+ # self.new_grades_df, self.assignments, self.student_subs
33
+ # )
34
+ # self.current_week = get_current_week(self.start_date)
35
+ # self.avg_grades_dict = get_average_weighted_grade(
36
+ # self.assignments, self.current_week, self.new_weekly_grades, self.weights
37
+ # )
38
+
39
+ # @property
40
+ # def weights(self):
41
+ # return self.weights
42
+
43
+
44
+ # def get_my_grades_testing(start_date="2025-01-06", verbose=True):
45
+ # """takes in json.
46
+ # reshapes columns into reading, lecture, practicequiz, quiz, lab, attendance, homework, exam, final.
47
+ # fills in 0 for missing assignments
48
+ # calculate running average of each category"""
49
+
50
+ # # set up new df format
51
+ # weights = {
52
+ # "homework": 0.15,
53
+ # "lab": 0.15,
54
+ # "lecture": 0.15,
55
+ # "quiz": 0.15,
56
+ # "readings": 0.15,
57
+ # # 'midterm':0.15, 'final':0.2
58
+ # "labattendance": 0.05,
59
+ # "practicequiz": 0.05,
60
+ # }
61
+
62
+ # assignments, student_subs = get_assignments_submissions()
63
+
64
+ # new_grades_df = setup_grades_df(assignments)
65
+
66
+ # new_weekly_grades = fill_grades_df(new_grades_df, assignments, student_subs)
67
+
68
+ # current_week = get_current_week(start_date)
69
+
70
+ # avg_grades_dict = get_average_weighted_grade(
71
+ # assignments, current_week, new_weekly_grades, weights
72
+ # )
73
+
74
+ # if verbose:
75
+ # max_key_length = max(len(k) for k in weights.keys())
76
+ # for k, v in avg_grades_dict.items():
77
+ # print(f"{k:<{max_key_length}}:\t {v:.2f}")
78
+
79
+ # return new_weekly_grades # get rid of test and running avg columns
@@ -42,6 +42,10 @@ def call_score_assignment(
42
42
  "assignment_title": assignment_title,
43
43
  "notebook_title": notebook_title,
44
44
  }
45
+
46
+ token = os.getenv("TOKEN")
47
+ if token:
48
+ params["key_used"] = token
45
49
 
46
50
  username, password = get_credentials().values()
47
51
 
pykubegrader/telemetry.py CHANGED
@@ -454,6 +454,7 @@ def get_my_grades_testing(start_date="2025-01-06", verbose=True):
454
454
  print(f'{k:<{max_key_length}}:\t {v:.2f}')
455
455
 
456
456
  return new_weekly_grades # get rid of test and running avg columns
457
+
457
458
  def get_all_students(admin_user, admin_pw):
458
459
  res = requests.get(
459
460
  url=api_base_url.rstrip("/") + "/students",