pydantic-monty-runtime
The monty CLI binary — spawned as worker subprocesses by pydantic-monty
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-runtimeuv
uv add pydantic-monty-runtimepoetry
poetry add pydantic-monty-runtimeInstalling 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
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
pydantic-montyProvides Python bindings to execute untrusted…
permissive · top 5,000 on PyPI
bashkitBashkit is a sandboxed bash interpreter for…
permissive · top 15,000 on PyPI
hyperlight-sandbox-python-guestProvides a Python guest runtime for the…
permissive · top 15,000 on PyPI
montyMonty provides supplementary utility functions…
permissive · top 5,000 on PyPI
starlark-pyo3Exposes the Starlark interpreter (a Python-like…
unclear · top 15,000 on PyPI
RestrictedPythonRestrictedPython compiles and executes a…
unclear · top 5,000 on PyPI
nono-pynono-py provides Python bindings for…
permissive · top 15,000 on PyPI
e2bE2B provides a Python SDK to create and control…
permissive · top 5,000 on PyPI
hyperlight-sandboxHyperlight-sandbox provides a Python API for…
permissive · top 15,000 on PyPI
pydantic-deepA Python framework and terminal assistant for…
permissive · top 15,000 on PyPI