A simple, kind-of "safe" eval ?

This page summarizes the projects mentioned and recommended in the original post on /r/learnpython

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • asteval

    minimalistic evaluator of python expression using ast module

  • But, literals are not good enough very often, and one may want to do "len(foo)+bar[i]" , so I went searching trying to find a good implementation. I dug and found asteval, but this issue I raised breaks it for me, apart from the fact that I try not to rely on too many modules beyond the standard library + it has a bunch of peculiarities that make it not a real drop-in replacement to eval().

  • piston

    A high performance general purpose code execution engine. (by engineer-man)

  • the only way to do safe eval is with a purpose-made entirely locked down code execution engine, Piston is a popular one which supports multiple languages: https://github.com/engineer-man/piston

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • snekbox

    Easy, safe evaluation of arbitrary Python code

  • Theres also Snekbox, which we used over at python discord for the eval bot command: https://github.com/python-discord/snekbox

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts