dart_monty 0.18.0
dart_monty: ^0.18.0 copied to clipboard
Script your Dart/Flutter app with sandboxed Python — runtime extensions, Flutter glue, and FFI/WASM asset loading on top of dart_monty_core.
0.18.0 #
Requires dart_monty_core 0.18.1 (monty v0.0.18).
Breaking #
OsCallExceptionis nowdart_monty_core's. The parallelOsCallException(operation, message)plusOsCallFileNotFoundError/OsCallPermissionErrorsubclasses are gone. Handlers throwOsCallException(message, pythonExceptionType: 'FileNotFoundError')instead, and that type is delivered to Python — soexcept FileNotFoundError:/except PermissionError:now work (previously every OS error surfaced asRuntimeError). Catch sites that matched the old subclasses should switch toOsCallExceptionand checkpythonExceptionType.
Added #
open()/ file I/O. The filesystem handlers (fsHandler,memoryFsHandler,sandboxedFsHandler, and the read-only/overlay decorators) service Python'sopen()— read/write/append, binary mode, andwith open(...) as f:. The bareOpenOS-call routes to whatever handler backsPath.*; core'sresolveOpenCallowns the open() semantics, so the handlers just supply their filesystem primitives.read_bytesnow returns typed bytes so binary reads buffer correctly. Seeexample/file_io_demo.dart.
0.17.1 #
Requires dart_monty_core 0.17.1 — see its changelog for MontyCallback,
.args, and inputs: details.
Breaking #
MontyRuntime(useFutures: true)removed. Setdispatch: DispatchMode.futureon eachHostFunctionthat Python should be able toawaitinstead.MontyCallback/.argsrename — inherited fromdart_monty_core0.17.1; update all handler signatures andMontyPending/MontyOsCallfield accesses.
Added #
DispatchMode.futureonHostFunction— makes a handlerawait-able from Python;asyncio.gatherover multiple such functions runs them concurrently.execute(inputs:)— inject Dart values as Python variables for one call.buildRunScriptFunction—HostFunctionfactory that runs a named Python script.HostContext.parent/subExecute— safe sub-execution from inside a handler; directruntime.execute()re-entrancy is guarded.
0.17.0 #
- Low-level bindings have been factored into a separate package,
dart_monty_core.
0.13.0 #
Breaking #
MontyResult.valueis nowMontyValue?(wasObject?). Use pattern matching or.dartValuefor migration:switch (result.value) { case MontyInt(:final value): print(value); case MontyString(:final value): print(value); case MontyDate(:final year, :final month, :final day): ... }MontyPending.argumentsis nowList<MontyValue>(wasList<Object?>). Same forkwargs(Map<String, MontyValue>?).MontyOsCall.arguments/kwargsfollow the same typed pattern.- Removed cancel infrastructure:
MontyCancelledError,MontyCancelToken,MontyCancelRegistry,cancel(),handleId,sandbox_cancelhost function — all removed. UpstreamLimitedTrackerwithtime_limit_msprovides runaway protection.
Added #
MontyValuesealed class with 18 subclasses for type-safe Python values:MontyNull,MontyBool,MontyInt,MontyFloat,MontyString,MontyBytes,MontyList,MontyTuple,MontyDict,MontySet,MontyFrozenSet,MontyDate,MontyDateTime,MontyTimeDelta,MontyTimeZone,MontyPath,MontyNamedTuple,MontyDataclass.__typeJSON wrappers in Rustconvert.rsfor lossless round-trips of allMontyObjectvariants (Date, DateTime, Path, Tuple, Set, etc.).- OsCall support: Python code using
pathlib,os.getenv,os.environ,date.today(),datetime.now()now yields to Dart instead of erroring. NewMontyOsCallsealed subclass,OsCallHandlercallback, andBridgeOsCallStart/BridgeOsCallResultevents. - Platform-aware
OsCallHandlervia conditional imports:dart:ioon native (full filesystem + env + datetime), datetime-only on web. - Tier 20 ladder fixtures for OsCall operations (12 tests, cross-platform).
Changed #
- Upgrade Monty interpreter from 0.0.9 to 0.0.10 (via
runyaga/0.0.10fork branch) - Cherry-picked upstream JSON perf improvements and mount edge case fixes
- Fork reduced to 1 meaningful commit (
frames.is_empty()guard fix) HandleStatesimplified: 6 clean variants (Ready, Paused, OsCall, Futures, Complete, Consumed), no tracker-type doubling
Fixed #
- Lossless JSON round-trips for datetime types (were opaque debug strings)
- Ladder fixture expected values updated for
__typewrappers - Gate compliance across all packages (format, analyze, test)
0.12.0 #
Changed #
- Upgrade Monty interpreter from 0.0.9 to 0.0.10 (via
runyaga/0.0.10fork branch) - Upstream monty 0.0.10 adds: mounting filesystems, async in Rust,
executor deduplication, multi-module import statements (
import a, b, c), JSON performance improvements, CI improvements (zizmor, yamlfmt, PGO fixes) - Update snapshot format pinning for v0.0.10 postcard changes
- Bump
NATIVE_LIB_VERSIONto 0.10.0
Fixed #
- Cancel race condition:
cancel()was a silent no-op when called before the worker isolate sent back its handle ID (during Rust compilation). Now awaits the handle ID with a 10s timeout instead of dropping the cancel. Reliably reproducible on cold-start cancel at <150ms delay. - Fix analyzer infos in FFI mock test (
curly_braces_in_flow_control_structures,document_ignores) - Apply
dart format(tall style) across all packages
0.11.0 #
Breaking #
- API audit: Trim public barrels across all packages. Internal
implementation types moved to SPI barrels (
ffi_backend_spi.dart,wasm_backend_spi.dart,bridge_internals.dart). Remove deprecatedMontyCancelledExceptiontypedef andBaseMontyPlatformstatic methods. RemoveJsonExtensionfrom bridge barrel.
Changed #
- Upgrade Monty interpreter from 0.0.8 to 0.0.9 (via
runyaga/0.0.9fork branch) - Upstream monty 0.0.9 adds:
jsonmodule,datetimemodule, nested subscript assignment,max()kwargs/default,str.expandtabs(), BigInt string conversion limit, memory growth tracking - Handle new
MontyObjectdatetime variants (Date,DateTime,TimeDelta,TimeZone) in FFIconvert.rs— serialized as debug strings for now
Added #
- Tier 17:
jsonmodule (13 tests) —json.dumps,json.loads, roundtrip nested structures,indent/sort_keys/separatorskwargs, None/bool serialization, number types, invalid JSON error handling - Tier 18:
datetimemodule (13 tests) —date,datetime,timedeltaconstructors, properties (.year,.month,.day,.hour, etc.), methods (.isoformat(),.date(),.total_seconds()), date arithmetic (date - date,date + timedelta), comparisons, both import styles docs/prompt.txt— recommended system prompt for LLMs generating Python code targeting the Monty sandbox- Document upstream Monty module system in CLAUDE.md (
crates/monty/src/modules/)
Fixed #
- Un-xfail tier 7 test #66 (
nested subscript assignment) — now passes with monty 0.0.9 - Native ladder gate was silently passing —
tool/test_python_ladder.shrandart test --tags=ladderwithout--run-skipped, so all ladder tests were skipped bydart_test.yamland the gate reported PASSED without actually running them - Remove obsolete
DYLD_LIBRARY_PATH/LD_LIBRARY_PATHfrom gate scripts and test doc comments — thehook/build.dartnative assets hook handles library resolution automatically for bothdart runanddart test - Fix
dart_test.yamlskip messages indart_monty_ffianddart_monty_bridgeto show correct invocation (dart test --run-skipped --tags=...) - Add
--run-skippedtotest_python_ladder.sh,test_snapshot_portability.sh
Docs #
- Update README: add
jsonmodule usage example, correct stdlib module coverage to "Partial" (onlymath,re,json— not all stdlib) - Add Testing section to CLAUDE.md with
dart testguidance
0.10.0 #
Changed #
- Upgrade Monty interpreter from 0.0.7 to 0.0.8 (via
dart_monty_native0.8.0) - Upstream monty 0.0.8 adds: full
mathmodule, PEP 448 unpacking,remodule, dict view/set operators, compiler stack-depth fixes
Added #
- Tier 10:
mathmodule (15 tests) —factorial,sqrt,pi,e,ceil,floor,gcd,pow,log,isnan/isinf,fabs,copysign,sin/cos,radians/degrees, combined hypotenuse - Tier 11:
remodule (10 tests) —match,search,findall,sub,split, no-matchNone, capture groups,subwith count limit, multi-groupfindall - Tier 12: monty 0.0.8 features (16 tests) —
filter()builtin, PEP 448 generalized unpacking (list, dict, function call,**kwargscall), augmented subscript assignment (list, dict), tuple/string comparison operators,dict(zip(…)),dict(**kwargs), set operators (|,&,-),getattr(xfail: no classes) - Un-xfail tier 7 test #65 (
import math) — now passes with monty 0.0.8 - Register new tiers in web spike, WASM package, and site demo ladder runners
Fixed #
- ForIter stack corruption (#225) in nested for-loops with try/except — fixed by upstream compiler stack-depth tracking (#246, #268)
0.9.2 #
- Align all dependency lower bounds with actual API usage (fixes pub.dev downgrade tests across ffi, wasm, native, web)
- Update
dart_monty_fficonstraint to^0.8.3 - Update
dart_monty_wasmconstraint to^0.8.4
0.9.1 #
Pre-1.0 stability notice: dart_monty is under active development. APIs may change between minor versions. If you encounter issues, please open an issue.
- Fix pub.dev analysis failure: update
dart_monty_fficonstraint to^0.8.2(0.8.1 had a requiredbindingsparameter incompatible with zero-argMontyFfi()) - Update
dart_monty_wasmconstraint to^0.8.3 - Update
dart_monty_platform_interfaceconstraint to^0.8.0
0.9.0 #
- Pure Dart — remove Flutter SDK dependency; all packages are pure Dart with compile-time conditional imports
Monty()convenience class — auto-selects native (FFI) or web (WASM) backend viadart.library.ffi/dart.library.js_interop- Zero-arg constructors —
MontyFfi(),MontyNative(),MontyWasm()now default to production bindings Monty.withPlatform()— explicit backend injection for testing or custom bindings- Fix: WASM bindings use static method API matching JS bridge (was broken since Worker pool refactor)
- SDK constraint raised to
^3.10.0
0.8.1 #
- Fix CI release workflow: add WASM build step, remove broken AOT compilation
- Align all package versions and dependency constraints for clean pub.dev release
- Add
dart_monty_bridgepublish workflow - Update release documentation in CLAUDE.md and CONTRIBUTING.md
0.8.0 #
- WASM direct C-ABI — bypass NAPI-RS entirely: 28 direct Rust function calls via
wasm32-wasip1, drops SharedArrayBuffer/COOP/COEP requirement, WASM binary 4.5 MB (was 256 MB overhead) - CI — lower patch coverage gate to 70% (issue #135 tracks raising to 95%)
0.7.0 #
- CancellableTracker — sealed
MontyErrorhierarchy (6 subtypes),MontyCancelTokenfor cross-isolate cancel, FFI cancel via atomic flag in Monty bytecode loop - WASM multi-session — Worker pool with
createSession/disposeSession, timeout caching, binary snapshot transfer, strip NAPI-RS overhead (256MB → 16MB per session) - Monty fork migration — switch from
pydantic/montytorunyaga/montyfork with NameLookup handled internally in Rust - P0 safety fixes — TOCTOU race in handle lifecycle, handle leak on error paths, sync throw deadlock in iterative execution
- dispose() hang fix —
dispose()now callscancel()first to unblock stuck FFI calls (#113) - Web ladder runner — Dart-side
DartMontyBridgeconstruction,getDefaultSessionIdAPI - Cancel experiment suite — 9 experiments across JIT/AOT/WASM, all passing (evidence in
docs/cancel-experiments-evidence.md)
0.6.2 #
- dart_monty_bridge (0.2.1): Add
printOutputtoBridgeRunError,sandbox_freehost function, fixcancel()resource leak.
0.6.1 #
- dart_monty_wasm: Fix
toSerializable()in worker bridge for robust dict/set/bigint handling- Add circular reference guard (WeakSet) to prevent stack overflow
- Add cross-realm Map/Set duck-typing via
.getpresence/absence - Convert Set → Array (Python frozenset/set from NAPI-RS)
- Convert BigInt → Number/String (prevents JSON.stringify crash)
- Convert TypedArray → Array (Python bytes from NAPI-RS)
- Update all package READMEs with usage examples and human/AI attribution
- Enrich
example/example.dartacross all packages - Add README and example doctest coverage (20 integration tests)
- Remove 8 obsolete planning docs
0.6.0 #
- BREAKING: Rename
dart_monty_desktoptodart_monty_native - BREAKING: Collapse
DartMontyWebto registration-only shim - BREAKING: Add
BaseMontyPlatform+MontyCoreBindingsarchitecture - Add
MontySessionAPI for state persistence (run(),start(),resume()) - Add
MontyStateMixinfor shared state management across platforms - Add capability interfaces (
MontyFutureCapable,MontySnapshotCapable) - Extract shared contract test harness (
LadderRunner,LadderAssertions) - Fix
restore()to set restored instance to active state
0.4.3 #
- Fix vendored macOS dylib
install_namepointing to CI runner path instead of@rpath(#47) - Add
build.rsto set@rpathinstall_name at compile time on macOS - Add
install_name_toolsafety net in release CI workflow
0.4.2 #
- Plumb async/futures API through desktop Isolate bridge (
resumeAsFuture(),resolveFutures(),resolveFuturesWithErrors()) - Override async/futures methods in web extension with
UnsupportedError - Add tier 4 function parameter fixtures (keyword-only, mixed args/kwargs, forwarding, positional-only)
- Enable tier 13 async ladder fixtures (remove xfail)
- Add "Async gather" and "Function params" examples to desktop and web example apps
- Expand web ladder runner to tiers 1-9, 13, 15
0.4.1 #
- Extract reusable publish workflow for all 6 packages
- Add path filters to skip CI on docs-only changes
- Extract enforce-coverage composite action (DRY)
0.4.0 #
- Add
MontyResolveFuturesprogress variant for async/futures support (M13) - Add
resumeAsFuture(),resolveFutures(),resolveFuturesWithErrors()to platform API - Add
MONTY_PROGRESS_RESOLVE_FUTUREStag andFutureSnapshothandling in Rust C FFI - Implement futures support in FFI and WASM packages (WASM stubs with
UnsupportedError) - Add tier 13 async/futures ladder fixtures (IDs 170-175)
0.3.5 #
- Add
scriptName,excType,traceback,kwargs,callId,methodCallto data models - Add Rust C FFI accessors and
script_nameparameter for richer run/start metadata - Reject invalid UTF-8 in native FFI external function names and script names
- Wire FFI bindings to expose new native accessors to Dart
- Wire WASM JS bridge: kwargs, callId, scriptName, excType, and traceback in worker responses
- Fix worker onerror to reject pending promises on crash
- Fix
restore()state machine to return active instance - Fix FFI error paths to parse full error JSON (excType, traceback, filename)
- Add ladder test fixtures for tiers 8 (kwargs/callId), 9 (exceptions/traceback), 15 (scriptName)
- Xfail pre-existing try-except and syntax error ladder fixtures
- Add Flutter web extension (dart_monty_web) with 52 unit tests
- Add Flutter web example app with sorting visualizer, TSP, and ladder runner
- Deploy Flutter web app to GitHub Pages at /flutter/
0.3.4 #
- Initial release.