Repository navigation
Move the shared CodeTailor helpers to common modules - #1632
Open
aspadiyath wants to merge 1 commit into
Open
aspadiyath wants to merge 1 commit into
aspadiyath wants to merge 1 commit into
Conversation
No behavior change. Explain in Plain English questions (RunestoneInteractive#1627) need the same question, token and JOBE plumbing CodeTailor has, so move it out of coach.py and evaluate_fixed_code.py: - activecode_questions.py: a question's starter code, tests and data files, plus find_question (base course first, then a global match) and question_test_code (question_json.suffix_code or the textarea tests) - openai_token.py: the course's OpenAI token and the dev-course key - jobe.py: the JOBE session, data file upload, and load_and_run_tests, now split around run_python_program, which returns a run's output Adds tests for the moved helpers, which had none. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of the five PRs proposed in #1627 (Explain in Plain English questions). It moves the CodeTailor plumbing EiPE will reuse out of
coach.pyandevaluate_fixed_code.pyinto three modules inbook_server_api/. No behavior change.activecode_questions.pyclean_python_testcase, the activecode marker parsing,starter_code_from_question,extract_suffix_code_from_htmlsrc,data_file_candidates,fetch_data_files. Two new helpers replace code that was inline incoach.py:find_question(base course first, then a global name match) andquestion_test_code(question_json.suffix_code, else the tests in the textarea).openai_token.pyDEV_API_KEY, the dev-course check, andfetch_openai_token(course)jobe.pyload_and_run_tests. That function is now split aroundrun_python_program, which returns a run's stdout and stderr.The helpers lose their leading underscores, because other modules now import them. The Java runner and the rest of
evaluate_fixed_code.pystay where they are.Things a reviewer might notice:
CodeTailor:, becausefind_questionisn't specific to CodeTailor any more.parsons_scaffoldingnow makes one global question lookup where it used to make the same lookup twice.Tests: added
test_activecode_questions.pyfor the moved helpers, which had no tests. It covers starter-code and test splitting, data file candidates, and howload_and_run_testsreads JOBE output. Existing CodeTailor tests pass. The book server app imports cleanly.🤖 Generated with Claude Code