--- id: py-expression-eval version: "0.3.14" license: MIT license_treatment: permissive maintenance: abandoned --- # py-expression-eval — Python Mathematical Expression Evaluator License: permissive · Maintenance: abandoned · Downloads: 150.9K/mo ## What it is and what it does py-expression-eval is a mathematical expression parser and evaluator ported from a JavaScript library. It takes mathematical expressions as strings and converts them into evaluable objects that can be computed with variable substitution. The library supports standard arithmetic operators, trigonometric and logarithmic functions, boolean logic, and constants like PI and E. You create a Parser instance, call parse() on an expression string to get an Expression object, then evaluate() it with a dictionary of variable values. The library also offers simplification (reducing expressions algebraically), substitution (replacing variables with other expressions), and variable extraction. It's useful for applications that need to accept user-supplied or configuration-based mathematical formulas without executing arbitrary code. Use it for: - Accept mathematical formulas from users in web forms or configuration files and compute results safely - Build spreadsheet-like applications where cells contain formulas referencing other cells - Implement rule engines or business logic systems that rely on user-defined mathematical conditions - Validate and simplify mathematical expressions in educational or scientific tools - Generate dynamic calculations in data processing pipelines where formulas are stored as strings ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parses and evaluates mathematical expressions from strings, supporting arithmetic, trigonometric, logarithmic functions, and variables with substitution and simplification. Yes, if you need a lightweight, dependency-free expression evaluator for a stable use case. The package is mature and has no known vulnerabilities. However, do not use it for new projects requiring active maintenance or support—the repository is archived and the last commit was 2022-06-11. For actively maintained alternatives or complex symbolic math, consider other options. ## Install pip install py-expression-eval uv add py-expression-eval poetry add py-expression-eval ## Installing py-expression-eval Before you install: Installation is straightforward with no runtime dependencies. However, the repository is archived and the last commit was 2022-06-11, indicating the project is no longer actively maintained. License in practice: Licensed under MIT (permissive), allowing free use, modification, and distribution with minimal restrictions. Quickstart: pip install py-expression-eval from py_expression_eval import Parser parser = Parser() result = parser.parse('2 * x + 1').evaluate({'x': 3}) print(result) # 7 Verify before relying: - Whether the package handles edge cases in expression parsing (division by zero, invalid syntax) gracefully - Performance characteristics when evaluating complex nested expressions or with many variables - Compatibility with Python versions beyond 3.9, given the latest release predates newer Python versions ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 150.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags parse mathematical expressions, evaluate math formulas from strings, expression parser evaluator, math expression simplification, variable substitution math, trigonometric function evaluator, symbolic math expression, math-parser, expression-evaluator, formula-engine [View on SkillFed](https://skillfed.io/packages/py-expression-eval) · [View on PyPI](https://pypi.org/project/py-expression-eval/)