starlark-pyo3
Wraps starlark-rust into Python
What it is and what it does
Starlark-pyo3 wraps the starlark-rust interpreter, bringing Starlark—a Python-like language designed for safe, deterministic execution—into Python. Starlark is built around hermetic execution (no filesystem, network, or clock access), deterministic evaluation (same code always produces the same result), and parallel-safe immutable data. This makes it suitable for running untrusted code safely, configuration languages, and build system scripting.
The package provides Python bindings via PyO3, so you can instantiate a Starlark interpreter from Python and evaluate Starlark code within a sandboxed context. It ships with prebuilt wheels for Linux (x86_64, aarch64, armv7l), Windows, and macOS, making installation straightforward. The single runtime dependency is typing-extensions, keeping the footprint minimal.
Use it for:
- Execute untrusted user scripts or plugins safely without filesystem or network access
- Implement a configuration or domain-specific language (DSL) that is Python-like but deterministic and sandboxed
- Build system or task automation where reproducibility and parallel evaluation are required
- Evaluate expressions or code snippets from external sources with guaranteed hermetic isolation
- Prototyping or embedding a restricted scripting layer in a larger Python application
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Exposes the Starlark interpreter (a Python-like language) to Python via PyO3 bindings, enabling sandboxed execution of untrusted code with deterministic, hermetic evaluation.
Yes, if you need sandboxed, deterministic code execution with a Python-like syntax. The package is actively maintained, has no known vulnerabilities, and offers prebuilt wheels for easy installation. However, verify the license terms first—the package metadata does not declare an explicit license, which could be a blocker for commercial or restricted-license projects. Start with the documentation and a small proof-of-concept to confirm the API and performance meet your use case.
Install
starlark-pyo3 on PyPI
pip
pip install starlark-pyo3uv
uv add starlark-pyo3poetry
poetry add starlark-pyo3Installing starlark-pyo3
Before you install
Medium install friction due to compiled wheels, but prebuilt binaries are available for all major platforms and Python versions (3.9+). Repository is active with recent commits and no known vulnerabilities.
License in practice
License treatment is unclear—no SPDX identifier or raw license text is declared in package metadata. Verify the actual license terms in the repository before use in proprietary or restricted-license contexts.
Quickstart
pip install starlark-pyo3
import starlark
# Create and evaluate Starlark code in a sandboxed environment
result = starlark.eval("x = 1 + 2\nprint(x)")
Requires Python 3.9 or later. Development builds require nightly Rust and maturin.
Verify before relying
- Exact API surface and available built-in functions in the sandboxed environment
- Performance characteristics and execution limits for large or complex Starlark programs
- Compatibility guarantees between starlark-pyo3 versions and the underlying starlark-rust library
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — typing-extensions |
| Maintenance | actively maintained — 88 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 356,691/month — #7,280 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: starlark_pyo3-2026.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; starlark_pyo3-2026.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; starlark_pyo3-2026.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; starlark_pyo3-2026.1-cp310-cp310-win_amd64.whl; starlark_pyo3-2026.1-cp311-cp311-macosx_11_0_arm64.whl; starlark_pyo3-2026.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; starlark_pyo3-2026.1-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; starlark_pyo3-2026.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; starlark_pyo3-2026.1-cp311-cp311-win_amd64.whl; starlark_pyo3-2026.1-cp312-cp312-macosx_11_0_arm64.whl; starlark_pyo3-2026.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; starlark_pyo3-2026.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; starlark_pyo3-2026.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; starlark_pyo3-2026.1-cp312-cp312-win_amd64.whl; starlark_pyo3-2026.1-cp313-cp313-macosx_11_0_arm64.whl; starlark_pyo3-2026.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; starlark_pyo3-2026.1-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; starlark_pyo3-2026.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; starlark_pyo3-2026.1-cp313-cp313-win_amd64.whl; starlark_pyo3-2026.1-cp314-cp314-macosx_11_0_arm64.whl
Tags
More Security packages
Provides Python bindings to the FreeDesktop.org…
permissive · top 1,000 on PyPI
msalMSAL for Python handles OAuth2 and OpenID…
permissive · top 1,000 on PyPI
joserfcjoserfc implements JOSE standards (JWS, JWE,…
permissive · top 1,000 on PyPI
AuthlibAuthlib provides a complete implementation of…
permissive · top 1,000 on PyPI
argon2-cffi-bindingsProvides low-level CFFI bindings to the…
permissive · top 1,000 on PyPI
adalADAL for Python authenticates applications with…
permissive · top 1,000 on PyPI
bashkitBashkit is a sandboxed bash interpreter for…
permissive · top 15,000 on PyPI
pydantic-montyProvides Python bindings to execute untrusted…
permissive · top 5,000 on PyPI
RestrictedPythonRestrictedPython compiles and executes a…
unclear · top 5,000 on PyPI
e2bE2B provides a Python SDK to create and control…
permissive · top 5,000 on PyPI
astevalAsteval is a safe Python expression and…
permissive · top 5,000 on PyPI
pydantic-monty-runtimeProvides the `monty` command-line binary, a…
permissive · top 15,000 on PyPI
maturinMaturin builds and publishes Python packages…
permissive · top 5,000 on PyPI
moviepilot-rustProvides Rust-accelerated parsing and filtering…
unclear · top 15,000 on PyPI
setuptools-rustsetuptools-rust is a setuptools plugin that…
permissive · top 5,000 on PyPI
nono-pynono-py provides Python bindings for…
permissive · top 15,000 on PyPI