Skip to content

Fix review findings before 0.3.0rc3, and bump to 0.3.0rc3 - #9

Merged
m-messer merged 11 commits into
mainfrom
fix/rc3-review-findings
Oct 19, 2026
Merged

m-messer merged 11 commits into
mainfrom
fix/rc3-review-findings

Conversation

@m-messer

@m-messer m-messer commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Fixes from a review of main since v0.3.0-rc.2, then bumps all four packages to 0.3.0rc3. One commit per fix.

expression_parsing

  • A task alias of summation names the task's symbol again where it isn't applied: with S aliased to summation, 2*summation is 2*S (it raised "summation is a function"). Applied, summation(...) is still the sum.
  • integrate, summation, product and limit are unevaluated without simplify (Integral, Sum, Product, Limit), like other functions. They are plain functions, so unevaluated parsing didn't reach them: product(k!, (k, 1, 3000)) and sum(k!, (k, 1, 3000)) took seconds and then failed.
  • With simplify, SymPy works out products and limits and leaves finite sums unevaluated; it leaves an integral on its own unevaluated but works out one inside a larger expression (2*integrate(sin(x), x) gives -2*cos(x)). check_evaluation_cost now bounds a Product with numeric limits: at most MAX_PRODUCT_TERMS (1000, exported) factors, with the index as large as its bound (product(k, (k, 1, 500)) is rejected like factorial(500)).
  • A sum with an infinite limit is still summed (oo, pi**2/6): SymPy can't approximate a divergent series numerically, and compareExpressions compares by value.
  • With elementary_functions, integrate(...) parses: it is a spelling of Integral, like int. Its es were read as Euler's number (int E grat E(...)), so it failed to parse.

criteria

  • split_criteria raises CriteriaSyntaxError for an empty criterion (a = b,, a,,b, ""), instead of returning "" for the criteria parser to fail on.
  • split_criteria treats all brackets as one kind, so half-open intervals split correctly: response in [0, 1), response > 0 is two criteria (it raised). A closing bracket with none open, or a bracket left open, still raises.
  • Node shapes are defined once, on each node class's STYLE; graph_to_mermaid reads them like tree.py does. The output is unchanged.

slr_parsing

  • A reduction with no goto raises GrammarError rather than a bare KeyError. Only an error action that rewrites the stack can cause one. _reduce and parsing_action go through ParseTable.goto/entry; parsing is about 4% slower on a criteria benchmark.

units

  • unsplittable_names is cached per unit set (a small gain: about 1.6% of parse_quantity).

Version

  • 0.3.0rc3 in every pyproject.toml, ranges between the packages >=0.3.0rc3,<0.4.0, README install tags v0.3.0-rc.3, CHANGELOG headings, poetry.lock.

Downstream (compareExpressions)

  • Its test suite, run against this branch, passes except test_radians_to_frequency, which also fails on main (units: make the angle a dimension, so 1 Hz is 2π rad/s #1 addresses it).
  • Behaviour changes it may notice: sums with finite limits, integrals, products and limits parse unevaluated without simplify. Its comparisons simplify the difference, which works them out, so equal answers still compare equal.
  • It still needs a time limit around evaluation: .simplify() there works out expensive expressions.

Verification

  • ruff, format and mypy are clean.
  • All four test suites pass: slr_parsing 116, criteria 105, expression_parsing 519, units 538.
  • The parity check shows 0 unexpected diffs out of 1608 probes.
  • scripts/release_version.py v0.3.0-rc.3 --prerelease passes.
  • New tests cover each fix.

Not in this PR

  • Other SymPy function names that contain an e and aren't in the elementary-function table (erf, Heaviside, primepi) are still split into letters with elementary_functions. This existed before this branch.

After merging, tag v0.3.0-rc.3 on main to run the pre-release workflow.

🤖 Generated with Claude Code

…YS_FUNCTIONS`, update substitutions logic and tests
…yntaxError` for unmatched brackets, update parsing logic and tests
…ation` with `Sum`, update tests and changelog
…s unevaluated, refine handling of infinite limits in sums, update parsing logic, tests, and changelog
…fine evaluation checks for large expressions, update parsing logic, tests, and changelog
…simplify `parsing_action` and `_reduce` logic, add test, update changelog
…aid rendering, and add test for shape handling
…arsing of elementary functions, update tests and changelog
@m-messer
m-messer merged commit 2f8af90 into main Oct 19, 2026
8 checks passed
@m-messer
m-messer deleted the fix/rc3-review-findings branch October 19, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant