Run and test Python code in a dedicated playground directory. Use when you need to execute Python scripts, test code snippets, investigate CPython behavior, or experiment with Python without affecting the main codebase.
Run Python code in an isolated playground directory for testing and experimentation.
playground directory doesn't already exist, run mkdir playground.playground/test.pyuv run playground/test.py to test cpython behavior or cargo run -- playground/test.py to test monty behaviorIMPORTANT: Use separate tool calls for each step - do NOT chain commands with &&. This allows the pre-approved commands to work without prompting.
Step 1 - Create directory if it doesn't already exist (Bash, already allowed):
mkdir playground
Step 2 - Write code (use Write tool, not cat):
Write to playground/test.py:
def foo():
raise ValueError('test')
foo()
Step 3 - Run script (Bash, already allowed):
uv run playground/test.py
playground/ directory is gitignoredtest_value_error.pyuv run ... to run scripts (uses project Python)cargo run -- ... to run scripts using Monty