dart_monty_wasm 0.4.3 copy "dart_monty_wasm: ^0.4.3" to clipboard
dart_monty_wasm: ^0.4.3 copied to clipboard

Platformweb

WASM backend for dart_monty, pure Dart bindings for Monty — a restricted sandboxed Python interpreter built in Rust.

dart_monty_wasm #

Part of dart_monty — pure Dart bindings for Monty, a restricted, sandboxed Python interpreter built in Rust.

Live Demo | GitHub | Monty

Pure Dart web WASM implementation of dart_monty using dart:js_interop and @pydantic/monty. Runs the Monty Python interpreter in a Web Worker to avoid Chrome's synchronous WASM compile-size limit.

This package has no Flutter dependency and can be used in any Dart web project.

  • Flutter apps should import dart_monty instead — the federated plugin selects the correct backend automatically.
  • Pure Dart web projects can depend on this package directly to run Python via WASM in the browser.

Architecture #

Dart (compiled to JS) -> MontyWasm (dart:js_interop)
  -> DartMontyBridge (monty_glue.js)
    -> Web Worker (dart_monty_worker.js)
      -> @pydantic/monty WASM (NAPI-RS)

Key Classes #

Class Description
WasmBindings Abstract async interface for WASM operations
WasmBindingsJs Concrete JS interop implementation via Web Worker
MontyWasm MontyPlatform implementation using WasmBindings

Requirements #

The web server must send COOP/COEP headers for SharedArrayBuffer support:

Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp

See the main dart_monty repository for full documentation.

0
likes
160
points
376
downloads

Publisher

unverified uploader

Weekly Downloads

WASM backend for dart_monty, pure Dart bindings for Monty — a restricted sandboxed Python interpreter built in Rust.

Repository (GitHub)
View/report issues
Contributing

Topics

#python #sandbox #wasm #interpreter

Documentation

API reference

License

MIT (license)

Dependencies

dart_monty_platform_interface

More

Packages that depend on dart_monty_wasm