mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-10 21:27:14 +01:00
Deep or oversized values from the sandbox now fail that example only; compare refuses nesting past 64 levels. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWYGW5NZL5uVpnqmNKo |
||
|---|---|---|
| .. | ||
| code_runner | ||
| .pre-commit-config.yaml | ||
| install.sh | ||
| pyproject.toml | ||
| README.md | ||
| requirements.txt | ||
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.