pydantic-monty
The Monty sandboxed Python interpreter: bindings plus the worker binary
Decision gist · record as of 2026-08-14
Yes, if you need to execute untrusted Python code safely. The package is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and low install friction. It is still in Alpha (Development Status 3), so expect API changes and test thoroughly before production use. Not necessary if you only run trusted code.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later; the monty worker binary must be available via MONTY_BIN, binary_path, PATH, or installed via pydantic-monty-runtime.
- Low install friction: a pure-Python wheel metapackage that bundles two distributions (pydantic-monty-client and pydantic-monty-runtime).
- Actively maintained with a release 5 days old and 8052 repository stars.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial use, modification, and distribution with minimal restrictions—standard permissive terms.
last release 2026-08-09 (5 days) · last repo commit 2026-08-14 · 8,052 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 3,394,230 downloads/mo, #2,638 on PyPI
Alternatives
Verify before relying
from pydantic_monty import Monty
with Monty() as pool:
with pool.checkout() as session:
result = session.feed_run('1 + 2')
print(result) # 3- Whether the worker binary is pre-compiled for all supported platforms (macOS, Windows, Linux) or requires build-time setup.
- Performance overhead of subprocess spawning and IPC for typical workloads.
- Exact semantics of crash recovery and whether all memory errors trigger MontyCrashedError.
What it is and what it does
Pydantic-monty is a Python sandbox that executes untrusted or adversarial code in isolated worker subprocesses, preventing crashes from corrupting your main process. It wraps the Monty interpreter—a hardened Python runtime—and exposes it via a pool-based API: you check out a session, feed it code snippets, and get results back. State persists across feeds within a session, and the pool transparently replaces any crashed worker.
The package is a metapackage that installs two distributions: pydantic-monty-client (the importable module) and pydantic-monty-runtime (the worker binary). It supports both synchronous and async workflows, with features like snapshots (pausing/resuming execution), resource limits (timeout, cumulative execution time), type checking via bundled ty, and filesystem mounts. External functions can be injected via external_lookup, and execution state can be serialized and restored across processes.
Use it for
- Execute untrusted user-submitted code (e.g., in a code-evaluation service) without risking the host process.
- Run adversarial or fuzzing inputs against your code in isolation to detect crashes or resource exhaustion.
- Implement a REPL or notebook-like interface where each cell runs in a fresh or persistent sandbox session.
- Checkpoint long-running computations by dumping and restoring execution snapshots across process boundaries.
- Enforce strict resource limits (CPU time, memory) on code execution with transparent worker replacement on timeout.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to execute untrusted Python code safely.
The package is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and low install friction. It is still in Alpha (Development Status 3), so expect API changes and test thoroughly before production use. Not necessary if you only run trusted code.
Install
pydantic-monty on PyPI
Before you install
Low install friction: a pure-Python wheel metapackage that bundles two distributions (pydantic-monty-client and pydantic-monty-runtime). Actively maintained with a release 5 days old and 8052 repository stars.
Requires Python 3.10 or later; the monty worker binary must be available via MONTY_BIN, binary_path, PATH, or installed via pydantic-monty-runtime.
License in practice
MIT license permits commercial use, modification, and distribution with minimal restrictions—standard permissive terms.
Quickstart
from pydantic_monty import Monty
with Monty() as pool:
with pool.checkout() as session:
result = session.feed_run('1 + 2')
print(result) # 3
Verify before relying
- Whether the worker binary is pre-compiled for all supported platforms (macOS, Windows, Linux) or requires build-time setup.
- Performance overhead of subprocess spawning and IPC for typical workloads.
- Exact semantics of crash recovery and whether all memory errors trigger MontyCrashedError.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagespydantic-monty-clientpydantic-monty-runtime |
| Maintenance | Actively maintained 5 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,394,230 / month, #2,638 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaEnvironment :: MacOS XIntended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: System AdministratorsOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: ImplementationTopic :: InternetTopic :: Software Development :: Libraries :: Python Modules |
Evidence: pydantic_monty-0.0.21-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “subprocess worker pool”
- pydantic-montyProvides Python bindings to execute untrusted Python code in a…
- tqdm-multiprocessDisplays multiple tqdm progress bars from worker processes in a…
- multiprocessing-loggingProvides a logging handler that tunnels log records from…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also pydantic-monty-runtime · starlark-pyo3 · pydantic-evals · pydantic-ai-harness · monty · pytest-forked · e2b · hyperlight-sandbox · bounded-pool-executor · hyperlight-sandbox-backend-wasm