v0.0.20
pydantic/montyv0.0.20Aug 9, 2026by samuelcolvin
AI Summary
This release introduces substantial functionality to the Monty sandbox, including native support for standard library modules like `collections`, `itertools`, and filesystem operations (`os`). It also features significant memory management improvements, garbage collection enhancements, and security fixes regarding mount confinement.
Key Highlights
- Native support for `os` module operations and `collections` (deque, namedtuple, etc.)
- Implementation of `itertools` foundation and adaptors (count, repeat, pairwise, etc.)
- Memory management improvements including soft memory limits and shrinking heap data
- Refactoring of binary operators onto `PyTrait` and native `@dataclass` support
- Security enhancements via mount confinement fixes and path validation
Breaking Changes
- Remove the `ResourceTracker` generic, always use `ResourceTracker`
New Features
- Support function decorators
- Support Path / Path and reflected str / Path in the `/` operator
- Implement `NotImplemented` and use it for user equality
- Implement file handle API for TS
- Add `collections` modules
- Add `itertools` foundation with `count` and `repeat`
- Add `itertools` adaptors: `pairwise`, `compress`, `islice`, `chain`, `cycle`
- Native `@dataclass` defined inside the sandbox
- Add `ShutdownDump` turn-ender
Full Release Notes
## What's Changed * Populate class `__annotations__` (stringized) by @rewitt94 in https://github.com/pydantic/monty/pull/593 * tidy up max allocations remnants by @davidhewitt in https://github.com/pydantic/monty/pull/618 * fix `npm audit` warnings in `monty js` by @davidhewitt in https://github.com/pydantic/monty/pull/617 * Remove the `ResourceTracker` generic, always use `ResourceTracker` by @samuelcolvin in https://github.com/pydantic/monty/pull/613 * Track iterator types for GC so their cycles can't evade collection by @rewitt94 in https://github.com/pydantic/monty/pull/620 * Support function decorators by @rewitt94 in https://github.com/pydantic/monty/pull/590 * Support Path / Path and reflected str / Path in the / operator by @samuelcolvin in https://github.com/pydantic/monty/pull/621 * Update yanked spin 0.9.8 -> 0.9.9 and 0.10.0 -> 0.10.1 in Cargo.lock by @samuelcolvin in https://github.com/pydantic/monty/pull/623 * Bound nesting of class-body expressions walked before parsing by @rewitt94 in https://github.com/pydantic/monty/pull/624 * unify `ExtFunction` types by @davidhewitt in https://github.com/pydantic/monty/pull/598 * create cells for captured comprehension values by @davidhewitt in https://github.com/pydantic/monty/pull/605 * split all binary operators to be proper methods on `PyTrait` by @davidhewitt in https://github.com/pydantic/monty/pull/568 * split `MontyIter` into dedicated iterator types by @davidhewitt in https://github.com/pydantic/monty/pull/602 * implement file handle API for TS by @davidhewitt in https://github.com/pydantic/monty/pull/599 * clean up old opcodes, add dump version at the Rust level by @davidhewitt in https://github.com/pydantic/monty/pull/607 * Dispatch user-defined `__iter__` / `__next__` / `__contains__` by @rewitt94 in https://github.com/pydantic/monty/pull/609 * Count the module's pending result in the strict ref-count check by @rewitt94 in https://github.com/pydantic/monty/pull/627 * Move `py_contains` onto `PyTrait`, fix `in` for bytes, add coverage by @rewitt94 in https://github.com/pydantic/monty/pull/625 * Implement `os.listdir` and filesystem wrappers in the os module by @samuelcolvin in https://github.com/pydantic/monty/pull/622 * Fix remaining `py_contains` issues from the #625 review by @rewitt94 in https://github.com/pydantic/monty/pull/628 * Add a `ShutdownDump` turn-ender and cheap frame classification by @samuelcolvin in https://github.com/pydantic/monty/pull/630 * Add `itertools` foundation with `count` and `repeat` by @rewitt94 in https://github.com/pydantic/monty/pull/632 * cleanups to some drop branches by @davidhewitt in https://github.com/pydantic/monty/pull/633 * Native `@dataclass` defined inside the sandbox by @rewitt94 in https://github.com/pydantic/monty/pull/626 * Add `collections`: deque, namedtuple, defaultdict, Counter by @rewitt94 in https://github.com/pydantic/monty/pull/608 * Bound the source-pattern text retained by the regex cache by @samuelcolvin in https://github.com/pydantic/monty/pull/644 * Bound native dataclass equality by the recursion-depth limit by @rewitt94 in https://github.com/pydantic/monty/pull/641 * Make monty-pool async end-to-end by @samuelcolvin in https://github.com/pydantic/monty/pull/639 * Refactor try/finally compilation onto a CPython-style frame-block stack by @samuelcolvin in https://github.com/pydantic/monty/pull/648 * Review Skills by @samuelcolvin in https://github.com/pydantic/monty/pull/651 * make benchmarks async properly by @davidhewitt in https://github.com/pydantic/monty/pull/652 * Shrink `HeapData` from 160 to 80 bytes by boxing large variants by @samuelcolvin in https://github.com/pydantic/monty/pull/636 * Apply new drop standards to the collections code by @rewitt94 in https://github.com/pydantic/monty/pull/653 * Add `itertools` adaptors: `pairwise`, `compress`, `islice`, `chain`, `cycle` by @rewitt94 in https://github.com/pydantic/monty/pull/635 * move `py_set_attr` onto `PyTrait` by @davidhewitt in https://github.com/pydantic/monty/pull/638 * implement `NotImplemented` and use it for user equality by @davidhewitt in https://github.com/pydantic/monty/pull/567 * Make bytes substring search linear and interruptible by @rewitt94 in https://github.com/pydantic/monty/pull/643 * Apply memory limit via custom allocator by @samuelcolvin in https://github.com/pydantic/monty/pull/646 * Windows path-parsing mount escape by @rewitt94 in https://github.com/pydantic/monty/pull/655 * attempt to configure telemetry via bindings or monty-runtime logfire by @davidhewitt in https://github.com/pydantic/monty/pull/662 * Re-validate cached overlay host paths on every read by @rewitt94 in https://github.com/pydantic/monty/pull/656 * Memory limit followups by @samuelcolvin in https://github.com/pydantic/monty/pull/667 * move to soft memory limit in allocator by @davidhewitt in https://github.com/pydantic/monty/pull/668 * vendor abc.pyi so `@abstractmethod` members keep their types by @samuelcolvin in https://github.com/pydantic/monty/pull/671 * Cleanup typechecking by @samuelcolvin in https://github.com/pydantic/monty/pull/674 * uprev pyo3 to 0.29.2 by @samuelcolvin in https://github.com/pydantic/monty/pull/675 * Fix test_type_check_format_not_a_string against pyo3 0.29.2 by @rewitt94 in https://github.com/pydantic/monty/pull/677 * Add Macroscope review config (correctness tuning, ignore, approvability) by @strawgate in https://github.com/pydantic/monty/pull/679 * Confine mounts with cap-std descriptors instead of path checks by @rewitt94 in https://github.com/pydantic/monty/pull/669 * Mount confinement defects by @samuelcolvin in https://github.com/pydantic/monty/pull/680 * Close the mount defects the confinement PR deferred by @samuelcolvin in https://github.com/pydantic/monty/pull/681 * Drop `logfire` from CLI by default by @samuelcolvin in https://github.com/pydantic/monty/pull/683 * Split `pydantic-monty` into a metapackage over client and runtime by @samuelcolvin in https://github.com/pydantic/monty/pull/678 * Stop mount path walks costing a lookup per level squared by @samuelcolvin in https://github.com/pydantic/monty/pull/684 * Add raw wire-level turns to monty-pool, bump logfire to 0.12 by @samuelcolvin in https://github.com/pydantic/monty/pull/687 * Remove the peek module by @samuelcolvin in https://github.com/pydantic/monty/pull/688 * Move monty version to types by @samuelcolvin in https://github.com/pydantic/monty/pull/689 * Bound nested itertools adaptors by the recursion limit by @samuelcolvin in https://github.com/pydantic/monty/pull/685 * rename files to `mod.rs`, stop annoying `usize_field` warnings by @samuelcolvin in https://github.com/pydantic/monty/pull/690 * Collapse the two dump versions into one session dump format by @samuelcolvin in https://github.com/pydantic/monty/pull/692 * Send a WebSocket Close frame on worker teardown by @samuelcolvin in https://github.com/pydantic/monty/pull/691 * Ci split `test-rust` by @samuelcolvin in https://github.com/pydantic/monty/pull/694 * Version the wire protocol independently of the package by @samuelcolvin in https://github.com/pydantic/monty/pull/693 * Bump version to v0.0.20 by @samuelcolvin in https://github.com/pydantic/monty/pull/695 **Full Changelog**: https://github.com/pydantic/monty/compare/v0.0.19...v0.0.20