mirror of
https://github.com/LLVMParty/llvm-nanobind
synced 2026-06-21 13:43:38 +00:00
Workshop Portal POC
This is a minimal local web portal with 10 LLVM Python exercises:
- Foundations:
F01toF08 - Builder basics:
B01,B02
Run
uv run python exercises/poc/portal.py
Open:
http://127.0.0.1:8123
What It Includes
- Exercise picker with prompt, hints, and fixed input IR
- Starter code editor
- One-click validation
- Optional "show solution" button
- Subprocess-based evaluation (safer for runtime crashes /
SystemExit) - Supports
solve(input_ir),main([input_ir]), or top-level script execution - Validators can inspect return values and/or
stdout/stderr - Metadata-driven checks in TOML (contains/regex/exception/entrypoint)
- Declarative sidecar files per exercise:
<prefix>.input.ll(optional; omit for from-scratch exercises)<prefix>.starter.py<prefix>.solution.py<prefix>.validator.py(optional)
Files
exercises/poc/exercises/*.toml: exercise metadata (references files + checks)exercises/poc/exercise_bank.py: TOML loaderexercises/poc/evaluator.py: execution + metadata checks + custom validatorsexercises/poc/portal.py: local web server and UIexercises/poc/exercises/*.validator.py: definevalidate(run, exercise, helpers)
Notes
- This is intentionally minimal, not production hardened.
- Validation is deterministic and workshop-focused.
- For IR tasks, validators accept either returned IR text or printed IR text
when
allow_stdout_iris enabled for the exercise. starter_codeandsolution_codeare loaded from:<prefix>.starter.pyand<prefix>.solution.py.input_iris loaded from<prefix>.input.llwhen present; if omitted, the exercise has no input module and users build from scratch.- Validator files are first-class: keep exercise-specific logic in
<prefix>.validator.pyinstead of routing through a global name map. idis inferred from filename stem (do not set it in TOML):01_F01.toml->F0110_B02.toml->B02
- Custom validators are discovered by sidecar name only:
<prefix>.validator.py