Skip to content

An initial try at integrating CodeTailor with Runestone #867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

xinyinghou
Copy link

Note:

  • This PR serves as an initial submission to provide a high-level overview and establish foundational code structure for future CodeTailor merge and integration. Expect further updates and detailed changes in future PRs.
  • What’s not covered in this PR:
    • The new API_token function is included, but it has not been tested due to pending frontend integration.
    • Java block-level personalization is not yet finalized, particularly the distractor logic.
    • Java puzzle block separation needs more detailed design
    • Integration with the assignment server is not yet implemented; a CSV file is still used for question input (an example is included as Question_Bank.csv).
    • Execution-based grading for Parsons puzzles is still in progress. Only the option_spec has been defined; the implementation code has not yet been added.
    • Copy button logs work correctly only when questions are shown on separate pages.

Changes Included:

Frontend: bases->rsptx->interactives->runestone

  • activecode
    • activecode.py: include CodeTailor-related TEMPLATE_END and option_spec
      • :solperpuzzle: -- use an LLM prompt to generate a solution-level personalized puzzle
      • :multiperpuzzle: -- use an LLM prompt to generate a multiple personalized puzzle
      • :commonparsons: -- generate a parsons puzzle from an example (common) solution
      • :pexecgrade: -- the scaffolding puzzle uses execution-based grading (ongoing, not included in this PR)
      • :noindent: -- the scaffolding puzzle should not require indentation
      • :adaptive: -- the scaffolding puzzle should be adaptive
    • activecode.js: include main frontend CodeTailor features such as the scaffolding window generation, get help, waiting bar, copy, see help again and more
  • parsons
    • parsons.py: include CodeTailor-related TEMPLATE_END and option_spec
      • :scaffolding: -- specify that this puzzle is used as a scaffolding puzzle
    • parsons.js + parsonsBlock.js + placeholderBlock.js + placeholderLine.js + settledBlock.js: functions to handle block-level personalization, such as pre-placing the student-written correct block in the answer area and inserting placeholders to indicate the relative positions of the remaining blocks.
    • parsonsLine.js: some lines for indentation settings (require further optimization)

Backend: bases->rsptx->book_server_api->routers

  • coach.py: Takes in a student's incorrect code and an API_token, generate a personalized Parsons puzzle, then returns the puzzle in .rst string.
  • personalized_parsons folder: The backend files to generate a personalized/example fixed solution from student incorrect code and generate its corresponding puzzle rst file

@xinyinghou xinyinghou requested a review from bnmnetp as a code owner July 7, 2025 07:34
Copy link
Member

@bnmnetp bnmnetp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've done a quick look and left some initial comments in some of the files, and have a few higher level questions below:

  1. This is a BIG PR. I need some instructions on how to use/test the new features.
  2. What steps have you taken to ensure that activecode and parsons continue to work as they have in the past after your changes are applied?
  3. Have you tested this in a Docker container? I'm guessing you have not based on the use of the requirements.txt file.
  4. More documentation of the code is needed. Someone is going to have to maintain this in the future.

Tagging @barbarer

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not use requirements.txt any additional dependencies should be added to the pyproject.toml file for the book_server project with poetry. It needs to handle all of the dependencies.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the requirements.txt file and migrated all necessary dependencies to the pyproject.toml file under projects>book_server.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file really needed? I see this and several other .csv files and some .txt files.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RST markup code has been deprecated for some time. How will we use these automatically generated parsons problems in PreTeXt books?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants