Skip to content

Python, shaped for Monty.

monty-compat turns unsupported Python into evidence-backed source that Monty can run—and refuses the transformation when Python semantics cannot be kept.

Get started See lowering examples

default · offline verified

The newest manifest compiled into your wheel. Stable for its lifetime.

opt-in · network latest

A bounded, hash-checked channel that must match your lowering engine.

One function at runtime

from monty_compat import transpiler
from pydantic_monty import Monty

source = """
value = 2
match value:
    case 2:
        result = f"ok:{value}"
result
"""

with Monty() as pool:
    with pool.checkout() as session:
        result = session.feed_run(transpiler(source))

The default path is native Rust, release-pinned, bounded, and offline. It does not execute your input, start discovery workers, or take ownership of Monty's runtime API.

Evidence before rewriting

  1. Extract the real builtin, module, exception, and runtime-type surface.
  2. Probe one exact Monty release against CPython.
  3. Lower only seams whose observable behavior can be preserved.

Unsupported inheritance, generator suspension, traceback objects, exception groups, and runtime dispatch tricks remain explicit errors—not approximations.

Choose your path

You want to… Start here
Transpile from Python Python API
Understand verified and latest Release selection
See before/after transformations Lowering
Generate a manifest Discovery
Embed the Rust engine Rust API
Reproduce latency measurements Benchmarks