pure_eval is a Python package that lets you safely evaluate certain AST nodes without triggering arbitrary code that may have unwanted side effects.