v0.0.19

ankitects/ankiv0.0.19Jul 24, 2026by samuelcolvin

AI Summary

This release focuses on performance optimization, sandboxing improvements, and refactoring the Monty Python runtime. Key additions include async memory limits, subprocess pool execution, and websocket protocol support, alongside significant enhancements to error reporting and user-defined class support.

Key Highlights

  • Added async memory limits to prevent runaway resource usage.
  • Moved execution to a subprocess pool for better isolation.
  • Introduced websocket protocol support.
  • Enhanced sandbox tracebacks with source previews and carets.
  • Added support for user-defined classes.

Breaking Changes

  • Renamed and changed the behavior of `external_lookup`.
  • Removed `monty-cpython` crate.
  • Moved mounting to the host-side.

New Features

  • Async memory limits
  • Subprocess pool execution
  • Websocket protocol
  • User-defined classes
  • Support for multi-level (transitive) closure capture
  • Added `__name__` and related attributes
  • Added `unicodedata` module
  • Added `resume_auto()` for iteratively driving `feed_start` snapshots

Full Release Notes

## What's Changed
* introduce iterator helpers that manage recursion / time by @davidhewitt in https://github.com/pydantic/monty/pull/454
* fix interactions with global names, function scopes & repl by @davidhewitt in https://github.com/pydantic/monty/pull/469
* experiment with `StringBuilder` to guard strings under construction by @davidhewitt in https://github.com/pydantic/monty/pull/448
* fix type-object marshalling across the sandbox boundary by @samuelcolvin in https://github.com/pydantic/monty/pull/478
* `FromArgs` slots cleanup by @samuelcolvin in https://github.com/pydantic/monty/pull/484
* fix(file): release the buffered-file OS-call pin on all paths by @arkuhn in https://github.com/pydantic/monty/pull/485
* add `__name__` et al. by @samuelcolvin in https://github.com/pydantic/monty/pull/495
* f-strings improvements by @samuelcolvin in https://github.com/pydantic/monty/pull/494
* fix: return error instead of panicking in `ForIter` heap read by @tontinton in https://github.com/pydantic/monty/pull/493
* Move execution to a subprocess pool by @samuelcolvin in https://github.com/pydantic/monty/pull/500
* Add 'Part of the Pydantic Stack' footer to README by @strawgate in https://github.com/pydantic/monty/pull/502
* fix(asyncio): raise RuntimeError on cross-gather coroutine reuse by @samuelcolvin in https://github.com/pydantic/monty/pull/503
* fix CI since subprocesses by @samuelcolvin in https://github.com/pydantic/monty/pull/505
* Async memory limits by @samuelcolvin in https://github.com/pydantic/monty/pull/504
* uprev ruff and ty crates by @samuelcolvin in https://github.com/pydantic/monty/pull/506
* move `py_eq` to accept `&Value` for RHS by @davidhewitt in https://github.com/pydantic/monty/pull/508
* use published ruff and ty crates by @samuelcolvin in https://github.com/pydantic/monty/pull/512
* reintroduce `feed_start` API to both python & JS by @davidhewitt in https://github.com/pydantic/monty/pull/507
* use stable clippy in ci by @samuelcolvin in https://github.com/pydantic/monty/pull/513
* Publish all library crates to crates.io by @samuelcolvin in https://github.com/pydantic/monty/pull/514
* websocket protocol by @samuelcolvin in https://github.com/pydantic/monty/pull/509
* Support multi-level (transitive) closure capture by @samuelcolvin in https://github.com/pydantic/monty/pull/516
* move recursion count from heap to VM by @davidhewitt in https://github.com/pydantic/monty/pull/511
* monty-cpython: rich sandbox tracebacks with source previews and carets by @samuelcolvin in https://github.com/pydantic/monty/pull/517
* fix various bugs with global name scoping by @davidhewitt in https://github.com/pydantic/monty/pull/510
* ci: try newer manylinux version by @davidhewitt in https://github.com/pydantic/monty/pull/519
* Add `unicodedata` module, refactor and improve `FromArgs` macros by @samuelcolvin in https://github.com/pydantic/monty/pull/522
* rename and change behaviour of `external_lookup` by @samuelcolvin in https://github.com/pydantic/monty/pull/520
* `encode` and `decode` codecs and error types by @samuelcolvin in https://github.com/pydantic/monty/pull/523
* Fix wasm CI by @samuelcolvin in https://github.com/pydantic/monty/pull/526
* Add `resume_auto()` to iteratively drive `feed_start` snapshots by @samuelcolvin in https://github.com/pydantic/monty/pull/527
* User-defined classes by @samuelcolvin in https://github.com/pydantic/monty/pull/515
* small perf wins by @samuelcolvin in https://github.com/pydantic/monty/pull/528
* Add benchmarks covering real agent workloads by @samuelcolvin in https://github.com/pydantic/monty/pull/530
* Bound native `evaluate_function` re-entry to prevent infinite recursion by @samuelcolvin in https://github.com/pydantic/monty/pull/529
* Restrict `git commit` and `git push` for claude by @samuelcolvin in https://github.com/pydantic/monty/pull/532
* Regex perf improvements by @samuelcolvin in https://github.com/pydantic/monty/pull/531
* String cheap wins (perf track 3) by @samuelcolvin in https://github.com/pydantic/monty/pull/537
* add ci stage for browser testing by @davidhewitt in https://github.com/pydantic/monty/pull/539
* prep for beta release by @samuelcolvin in https://github.com/pydantic/monty/pull/540
* Fixing CI for`0.0.19-beta.2` by @samuelcolvin in https://github.com/pydantic/monty/pull/542
* merge `DropWithHeap` / `DropWithVM` by @davidhewitt in https://github.com/pydantic/monty/pull/521
* fix interned longint ops by @davidhewitt in https://github.com/pydantic/monty/pull/547
* Add per-crate READMEs, rename `monty-cli` to `monty-runtime` by @samuelcolvin in https://github.com/pydantic/monty/pull/544
* migrate from ava to vitest by @davidhewitt in https://github.com/pydantic/monty/pull/548
* use web workers for browser wasm by @davidhewitt in https://github.com/pydantic/monty/pull/525
* remove cargo config by @davidhewitt in https://github.com/pydantic/monty/pull/546
* Monty-proto moves by @samuelcolvin in https://github.com/pydantic/monty/pull/549
* JSON error data, and type conversion to cpython by @samuelcolvin in https://github.com/pydantic/monty/pull/552
* Prep for `0.0.19-beta.3` by @samuelcolvin in https://github.com/pydantic/monty/pull/555
* monty-wasm-runtime publish false, prep 0.0.19-beta.4 by @samuelcolvin in https://github.com/pydantic/monty/pull/559
* clean up js packaging / smoke test by @davidhewitt in https://github.com/pydantic/monty/pull/550
* build and release the `monty-cpython` container by @samuelcolvin in https://github.com/pydantic/monty/pull/563
* remove mod eq optimization by @davidhewitt in https://github.com/pydantic/monty/pull/565
* Add pytest-style assert failure messages by @samuelcolvin in https://github.com/pydantic/monty/pull/556
* remove monty-cpython by @samuelcolvin in https://github.com/pydantic/monty/pull/571
* improve error messages from suspensions in `evaluate_function` by @davidhewitt in https://github.com/pydantic/monty/pull/573
* inline `clone_immediate` into `clone_with_heap` by @davidhewitt in https://github.com/pydantic/monty/pull/578
* Make an existing iterator self-iterable by @rewitt94 in https://github.com/pydantic/monty/pull/579
* Move mounting to the host-side and move `fs` to `monty-fs` by @samuelcolvin in https://github.com/pydantic/monty/pull/576
* Arg fixes, `int()`, `str()`, `round()` by @samuelcolvin in https://github.com/pydantic/monty/pull/584
* Public API fixes by @samuelcolvin in https://github.com/pydantic/monty/pull/587
* add iterator to `PyTrait` by @davidhewitt in https://github.com/pydantic/monty/pull/575
* Support class decorators by @rewitt94 in https://github.com/pydantic/monty/pull/582
* Implement iter(callable, sentinel) by @rewitt94 in https://github.com/pydantic/monty/pull/581
* Retain the OS-call payload in suspended state and drop `OsFunctionCall::Used` by @samuelcolvin in https://github.com/pydantic/monty/pull/583
* avoid collisions in `id` by @davidhewitt in https://github.com/pydantic/monty/pull/580
* migrate iterator callsites to `py_iter` by @davidhewitt in https://github.com/pydantic/monty/pull/588
* stop uninstalling workspace in `make install-py` by @davidhewitt in https://github.com/pydantic/monty/pull/595
* use web-time for the resource-tracker clock so max_duration works on wasm32-unknown-unknown by @Butch78 in https://github.com/pydantic/monty/pull/554
* Allow any iterable after `*`, not just five container types by @rewitt94 in https://github.com/pydantic/monty/pull/589
* `monty-types` crate by @samuelcolvin in https://github.com/pydantic/monty/pull/592
* Teach the type checker about iter/next by @rewitt94 in https://github.com/pydantic/monty/pull/596
* Bump version to 0.0.19-beta.5 by @samuelcolvin in https://github.com/pydantic/monty/pull/597
* fix npm publish by @davidhewitt in https://github.com/pydantic/monty/pull/603
* Fix leaks and panics on `MontyObject` conversion error paths by @samuelcolvin in https://github.com/pydantic/monty/pull/600
* release 0.0.19b6 by @davidhewitt in https://github.com/pydantic/monty/pull/604
* make `dev-py` install python dev deps by @davidhewitt in https://github.com/pydantic/monty/pull/606
* Cap CollectString/CollectStreams so print loops can't OOM the host by @Shaurya-Sethi in https://github.com/pydantic/monty/pull/558
* Remove `ResourceError::Exception` and fix `check_replace_size` shrinking bypass by @samuelcolvin in https://github.com/pydantic/monty/pull/610
* Remove `max_allocations` from resource limits by @samuelcolvin in https://github.com/pydantic/monty/pull/611
* Reject action-less open modes, fix mixed-indent traceback dedent by @samuelcolvin in https://github.com/pydantic/monty/pull/612
* use same build profile for codspeed as release by @samuelcolvin in https://github.com/pydantic/monty/pull/614
* Prep for v0.0.19 by @samuelcolvin in https://github.com/pydantic/monty/pull/616

## New Contributors
* @arkuhn made their first contribution in https://github.com/pydantic/monty/pull/485
* @tontinton made their first contribution in https://github.com/pydantic/monty/pull/493
* @strawgate made their first contribution in https://github.com/pydantic/monty/pull/502
* @rewitt94 made their first contribution in https://github.com/pydantic/monty/pull/579
* @Shaurya-Sethi made their first contribution in https://github.com/pydantic/monty/pull/558

**Full Changelog**: https://github.com/pydantic/monty/compare/v0.0.18...v0.0.19