utils/code_runner/README.md
Krzysztof kuhy Rudnicki 612b0b3c0a Add code_runner sandboxed example runner
Runs a solution (python3, javascript, typescript) against statement
examples in bubblewrap: no network, read-only root, scratch dir,
rlimits and a per-example timeout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWYGW5NZL5uVpnqmNKo
2026-11-02 14:59:30 +01:00

734 B

code_runner

Runs a learner's solution (Python 3, JavaScript, TypeScript) against a problem statement's examples inside bubblewrap: no network, read-only /usr, scratch dir, CPU/memory/process/file/time limits.

import code_runner as cr

statement = ...  # markdown from ~/.claude/skills/leetcode/fetch_problem.py
results = cr.run("python3", code, cr.extract_starter(statement), cr.parse_examples(statement))

run(lang, code, starter, examples) -> list[CaseResult] with n, input, expected, actual, ok, stdout, error, ms. One sandbox process per example. TypeScript runs through node's type stripping (no type check, no enums). Needs bwrap, prlimit, /usr/bin/python3, node >= 22.18. Install: ./install.sh.