PyKubeGrader 0.2.23__tar.gz → 0.2.25__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/.github/workflows/main.yml +25 -7
  2. {pykubegrader-0.2.23/src/PyKubeGrader.egg-info → pykubegrader-0.2.25}/PKG-INFO +1 -1
  3. {pykubegrader-0.2.23 → pykubegrader-0.2.25/src/PyKubeGrader.egg-info}/PKG-INFO +1 -1
  4. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/build/build_folder.py +39 -8
  5. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/.coveragerc +0 -0
  6. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/.gitignore +0 -0
  7. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/.readthedocs.yml +0 -0
  8. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/AUTHORS.rst +0 -0
  9. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/CHANGELOG.rst +0 -0
  10. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/CONTRIBUTING.rst +0 -0
  11. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/LICENSE.txt +0 -0
  12. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/README.rst +0 -0
  13. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/docs/Makefile +0 -0
  14. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/docs/_static/Drexel_blue_Logo_square_Dark.png +0 -0
  15. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/docs/_static/Drexel_blue_Logo_square_Light.png +0 -0
  16. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/docs/_static/custom.css +0 -0
  17. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/docs/authors.rst +0 -0
  18. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/docs/changelog.rst +0 -0
  19. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/docs/conf.py +0 -0
  20. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/docs/contributing.rst +0 -0
  21. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/docs/index.rst +0 -0
  22. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/docs/license.rst +0 -0
  23. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/docs/readme.rst +0 -0
  24. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/docs/requirements.txt +0 -0
  25. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/examples/.responses.json +0 -0
  26. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/examples/true_false.ipynb +0 -0
  27. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/pyproject.toml +0 -0
  28. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/setup.cfg +0 -0
  29. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/setup.py +0 -0
  30. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/PyKubeGrader.egg-info/SOURCES.txt +0 -0
  31. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/PyKubeGrader.egg-info/dependency_links.txt +0 -0
  32. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/PyKubeGrader.egg-info/entry_points.txt +0 -0
  33. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/PyKubeGrader.egg-info/not-zip-safe +0 -0
  34. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/PyKubeGrader.egg-info/requires.txt +0 -0
  35. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/PyKubeGrader.egg-info/top_level.txt +0 -0
  36. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/__init__.py +0 -0
  37. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/build/__init__.py +0 -0
  38. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/build/api_notebook_builder.py +0 -0
  39. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/build/clean_folder.py +0 -0
  40. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/graders/__init__.py +0 -0
  41. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/graders/late_assignments.py +0 -0
  42. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/initialize.py +0 -0
  43. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/log_parser/__init__.py +0 -0
  44. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/log_parser/parse.ipynb +0 -0
  45. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/log_parser/parse.py +0 -0
  46. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/submit/submit_assignment.py +0 -0
  47. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/telemetry.py +0 -0
  48. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/tokens/tokens.py +0 -0
  49. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/tokens/validate_token.py +0 -0
  50. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/utils.py +0 -0
  51. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/validate.py +0 -0
  52. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/widgets/__init__.py +0 -0
  53. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/widgets/multiple_choice.py +0 -0
  54. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/widgets/reading_question.py +0 -0
  55. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/widgets/select_many.py +0 -0
  56. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/widgets/student_info.py +0 -0
  57. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/widgets/style.py +0 -0
  58. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/widgets/true_false.py +0 -0
  59. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/widgets/types_question.py +0 -0
  60. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/widgets_base/__init__.py +0 -0
  61. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/widgets_base/multi_select.py +0 -0
  62. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/widgets_base/reading.py +0 -0
  63. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/src/pykubegrader/widgets_base/select.py +0 -0
  64. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/tests/conftest.py +0 -0
  65. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/tests/import_test.py +0 -0
  66. {pykubegrader-0.2.23 → pykubegrader-0.2.25}/tox.ini +0 -0
@@ -2,20 +2,22 @@ name: CI/CD
2
2
 
3
3
  on:
4
4
  push:
5
- branches:
6
- - main
7
- pull_request:
8
- branches:
9
- - main
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: Checkout code
18
- uses: actions/checkout@v3
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyKubeGrader
3
- Version: 0.2.23
3
+ Version: 0.2.25
4
4
  Summary: Add a short description here!
5
5
  Home-page: https://github.com/pyscaffold/pyscaffold/
6
6
  Author: jagar2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyKubeGrader
3
- Version: 0.2.23
3
+ Version: 0.2.25
4
4
  Summary: Add a short description here!
5
5
  Home-page: https://github.com/pyscaffold/pyscaffold/
6
6
  Author: jagar2
@@ -60,6 +60,7 @@ class NotebookProcessor:
60
60
  verbose: bool = False
