v0.0.8

pydantic/montyv0.0.8Mar 10, 2026by samuelcolvin

AI Summary

A major release with extensive changes including full Python math module implementation, REPL improvements with rustyline, and significant refactoring to convert builtins to take VM.

Key Highlights

  • Added rustyline to REPL for line editing and history
  • Implemented full Python math module (~50 functions)
  • Implemented `re` module
  • Added PEP 448 generalized unpacking support
  • Implemented dict view and set/frozenset operators
  • Added resource limits args to CLI
  • Support dict(iterable, **kwargs) and fix dict(zip(...))
  • Tuple comparison support

New Features

  • Full math module
  • re module
  • Generalized unpacking (PEP 448)
  • Dict views and set operations
  • Resource limits CLI arguments
  • str and bytes comparison

Full Release Notes

## What's Changed
* Add rustyline to REPL for line editing and history by @samuelcolvin in https://github.com/pydantic/monty/pull/189
* preserve REPL session on runtime errors in start/resume by @rsr5 in https://github.com/pydantic/monty/pull/187
* Remove use of `take_data!` from get/set cell value methods by @davidhewitt in https://github.com/pydantic/monty/pull/191
* use `pyo3-build-config` to make running tests on ubuntu easier by @davidhewitt in https://github.com/pydantic/monty/pull/192
* Make `Heap::inc_ref` only require immutable heap borrow by @davidhewitt in https://github.com/pydantic/monty/pull/193
* Implement `filter` builtin function by @friendlymatthew in https://github.com/pydantic/monty/pull/63
* create proper structures for all `HeapData` variants by @davidhewitt in https://github.com/pydantic/monty/pull/199
* Implement `getattr` builtin function by @friendlymatthew in https://github.com/pydantic/monty/pull/65
* Unify recursion and data depth guards by @davidhewitt in https://github.com/pydantic/monty/pull/198
* remove some uses of `Heap::with_two` by @davidhewitt in https://github.com/pydantic/monty/pull/203
* replace `&mut HeapData` with `HeapDataMut` by @davidhewitt in https://github.com/pydantic/monty/pull/206
* fix full-build needing pyo3 config by @davidhewitt in https://github.com/pydantic/monty/pull/204
* Scrapper Example (simplified) by @samuelcolvin in https://github.com/pydantic/monty/pull/209
* Web scrapper example by @samuelcolvin in https://github.com/pydantic/monty/pull/205
* add resource limits args to CLI by @samuelcolvin in https://github.com/pydantic/monty/pull/213
* feat(dict): support dict(iterable, **kwargs) and fix dict(zip(...)) by @FarhanAliRaza in https://github.com/pydantic/monty/pull/212
* merge `py_call_attr` and `py_call_attr_raw` by @davidhewitt in https://github.com/pydantic/monty/pull/223
* convert all `builtins` to take `VM` by @davidhewitt in https://github.com/pydantic/monty/pull/224
* allow `clone_with_heap` and `drop_with_heap` to take VM by @davidhewitt in https://github.com/pydantic/monty/pull/225
* simplify `DropWithHeap` trait by @davidhewitt in https://github.com/pydantic/monty/pull/227
* convert iteration to take `VM` by @davidhewitt in https://github.com/pydantic/monty/pull/228
* remove `external_functions` parameter, auto-detect with NameLookup by @samuelcolvin in https://github.com/pydantic/monty/pull/214
* move heap traits to separate file by @davidhewitt in https://github.com/pydantic/monty/pull/229
* no in-place mutation for `str` and `bytes` by @davidhewitt in https://github.com/pydantic/monty/pull/231
* `str` and `bytes` comparison by @samuelcolvin in https://github.com/pydantic/monty/pull/233
* Fix VM panic when function parameter shadows outer local variable by @CJHwong in https://github.com/pydantic/monty/pull/124
* `re` module implementation by @Embers-of-the-Fire in https://github.com/pydantic/monty/pull/157
* Add memory pre-checks to padding, replace and f-string operations by @MRoci in https://github.com/pydantic/monty/pull/238
* Implement dict view and set/frozenset operators by @evalstate in https://github.com/pydantic/monty/pull/252
* fix(compiler): correct stack depth tracking for loop iterators by @zh217 in https://github.com/pydantic/monty/pull/246
* Add memory tracking to `re.sub()` to prevent untracked allocations by @MRoci in https://github.com/pydantic/monty/pull/243
* Tuple comparison (<, >, <=, >=) by @amitrechavia in https://github.com/pydantic/monty/pull/237
* merge `AttrCallResult` into `CallResult` by @davidhewitt in https://github.com/pydantic/monty/pull/256
* Support augmented assignment on subscript targets by @evalstate in https://github.com/pydantic/monty/pull/255
* feat(types/module): support builtin calls in module attributes by @zh217 in https://github.com/pydantic/monty/pull/245
* convert `py_bool` and `py_len` to take `VM` by @davidhewitt in https://github.com/pydantic/monty/pull/257
* Forward printCallback in JS runMontyAsync by @sathish-t in https://github.com/pydantic/monty/pull/194
* Fix os.environ panic in JS bindings by @sathish-t in https://github.com/pydantic/monty/pull/201
* remove pointer indirection from `PrintWriter` inside `VM` by @davidhewitt in https://github.com/pydantic/monty/pull/258
* convert more code to take `vm` instead of `heap, interns` by @davidhewitt in https://github.com/pydantic/monty/pull/260
* remove `Namespaces`; keep locals on the stack by @davidhewitt in https://github.com/pydantic/monty/pull/259
* Repl improvements by @samuelcolvin in https://github.com/pydantic/monty/pull/235
* Implement full Python math module (~50 functions) by @Butch78 in https://github.com/pydantic/monty/pull/200
* implement PEP 448 generalised unpacking by @AlmogBaku in https://github.com/pydantic/monty/pull/219
* replace inline math implementations with libm by @davidhewitt in https://github.com/pydantic/monty/pull/261
* uprev to 0.0.8 by @samuelcolvin in https://github.com/pydantic/monty/pull/262

## New Contributors
* @rsr5 made their first contribution in https://github.com/pydantic/monty/pull/187
* @FarhanAliRaza made their first contribution in https://github.com/pydantic/monty/pull/212
* @CJHwong made their first contribution in https://github.com/pydantic/monty/pull/124
* @MRoci made their first contribution in https://github.com/pydantic/monty/pull/238
* @evalstate made their first contribution in https://github.com/pydantic/monty/pull/252
* @zh217 made their first contribution in https://github.com/pydantic/monty/pull/246
* @amitrechavia made their first contribution in https://github.com/pydantic/monty/pull/237
* @Butch78 made their first contribution in https://github.com/pydantic/monty/pull/200
* @AlmogBaku made their first contribution in https://github.com/pydantic/monty/pull/219

**Full Changelog**: https://github.com/pydantic/monty/compare/v0.0.7...v0.0.8