kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Run and edit Khan Academy Python programs offline

Open rtibbles opened this issue 2 weeks ago • 3 comments

Overview

Khan Academy (KA) Python programs reach learners as standalone programs in the computing topic and through python-program widgets in Perseus items. The KA content integration skips the topic, and the widgets load their programs from khanacademy.org. This tracking issue covers running, editing and scoring these programs offline.

Scope

  • Standalone Python programs in the computing topic, and programs in python-program widgets.
  • An offline Python runtime, shipped as a shared html5_dependency.
  • The content integration in kolibri-library, and rendering, editing, saving learner edits and scoring in Kolibri.

Guidance

  • The Perseus python-program widget shows the khanacademy.org URL each program loads from.

Strategy

  • The runtime is upstream Pyodide with only the standard library, as KA ships it (KA's build: 0.26.3, Python 3.12.7). It ships with a CodeMirror 6 editor, which KA's Python page also uses, and a test runner that runs each step's unittest modules as KA's does. All three ship as one shared html5_dependency of about 14 MB.
  • Standalone Challenges and Projects become HTML5 nodes whose bootstrap loads the runtime with dependencyUrl(). Widget programs go into .perseus archives, and an embedded ContentViewer receives them through requestData().
  • Pyodide is tested on Chrome and Firefox 112+ and Safari 16.4+, above Kolibri's floor of Chrome 49, Firefox 52 and Safari 11.1. Python programs need a "not supported in this browser" state.
  • KA's export has no challenge code, instructions or tests. Fetching them needs a LearningEquality_* query from KA, like the existing LearningEquality_assessmentItems.

Acceptance Criteria

  • [ ] A KA channel includes the standalone Python programs from the computing topic, and each runs offline.
  • [ ] python-program widgets run their program offline, with no standin.
  • [ ] Learners can edit any Python program, and each program's edits persist across sessions.
  • [ ] Graded Python programs score in Kolibri.
  • [ ] A device stores the Python runtime once, however many programs use it.

AI usage

I scoped this to follow #15940's approach and asked for the runtime to be investigated before writing the children. Claude Code read KA's production bundles and content export to find the runtime, editor, test runner and course contents, and drafted the sections with me.

rtibbles avatar Nov 18 '26 21:11 rtibbles

Replaced the Strategy with the investigation results: the runtime (upstream Pyodide, standard library only, as KA ships it), CodeMirror 6 for the editor, a unittest step runner, the browser floor gap, and the KA query needed for challenge content. Updated the Overview and AI usage to match.

rtibbles avatar Nov 18 '26 22:11 rtibbles

@rtibbles can you assign this issue for me /assign

ArpitaSamanta10 avatar Nov 20 '26 12:11 ArpitaSamanta10

Hi! 👋

Thanks so much for your interest! This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues. If there are no unassigned 'help wanted' issues available, please wait until new ones are added.

We really appreciate your willingness to help. 😊

Are you preparing for Google Summer of Code? See our GSoC guidelines.

learning-equality-bot avatar Nov 20 '26 12:11 learning-equality-bot