61
61
  log: bool = True
62
62
  require_key: bool = False
63
+ bonus_points: float = 0
63
64
 
64
65
  def __post_init__(self):
65
66
  """
@@ -80,6 +81,7 @@ class NotebookProcessor:
80
81
  assignment = data.get("assignment", {})
81
82
  week_num = assignment.get("week")
82
83
  self.assignment_type = assignment.get("assignment_type")
84
+ self.bonus_points = assignment.get("bonus_points", 0)
83
85
  else:
84
86
  self.assignment_type = self.assignment_tag.split("-")[0].lower()
85
87
  week_num = self.assignment_tag.split("-")[-1]
@@ -218,7 +220,6 @@ class NotebookProcessor:
218
220
  print(f"Error parsing due_date: {e}")
219
221
 
220
222
  title = f"Week {week} - {assignment_type}"
221
-
222
223
  # Return the extracted details as a dictionary
223
224
  return {
224
225
  "title": title,
@@ -226,7 +227,7 @@ class NotebookProcessor:
226
227
  "week_number": week,
227
228
  "assignment_type": assignment_type,
228
229
  "due_date": due_date,
229
- "max_score": int(self.assignment_total_points),
230
+ "max_score": self.assignment_total_points - self.bonus_points,
230
231
  }
231
232
 
232
233
  def build_payload_notebook(self, yaml_content, notebook_title, total_points):
@@ -575,7 +576,7 @@ class NotebookProcessor:
575
576
 
576
577
  if self.require_key:
577
578
  # Add an additional line for validate_token()
578
- validate_token_line = "from pykubegrader.submit.submit_assignment import validate_token\nvalidate_token()\n"
579
+ validate_token_line = "from pykubegrader.tokens.validate_token import validate_token\nvalidate_token()\n"
579
580
 
580
581
  # Define the Code cell
581
582
  code_cell = nbformat.v4.new_code_cell(
@@ -723,6 +724,38 @@ class NotebookProcessor:
723
724
  with open(notebook_path, "w", encoding="utf-8") as f:
724
725
  nbformat.write(notebook, f)
725
726
 
727
+ def add_validate_token_cell(notebook_path: str, require_key: bool) -> None:
728
+ """
729
+ Adds a new code cell at the top of a Jupyter notebook if require_key is True.
730
+
731
+ Args:
732
+ notebook_path (str): The path to the notebook file to modify.
733
+ require_key (bool): Whether to add the validate_token cell.
734
+
735
+ Returns:
736
+ None
737
+ """
738
+ if not require_key:
739
+ print("require_key is False. No changes made to the notebook.")
740
+ return
741
+
742
+ # Load the notebook
743
+ with open(notebook_path, "r", encoding="utf-8") as f:
744
+ notebook = nbformat.read(f, as_version=4)
745
+
746
+ # Create the new code cell
747
+ new_cell = nbformat.v4.new_code_cell(
748
+ "from pykubegrader.tokens.validate_token import validate_token\n"
749
+ "validate_token('type the key provided by your instructor here')\n"
750
+ )
751
+
752
+ # Add the new cell to the top of the notebook
753
+ notebook.cells.insert(0, new_cell)
754
+
755
+ # Save the modified notebook
756
+ with open(notebook_path, "w", encoding="utf-8") as f:
757
+ nbformat.write(notebook, f)
758
+
726
759
  @staticmethod
727
760
  def add_initialization_code(
728
761
  notebook_path, week, assignment_type, require_key=False
@@ -732,15 +765,13 @@ class NotebookProcessor:
732
765
  cell = cell["source"]
733
766
  import_text = "# You must make sure to run all cells in sequence using shift + enter or you might encounter errors\n"
734
767
  import_text += "from pykubegrader.initialize import initialize_assignment\n"
735
- if require_key:
736
- import_text += (
737
- "from pykubegrader.tokens.validate_token import validate_token\n"
738
- )
739
- import_text += "validate_token('type the key provided by your TA here')\n"
740
768
  import_text += f'\nresponses = initialize_assignment("{os.path.splitext(os.path.basename(notebook_path))[0]}", "{week}", "{assignment_type}" )\n'
741
769
  cell = f"{import_text}\n" + cell
742
770
  replace_cell_source(notebook_path, index, cell)
743
771
 
772
+ if require_key:
773
+ NotebookProcessor.add_validate_token_cell(notebook_path, require_key)
774
+
744
775
  def multiple_choice_parser(self, temp_notebook_path, new_notebook_path):
745
776
  ### Parse the notebook for multiple choice questions
746
777
  if self.has_assignment(temp_notebook_path, "# BEGIN MULTIPLE CHOICE"):
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes