Safe Python code execution using pyx CLI. Use when: running Python, executing scripts, testing code. Triggers: pyx, run python, execute code, test script. Default mode: MANIFEST_IO (file-first with manifest output).
Use pyx for safe Python execution. Default: MANIFEST_IO mode.
If you need any of the following, you MUST read references/environment.md first:
Do NOT do trial-and-error checks (e.g. guessing imports, probing commands). Prefer the generated environment document as the source of truth.
Note: pyx info can be slow. Prefer reading references/environment.md first.
Load these skills alongside pyx:
manifest - MANIFEST_IO contract and workflowlearn - skill extraction workflow and summary referencepyx assumes MANIFEST_IO by default:
See the manifest skill for the full spec.
Use only when user explicitly says:
pyx run --file "temp/task.py"
NEVER paste code inline to shell. Always write to file first:
# ❌ WRONG
pyx run --code "import os; print(os.listdir())"
# ✅ CORRECT
pyx ensure-temp --dir "temp"
# Write code to: temp/list_files.py
pyx run --file "temp/list_files.py"
| Task | Command |
|---|---|
| Create temp dir | pyx ensure-temp --dir "temp" |
| Run script | pyx run --file "script.py" |
| Run with input | pyx run --file "script.py" --input-path "input.json" |
| Run with timeout | pyx run --file "script.py" --timeout 30 |
| Run in directory | pyx run --file "script.py" --cwd "/path" |
| Install package | pyx add --package "requests" |
| Check environment | pyx info |
pyx-specific references:
Common use-cases: