Skip to main content
Pydantic Monty runs a subset of Python, written in Rust, inside the Mirage process. A run starts in microseconds. It has no host files, environment or network: the files it opens are the workspace’s, under the same mount modes and permissions as shell commands. It is the default python3 in both SDKs, in Node and in browsers.

Installation

Usage

Monty is in the default runtimes, so python3 works with no setup. To list it yourself:

What is wired

Monty implements part of Python; see Python subset. For files, processes and the environment:

Notes

  • A run starts in the shell’s working directory. The script and every relative path pass the same mount and permission checks as cat: a rule protecting /data/job.py refuses python3 job.py from /data.
  • The words after the script are its argv as typed, with globs expanded as bash expands them. A word naming another mount is only a string.
  • A console session takes the working directory on its first input and keeps its own after that.
  • __file__ is the script’s name under the starting directory.

Python subset

Monty 1.0.0 implements a subset of Python, and Mirage never falls back to another interpreter.
  • Stdlib: asyncio, base64, binascii, collections, copy, dataclasses, datetime, functools, itertools, json, math, os, pathlib, random, re, sys, time, typing, unicodedata, each partial. No third-party imports.
  • Syntax: no class inheritance, metaclasses, classmethod, staticmethod, property or yield. Plain classes, function decorators, with, f-strings and comprehensions work.
  • Introspection: no dir (use hasattr), vars, globals, help, callable, issubclass, super, compile or __dict__.