Evalidate is a Python library for validation and secure evaluation of untrusted Python expressions. Version 2.1.4 is current, with active development on GitHub. It provides an expression evaluator that restricts available nodes (e.g., no imports, no function calls unless whitelisted) to safely evaluate user-provided expressions.
pip install evalidateVerified import paths — ran on the pinned version, not inferred.
Basic usage: evaluate a safe expression with the default restrictions.
Use evalidate.Eval with explicit node whitelist: Eval(whitelist=['Expression', 'Num', 'Str', 'Name', 'Load', 'BinOp', ...])
Update calls to Eval.eval(expr, ctx) to Eval.eval(expr, global_ctx=ctx) or Eval.eval(expr, local_ctx=ctx, global_ctx=ctx) as needed.
Remove 'Is' and 'IsNot' from the whitelist if you want to disallow identity comparisons.
Use evalidate.Eval with whitelist/blacklist instead of evalidate.security.
If you need to allow specific function calls, use a custom whitelist: Eval(whitelist=['Call', ...]) and provide allowed functions via global context.
No dependency data recorded yet.