monty-types
Shared boundary types for Monty, the sandboxed Python interpreter — the owned, heap-free data types that cross between the interpreter and the hosts that embed it, with no interpreter implementation.
What's here
MontyObject/MontyType— Python values and their types at the host boundary, including thedatetimefamily (MontyDate,MontyDateTime,MontyTimeDelta,MontyTimeZone),DictPairsandMontyFileHandle.MontyException/ExcType— exceptions with tracebacks (StackFrame,CodeLoc) and structured payloads (ExcData).OsFunctionCall— the typed OS-call payloads sandboxed code suspends with (file reads/writes,open(),os.getenv, ...), plus thestat_resultbuilders hosts use to answer them.ResourceTracker/ResourceLimits— the resource tracker the interpreter uses to enforce time/memory/recursion limits.PrintStream/PrintWriter—print()output capture.CompileOptions,ExtFunctionResult,NameLookupResult,FileMode, and the CPython-compatible formatting helpers behind theirrepr()s.
Who should depend on it
Host-side crates that need these types without linking the interpreter —
monty-fs (which services OsFunctionCalls locally via
MountTable::handle_os_call), monty-pool (which talks to Monty workers
over the wire), the pydantic-monty-client Python bindings and the
@pydantic/monty JS bindings — depend on this crate instead of monty,
so their binaries never link the interpreter itself. Only worker-side crates
(monty-runtime, monty-wasm-runtime, and monty-proto with its worker
feature) link monty.
use MontyObject;
let value = List;
assert_eq!;
Monty crates
monty— the core interpreter: Python parser, bytecode VM, and sandbox.monty-types— the shared boundary data types (values, exceptions, OS calls, resource limits) hosts use without linking the interpreter. this cratemonty-fs— host-side filesystem mounts: maps virtual sandbox paths to real host directories.monty-runtime— themontybinary: REPL, file runner, and subprocess worker mode.monty-pool— an elastic pool of crash-isolatedmontyworker subprocesses.monty-proto— the protobuf wire protocol spoken between pool parents and workers.monty-type-checking— type checking of sandboxed code, powered by ty.monty-typeshed— the trimmed typeshed stubs describing the stdlib subset Monty implements.monty-macros— the proc macros behindmonty's argument parsing.
License
MIT