pure-eval
Safely evaluate AST nodes without side effects
Decision gist · record as of 2026-08-14
Yes, if you are building a debugger, REPL, or code introspection tool and need to safely evaluate AST nodes. The package is stable, has no dependencies, and carries permissive licensing. Development is aging but the repo remains maintained; use it when safety and side-effect avoidance are requirements, not for general expression evaluation.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low install friction with no runtime dependencies.
- Last release was 754 days ago; repo remains active with recent commits, though development pace suggests maintenance rather than active feature work.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions; you must include the license text in distributions.
last release 2024-07-21 (754 days) · last repo commit 2026-01-11 · 52 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 124,116,100 downloads/mo, #298 on PyPI
Alternatives
Verify before relying
pip install pure_eval
import ast
from pure_eval import Evaluator
source = "x + 1"
tree = ast.parse(source)
evaluator = Evaluator({"x": 5})
result = evaluator[tree.body[0].value]- Whether the package handles all supported Python versions equally well or if some have known limitations.
- Performance characteristics when evaluating large or deeply nested AST trees.
What it is and what it does
pure_eval is a library for safely extracting values from Python AST nodes without executing arbitrary code. It parses source code into an AST and then evaluates only the "pure" parts—those that don't involve function calls, property access, or other operations that could trigger side effects. You provide an Evaluator with a namespace (variable bindings), then query it for the values of specific AST nodes; if a node cannot be safely evaluated, it raises CannotEval instead of running unknown code.
The package is designed for introspection and debugging tools—debuggers, REPLs, and code analysis frameworks that need to show variable values or expression results without accidentally executing user code. It includes utilities to find all evaluable expressions in a tree, group equivalent ones, and filter out trivial results like literal values or variables referred to by their own name.
Use it for
- Debugger or REPL implementation that displays variable and expression values without side effects.
- Code analysis tool that needs to extract constant values from source code safely.
- AST-based linter or formatter that evaluates simple expressions to understand code intent.
- Interactive notebook or documentation tool that shows computed values inline without running arbitrary code.
- Test fixture generator that extracts example values from test code without executing it.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are building a debugger, REPL, or code introspection tool and need to safely evaluate AST nodes.
The package is stable, has no dependencies, and carries permissive licensing. Development is aging but the repo remains maintained; use it when safety and side-effect avoidance are requirements, not for general expression evaluation.
Install
pure-eval on PyPI
Before you install
Low install friction with no runtime dependencies. Last release was 754 days ago; repo remains active with recent commits, though development pace suggests maintenance rather than active feature work.
License in practice
MIT license permits commercial and private use with minimal restrictions; you must include the license text in distributions.
Quickstart
pip install pure_eval
import ast
from pure_eval import Evaluator
source = "x + 1"
tree = ast.parse(source)
evaluator = Evaluator({"x": 5})
result = evaluator[tree.body[0].value]
Verify before relying
- Whether the package handles all supported Python versions equally well or if some have known limitations.
- Performance characteristics when evaluating large or deeply nested AST trees.
Package facts
| License | MIT permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Aging 754 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 124,116,100 / month, #298 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: pure_eval-0.2.3-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 › “safe ast evaluation”
- pure-evalSafely evaluate Python AST nodes without executing arbitrary code or…
- levalLeval evaluates limited expressions safely by parsing them into an…
- astevalAsteval is a safe Python expression and statement evaluator that uses…
Give your agent the search over MCP, or paste the wish link into any chat.
Similar packages
Asteval is a safe Python expression and statement evaluator that uses the ast module to interpret user input without the risks of Python's built-in eval().
Install it if you need to accept and execute user-written expressions safely.
Identifies the AST node currently being executed in a Python frame, along with source code and function qualname information, enabling introspection of what code is running at any moment.
Install it if you need frame introspection or are building debugging/monitoring tools.
Leval evaluates limited expressions safely by parsing them into an AST and walking it in Python, supporting depth and time limits alongside optional variable and function mappings.
Install it if you need to evaluate user or config expressions safely; skip it if you only need literal Python values.
Evaluates mathematical and logical expressions from strings in a safe, sandboxed way without using Python's built-in eval(), letting you add user-configurable formulas to applications.
Install it if you need to evaluate untrusted formulas; avoid it only if you need features beyond basic arithmetic, comparisons, and simple function calls, or if…
Evaluates Google's Common Expression Language (CEL) expressions in Python with microsecond-level performance, powered by a Rust backend, supporting safe, non-Turing-complete rule evaluation.
Install it if you need to evaluate untrusted expressions, define policies externally, or let non-developers write business rules.
Parses and evaluates mathematical expressions from strings, supporting arithmetic, trigonometric, logarithmic functions, and variables with substitution and simplification.
However, do not use it for new projects requiring active maintenance or support—the repository is archived and the last commit was 2022-06-11.
See also ast-comments · astpretty · cel-python · bandit