pydantic-monty investigation

Simon Willison's Blog Tools

Summary

An investigation into pydantic-monty, a minimal Python interpreter in Rust for sandboxed execution, confirming that its security limits (duration, memory, allocations, recursion) work as intended.

No content available
Original Article
View Cached Full Text

Cached at: 05/31/26, 07:16 PM

# Research: pydantic-monty investigation Source: [https://simonwillison.net/2026/May/22/monty-investigation/](https://simonwillison.net/2026/May/22/monty-investigation/) [Research](https://simonwillison.net/elsewhere/research/)[pydantic\-monty investigation](https://github.com/simonw/research/tree/main/monty-investigation#readme)— Reviewing \`pydantic\-monty\` reveals it as a fast, minimal Python interpreter designed for controlled sandboxed execution, primarily useful when transforming data, branching, looping, and interacting with a select set of trusted host tools or a virtual filesystem\. The interpreter purposefully omits large portions of CPython’s functionality, with clear boundaries: unsupported features and missing resources generally fail cleanly as structured errors rather than escaping into the host runtime\. It's been a few months since[I last poked at Monty](https://simonwillison.net/2026/Feb/6/pydantic-monty/), the sandboxed subset of Python implemented in Rust\. I had Claude Code look at the most recent release\. Importantly the`max\_duration\_secs`,`max\_memory`,`max\_allocations`, and`max\_recursion\_depth`settings all appear to work as advertised\.

Similar Articles

Python 3.14 compiled to metal – no interpreter

Hacker News Top

pon is a new JIT and ahead-of-time compiler for Python 3.14, written in Rust, that compiles Python directly to machine code without an interpreter or bytecode, using a garbage collector instead of reference counting.

Running Python code in a sandbox with MicroPython and WASM

Simon Willison's Blog

Simon Willison introduces micropython-wasm, an alpha package that runs Python code in a sandbox using MicroPython compiled to WebAssembly, enabling safe plugin execution within Python applications like Datasette.

OPFS + Pyodide test harness

Simon Willison's Blog

A test harness for experimenting with the Origin Private File System (OPFS) in browsers using Pyodide, built to explore persistent SQLite storage for Datasette Lite.