skillfed

pydantic-monty-runtime

The monty CLI binary — spawned as worker subprocesses by pydantic-monty

pydantic-monty-runtime v0.0.21 328.0K downloads/30d#7,560 on PyPI8,053
Permissive license MIT Active released

What it is and what it does

pydantic-monty-runtime is a compiled binary package that installs the `monty` command-line tool—a sandboxed Python interpreter written in Rust. It can run Python code in three modes: interactive REPL, file execution, or as a subprocess worker driven by a parent process. The sandbox enforces resource limits (memory, execution duration, recursion depth, garbage collection intervals) and provides crash isolation via the monty-alloc allocator, which raises MemoryError on soft-limit crossing and exits with a dedicated status on hard-limit crossing.

The package is primarily designed as a runtime dependency for pydantic-monty and pydantic-monty-client, which use it to execute untrusted or resource-constrained Python code safely. It supports optional type checking via ty, filesystem mounts with configurable access modes, and optional telemetry via Logfire (behind a feature flag). The binary is packaged for PyPI using the same model as uv and ruff, placing the compiled executable in the environment's scripts directory.

Use it for:

  • Run untrusted Python code in a controlled sandbox with enforced memory and time limits
  • Execute Python scripts as isolated worker subprocesses with crash recovery
  • Type-check Python code before execution using the -t flag
  • Mount host directories into the sandbox for controlled file access with ro/rw/overlay modes
  • Integrate sandboxed Python execution into larger systems via pydantic-monty or monty-pool

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides the `monty` command-line binary, a sandboxed Python interpreter that runs Python code with resource limits and crash isolation, typically spawned as worker subprocesses by pydantic-monty.

Yes, if you need sandboxed Python execution with resource limits and crash isolation. Install directly only if you are building on top of pydantic-monty or monty-pool; otherwise, install pydantic-monty (which pulls it in automatically). No known vulnerabilities, active maintenance, and permissive MIT license. Medium install friction is offset by precompiled wheels across platforms.

Install

pydantic-monty-runtime on PyPI

pip

pip install pydantic-monty-runtime

uv

uv add pydantic-monty-runtime

poetry

poetry add pydantic-monty-runtime

Installing pydantic-monty-runtime

Before you install

Medium install friction due to precompiled wheels across multiple platforms and Python versions (3.10+). Actively maintained with recent releases; intended as a dependency pulled in by pydantic-monty rather than direct installation.

License in practice

MIT license permits permissive use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects.

Quickstart

pip install pydantic-monty-runtime

# Then use the monty binary from the command line:
# monty -c "print('hello world')"
# monty file.py
# monty --max-memory 10MB --max-duration 0.5 -c "code"

Requires Python >= 3.10. The binary is precompiled; installation places it in the environment's scripts directory and assumes a compatible platform (macOS, Linux, or Windows).

Verify before relying

  • Whether the package works correctly when installed directly vs. only as a transitive dependency of pydantic-monty
  • Performance characteristics and overhead of the sandbox relative to standard Python execution
  • Completeness of stdlib subset implemented by the Monty interpreter

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 5 days since the last release
Last repo commit
First released
Downloads 328,029/month — #7,560 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pydantic_monty_runtime-0.0.21-cp310-cp310-macosx_10_12_x86_64.whl; pydantic_monty_runtime-0.0.21-cp310-cp310-macosx_11_0_arm64.whl; pydantic_monty_runtime-0.0.21-cp310-cp310-manylinux_2_28_aarch64.whl; pydantic_monty_runtime-0.0.21-cp310-cp310-manylinux_2_28_armv7l.whl; pydantic_monty_runtime-0.0.21-cp310-cp310-manylinux_2_28_i686.whl; pydantic_monty_runtime-0.0.21-cp310-cp310-manylinux_2_28_ppc64le.whl; pydantic_monty_runtime-0.0.21-cp310-cp310-manylinux_2_28_s390x.whl; pydantic_monty_runtime-0.0.21-cp310-cp310-manylinux_2_28_x86_64.whl; pydantic_monty_runtime-0.0.21-cp310-cp310-musllinux_1_1_aarch64.whl; pydantic_monty_runtime-0.0.21-cp310-cp310-musllinux_1_1_x86_64.whl; pydantic_monty_runtime-0.0.21-cp310-cp310-win32.whl; pydantic_monty_runtime-0.0.21-cp310-cp310-win_amd64.whl; pydantic_monty_runtime-0.0.21-cp311-cp311-macosx_10_12_x86_64.whl; pydantic_monty_runtime-0.0.21-cp311-cp311-macosx_11_0_arm64.whl; pydantic_monty_runtime-0.0.21-cp311-cp311-manylinux_2_28_aarch64.whl; pydantic_monty_runtime-0.0.21-cp311-cp311-manylinux_2_28_armv7l.whl; pydantic_monty_runtime-0.0.21-cp311-cp311-manylinux_2_28_i686.whl; pydantic_monty_runtime-0.0.21-cp311-cp311-manylinux_2_28_ppc64le.whl; pydantic_monty_runtime-0.0.21-cp311-cp311-manylinux_2_28_s390x.whl; pydantic_monty_runtime-0.0.21-cp311-cp311-manylinux_2_28_x86_64.whl

Development Status :: 3 - AlphaEnvironment :: MacOS XIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxOperating System :: UnixProgramming Language :: Rust

Tags

sandboxed python interpreterpython sandbox runtimemonty cli binaryresource-limited python executioncrash-isolated python workerpython code sandboxrestricted python environment
sandboxresource-limitscrash-isolation

More Software Development packages