Refactoring manualintegrate by separating the solver from integration rules

10 views
Skip to first unread message

SalahDin Rezk

unread,
Jul 19, 2026, 1:56:49 PM (2 days ago) Jul 19
to sympy
Hello,

I've opened an RFC issue proposing a redesign of the internal architecture of manualintegrate: https://github.com/sympy/sympy/issues/30087.

The main idea is to separate the solver from the individual integration rules.
Currently, rules recursively invoke one another, which has led to a number of recurring problems over time: manual propagation of state (e.g. the recent branch contextvars work), loop detection, repeated transformations, and increasing coordination between rules despite there being no shared solver state.

The proposal is for rules to become largely stateless; they simply describe a single transformation, while a central solver manages recursion, branching, visited expressions, rule scheduling, rewrite preferences, and other global concerns.

This is not intended as a concrete implementation proposal yet, but rather as a discussion about whether this is the right long-term direction for manualintegrate. The issue also raises several design questions, including what state the solver should track and how rule priorities and branching should be represented.

I'd appreciate any thoughts or feedback, especially from people who have worked on the integration code before.

Thanks!
Reply all
Reply to author
Forward
0 new messages