Safely evaluate an expression from an untrusted party
Simply install via pip:
pip install safeeval
No dependencies are required.
Simple Comparision:
import safeeval
ast = safeeval.SafeEval.parse("x == y")
res = safeeval.SafeEval.evalAst(ast, {"x": 4, "y": 3)
print("res", res)
More examples can be found in tests directory.
Write issues and provide patches via PRs on github.
- Tobias Steinrücken - Initial work - Mausbrand Informationsysteme GmbH
- Stefan Kögl - Packaging, callable support, docstrings - Mausbrand Informationsysteme GmbH
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details