{"id":21648,"library":"openedx-calc","title":"Open edX Calc","description":"A helper library for mathematical calculations and symbolic mathematics, used by Open edX. Current version 5.0.0, requires Python >=3.12. Release cadence is irregular, tied to Open edX releases.","status":"active","version":"5.0.0","language":"python","source_language":"en","source_url":"https://github.com/openedx/openedx-calc","tags":["openedx","math","symbolic","calculator","education"],"install":[{"cmd":"pip install openedx-calc","lang":"bash","label":"Latest stable"}],"dependencies":[{"reason":"Core dependency for symbolic mathematics","package":"sympy","optional":false},{"reason":"Used for numerical calculations","package":"numpy","optional":true}],"imports":[{"note":"Python package name uses underscores, not hyphens","wrong":"from calc import calculator","symbol":"calculator","correct":"from openedx_calc import calculator"},{"note":"The evaluator is a function, not a class","wrong":"from openedx_calc.evaluator import Evaluator","symbol":"evaluator","correct":"from openedx_calc import evaluator"}],"quickstart":{"code":"from openedx_calc import calculator\nexpr = \"2 + 2\"\nresult = calculator(expr)\nprint(result)  # 4","lang":"python","description":"Simple arithmetic evaluation using the calculator function."},"warnings":[{"fix":"Upgrade Python to 3.12 or later.","message":"Python 3.12+ only; drop of Python 3.8-3.11 support in version 5.0.0.","severity":"breaking","affected_versions":"5.0.0"},{"fix":"Use 'from openedx_calc import evaluator' instead of 'from openedx_calc import evaluate'.","message":"The 'evaluate' function was renamed to 'evaluator' in version 4.0.0.","severity":"deprecated","affected_versions":">=4.0.0 <5.0.0"},{"fix":"Always pass an expression as a string: calculator('2+2').","message":"The calculator function expects a string, not a numeric type. Passing a number will cause an AttributeError.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install with 'pip install openedx-calc' then import as 'from openedx_calc import ...'","cause":"Package installed with hyphens but imported with underscores; wrong import path.","error":"ModuleNotFoundError: No module named 'openedx_calc'"},{"fix":"Ensure the expression is a string: calculator('2+2') not calculator(4).","cause":"Passed an integer instead of a string to calculator().","error":"AttributeError: 'int' object has no attribute 'replace'"},{"fix":"Replace 'from openedx_calc import evaluate' with 'from openedx_calc import evaluator'.","cause":"'evaluate' was removed in version 5.0.0; use 'evaluator'.","error":"ImportError: cannot import name 'evaluate' from 'openedx_calc'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}