pykubegrader package#
Subpackages#
- pykubegrader.build package
- Submodules
- pykubegrader.build.api_notebook_builder module
FastAPINotebookBuilderFastAPINotebookBuilder.add_api_code()FastAPINotebookBuilder.add_import_statements_to_tests()FastAPINotebookBuilder.add_points_to_notebook()FastAPINotebookBuilder.add_question_part_points_to_notebook()FastAPINotebookBuilder.add_question_points_to_notebook()FastAPINotebookBuilder.add_text_after_double_hash()FastAPINotebookBuilder.assignment_tagFastAPINotebookBuilder.compute_max_points_free_response()FastAPINotebookBuilder.conceal_tests()FastAPINotebookBuilder.construct_first_cell_question_header()FastAPINotebookBuilder.construct_graders()FastAPINotebookBuilder.construct_question_info()FastAPINotebookBuilder.construct_update_responses()FastAPINotebookBuilder.extract_assertion_test_source()FastAPINotebookBuilder.extract_first_cell()FastAPINotebookBuilder.extract_log_variables()FastAPINotebookBuilder.extract_question_information()FastAPINotebookBuilder.find_first_markdown_cell_with()FastAPINotebookBuilder.find_last_import_line()FastAPINotebookBuilder.find_question_description()FastAPINotebookBuilder.get_cell()FastAPINotebookBuilder.get_cell_source()FastAPINotebookBuilder.get_filename_and_root()FastAPINotebookBuilder.get_max_question_points()FastAPINotebookBuilder.get_question_points_by_part()FastAPINotebookBuilder.insert_list_at_index()FastAPINotebookBuilder.notebook_pathFastAPINotebookBuilder.question_dict()FastAPINotebookBuilder.read_notebook()FastAPINotebookBuilder.replace_cell_source()FastAPINotebookBuilder.require_keyFastAPINotebookBuilder.run()FastAPINotebookBuilder.split_list_at_marker()FastAPINotebookBuilder.tag_questions()FastAPINotebookBuilder.temp_notebookFastAPINotebookBuilder.verbose
- pykubegrader.build.build_folder module
NotebookProcessorNotebookProcessor.root_folderNotebookProcessor.assignment_tagNotebookProcessor.solutions_folderNotebookProcessor.verboseNotebookProcessor.logNotebookProcessor.add_assignment()NotebookProcessor.add_final_submission_cells()NotebookProcessor.add_initialization_code()NotebookProcessor.add_notebook()NotebookProcessor.add_submission_cells()NotebookProcessor.add_validate_block()NotebookProcessor.add_validate_token_cell()NotebookProcessor.assignment_tagNotebookProcessor.bonus_pointsNotebookProcessor.build_payload()NotebookProcessor.build_payload_notebook()NotebookProcessor.check_if_file_in_folder()NotebookProcessor.extract_MCQ()NotebookProcessor.free_response_parser()NotebookProcessor.generate_solution_MCQ()NotebookProcessor.has_assignment()NotebookProcessor.json_serial()NotebookProcessor.logNotebookProcessor.merge_metadata()NotebookProcessor.multiple_choice_parser()NotebookProcessor.process_notebooks()NotebookProcessor.remove_assignment_config_cells()NotebookProcessor.remove_empty_cells()NotebookProcessor.remove_postfix()NotebookProcessor.replace_temp_in_notebook()NotebookProcessor.replace_temp_no_otter()NotebookProcessor.require_keyNotebookProcessor.root_folderNotebookProcessor.run_otter_assign()NotebookProcessor.select_many_parser()NotebookProcessor.solutions_folderNotebookProcessor.true_false_parser()NotebookProcessor.update_initialize_function()NotebookProcessor.verbose
check_for_heading()clean_notebook()ensure_imports()extract_MCQ()extract_SELECT_MANY()extract_TF()extract_config_from_notebook()extract_files()extract_question()extract_raw_cells()find_first_code_cell()generate_mcq_file()generate_select_many_file()generate_tf_file()main()replace_cell_source()replace_cells_between_markers()sanitize_string()update_initialize_assignment()
- pykubegrader.build.clean_folder module
- pykubegrader.build.collate module
- pykubegrader.build.markdown_questions module
- Module contents
- pykubegrader.grade_reports namespace
- Submodules
- pykubegrader.grade_reports.assignments module
AssignmentAssignment.weekAssignment.exemptedAssignment.gradedAssignment.late_adjustmentAssignment.students_exemptedAssignment.due_dateAssignment.max_scoreAssignment.grade_adjustment_funcAssignment.add_exempted_students()Assignment.update_score()Assignment.grade_adjustment()Assignment.add_exempted_students()Assignment.check_cheater()Assignment.grade_adjustment()Assignment.update_score()
assignment_type
- pykubegrader.grade_reports.class_grade_report module
ClassGradeReportClassGradeReport.student_listClassGradeReport.all_student_grades_dfClassGradeReport.setup_class_grades()ClassGradeReport.update_student_grade()ClassGradeReport.fill_class_grades()ClassGradeReport.fill_class_grades()ClassGradeReport.get_class_stats()ClassGradeReport.make_report()ClassGradeReport.setup_class_grades()ClassGradeReport.update_student_grade()ClassGradeReport.write_excel_spreadsheet()
main()
- pykubegrader.grade_reports.grade_report module
GradeReportGradeReport.build_assignments()GradeReport.calculate_grades()GradeReport.check_optional_drop_assignments()GradeReport.color_cells()GradeReport.compute_final_average()GradeReport.determine_due_date()GradeReport.drop_lowest_n_for_types()GradeReport.duplicate_scores()GradeReport.filter_submissions()GradeReport.get_assignment()GradeReport.get_graded_assignment()GradeReport.get_max_score()GradeReport.get_non_weekly_assignments()GradeReport.get_num_weeks()GradeReport.get_weekly_assignments()GradeReport.graded_assignment_constructor()GradeReport.highlight_nans()GradeReport.setup_grades_df()GradeReport.update_assignments_not_due_yet()GradeReport.update_global_exempted_assignments()GradeReport.update_weekly_table()
- pykubegrader.grade_reports.grading_config module
- pykubegrader.graders package
- pykubegrader.log_parser package
- pykubegrader.submit namespace
- pykubegrader.tokens namespace
- pykubegrader.widgets package
- Submodules
- pykubegrader.widgets.multiple_choice module
- pykubegrader.widgets.question_processor module
- pykubegrader.widgets.reading_question module
- pykubegrader.widgets.select_many module
- pykubegrader.widgets.student_info module
- pykubegrader.widgets.style module
- pykubegrader.widgets.true_false module
- pykubegrader.widgets.types_question module
- Module contents
- pykubegrader.widgets_base package
Submodules#
pykubegrader.initialize module#
- pykubegrader.initialize.initialize_assignment(name: str, week: str, assignment_type: str, verbose: bool = False, assignment_points: float | None = None, assignment_tag: str | None = None) dict[source]#
Initialize an assignment in a Jupyter environment.
- Parameters:
- Returns:
The responses dictionary after initialization.
- Return type:
- Raises:
Exception – If the environment is unsupported or initialization fails.
- pykubegrader.initialize.move_dotfiles()[source]#
Move essential dotfiles from a fixed source directory to the current working directory.
- Raises:
FileNotFoundError – If a source file is missing.
Exception – If copying fails for any other reason.
pykubegrader.telemetry module#
- pykubegrader.telemetry.block_direct_notebook_calls(func)[source]#
Decorator to block direct calls to functions from Jupyter Notebooks.
This decorator checks if the current code is being executed directly from a Jupyter Notebook and raises an error if it is. This is useful to prevent accidental execution of grading functions from within the notebook environment.
- pykubegrader.telemetry.encrypt_to_b64(message: str) str[source]#
Encrypts a message using the server’s public key and the client’s private key.
- pykubegrader.telemetry.get_all_students(user, password)[source]#
Fetches a list of all students from the API and returns their usernames.
- Parameters:
- Returns:
A list of usernames extracted from the students’ email addresses.
- Return type:
- Raises:
requests.exceptions.HTTPError – If the HTTP request returned an unsuccessful status code.
- pykubegrader.telemetry.get_assignments_submissions(params=None)[source]#
Fetches assignment submissions for a student from the grading API. This function retrieves the assignment submissions for a student by making a GET request to the grading API. It requires certain environment variables to be set and validates the JupyterHub username. :param params: A dictionary of parameters to be sent in the query string. Defaults to None. If not provided, it will default to {“username”: <JUPYTERHUB_USER>}. :type params: dict, optional
- Raises:
ValueError – If necessary environment variables (student_user, student_pw, api_base_url) are not set.
ValueError – If there is a mismatch between the JupyterHub username from the hostname and the environment variable.
- Returns:
A dictionary containing the JSON response from the API with the assignment submissions.
- Return type:
- pykubegrader.telemetry.is_called_directly_from_notebook()[source]#
Checks if the current code is being executed directly from a Jupyter Notebook.
- Returns:
True if the code is being executed from a Jupyter Notebook, False otherwise.
- Return type:
- pykubegrader.telemetry.log_encrypted(logger: Logger, message: str) None[source]#
Logs an encrypted version of the given message using the provided logger.
pykubegrader.utils module#
pykubegrader.validate module#
- pykubegrader.validate.get_entries_len(data: list[str], question_number: int) int[source]#
function to get the unique entries by length
- pykubegrader.validate.read_logfile(filepath: str, key_box=None) tuple[list[str], list[str]][source]#