mirror of
https://github.com/deunix-educ/PyQuest.git
synced 2026-11-25 08:19:44 +01:00
a4df92a7c6
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2.5 KiB
2.5 KiB
Architecture
Overview
┌───────────────────────────── Browser ──────────────────────────────┐
│ Interface (ES modules) ──► Worker client ◄──► Web Worker │
│ │ Pyodide / CPython │
│ ▼ │ │
│ IndexedDB: progress, settings persistent data/ │
└────────┬───────────────────────────────────────────────────────────┘
│ reads (optional)
▼ ▼
levels/*.yaml + JSON schema Django backend /api/sync/
The application is self-contained: everything runs in the browser. The backend is only an optional store for progress.
Key decisions
- Python engine: Pyodide (real CPython in WebAssembly): faithful error messages, complete standard library. It runs in a Web Worker so the interface never freezes.
- Interruption through a
SharedArrayBuffer(Python's SIGINT): needs an isolated site (COOP/COEP), hence a Pyodide served from the same domain.input()also uses aSharedArrayBuffer. - Declarative levels: YAML validated by JSON Schema; validating an exercise goes through a closed list of test types, never through code coming from the level.
- JavaScript: ES2022 classes and native modules, no framework.
- Files: only
data/is mounted on IndexedDB (IDBFS) and survives sessions. - Drawing: the
canvasmodule records lines returned with the run result; the interface displays them and thedrawing_*tests examine them. - Narration: pre-generated mp3 files (Piper, build tool only), falling back to the system voice.
What lives where
| Folder | Content |
|---|---|
app/ |
the application (HTML, CSS, js/core, js/ui, js/author, js/workers, python/) |
levels/ |
levels, manifest, schema, narration |
backend/ |
Django sync API |
scripts/ |
dev server, validation, build, voices |
tests/ |
js/ (node:test), python/, e2e/ (Chromium) |
docs/site/ |
this documentation; docs/design/: design notes (in French) |
The detailed reasoning behind each choice is in the repository's docs/design/.