Skip to main content

Safely evaluates simple python expressions

Project description

safeeval

Safely evaluate an expression from an untrusted party

Getting Started

Simply install via pip:

pip install safeeval

Prerequisites

No dependencies are required.

Example

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.

Contributing

Write issues and provide patches via PRs on github.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

safeeval-0.0.6.tar.gz (6.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page