Skip to content

Make sagelib compatible with mpmath 1.4#41728

Merged
vbraun merged 26 commits intosagemath:developfrom
antonio-rojas:mpmath-1.4
Mar 22, 2026
Merged

Make sagelib compatible with mpmath 1.4#41728
vbraun merged 26 commits intosagemath:developfrom
antonio-rojas:mpmath-1.4

Conversation

@antonio-rojas
Copy link
Copy Markdown
Contributor

pick sagelib changes from #40669 and #38565 for mpmath 1.4 compatibility

@antonio-rojas antonio-rojas marked this pull request as draft February 27, 2026 23:52
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 28, 2026

Documentation preview for this PR (built with commit d7314e9; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@orlitzky
Copy link
Copy Markdown
Contributor

We'll need to bump the version requirement to >= 1.4 in pyproject.toml, too.

The difference comes from not using MPMATH_SAGE, not from the version upgrade
@antonio-rojas antonio-rojas marked this pull request as ready for review February 28, 2026 08:29
@antonio-rojas
Copy link
Copy Markdown
Contributor Author

We'll need to bump the version requirement to >= 1.4 in pyproject.toml, too.

Well, the idea is that this should work with older mpmath too. Otherwise it doesn't make sense to split it from the sage-the-distro upgrade. I think it's too soon to require 1.4, which was just released.

It's not optional
@orlitzky
Copy link
Copy Markdown
Contributor

Well, the idea is that this should work with older mpmath too.

I tried this in #41014, and while I'm sure it can be done (I got it working with the meson build but gave up due to repeated CI failures I couldn't reproduce), it requires a lot more work. The tests are not too bad, but a different set of C extensions are compiled when v1.3 is installed, and utils.pyx has a different set of cimports.

@antonio-rojas
Copy link
Copy Markdown
Contributor Author

Well, the idea is that this should work with older mpmath too.

I tried this in #41014, and while I'm sure it can be done (I got it working with the meson build but gave up due to repeated CI failures I couldn't reproduce), it requires a lot more work. The tests are not too bad, but a different set of C extensions are compiled when v1.3 is installed, and utils.pyx has a different set of cimports.

CI is fine with 1.3. Can you give more details about that different set of C extensions you mention, and what does it break?

@orlitzky
Copy link
Copy Markdown
Contributor

orlitzky commented Mar 1, 2026

There is a circular dependency between mpmath-1.3 and the portion of sage.libs.mpmath.utils that was deleted, but in the end it's not doing much and it looks like I was wasting my time trying to preserve it for backwards-compatibility. I just spent a while trying to cause problems and couldn't do it without essentially setting CAUSE_PROBLEMS=1 in my environment.

Someone added a guard to mpmath a few years ago to disable the sage backend when SAGE_ROOT is not set, and SAGE_ROOT is obsolete / meaningless outside of the sage distro. Inside the sage distro, MPMATH_NOSAGE disables it.
In either case, with the sage backend disabled in v1.3, there is a GMP backend that will be used instead unless you explicitly disable that. (I only ran trivial addition and multiplication tests, but the GMP backend didn't look any slower than sage). After upgrading from 1.3 -> 1.4, the sage backend ceases to exist, so you'll get the GMP backend there too unless you've explicitly disabled it.

vbraun pushed a commit to vbraun/sage that referenced this pull request Mar 6, 2026
sagemathgh-41728: Make sagelib compatible with mpmath 1.4
    
pick sagelib changes from sagemath#40669
and sagemath#38565 for mpmath 1.4
compatibility
    
URL: sagemath#41728
Reported by: Antonio Rojas
Reviewer(s):
@cxzhong cxzhong added p: CI fix merged before running CI tests and removed p: CI fix merged before running CI tests labels Mar 10, 2026
vbraun pushed a commit to vbraun/sage that referenced this pull request Mar 15, 2026
sagemathgh-41728: Make sagelib compatible with mpmath 1.4
    
pick sagelib changes from sagemath#40669
and sagemath#38565 for mpmath 1.4
compatibility
    
URL: sagemath#41728
Reported by: Antonio Rojas
Reviewer(s):
vbraun pushed a commit to vbraun/sage that referenced this pull request Mar 18, 2026
sagemathgh-41728: Make sagelib compatible with mpmath 1.4
    
pick sagelib changes from sagemath#40669
and sagemath#38565 for mpmath 1.4
compatibility
    
URL: sagemath#41728
Reported by: Antonio Rojas
Reviewer(s):
vbraun pushed a commit to vbraun/sage that referenced this pull request Mar 21, 2026
sagemathgh-41728: Make sagelib compatible with mpmath 1.4
    
pick sagelib changes from sagemath#40669
and sagemath#38565 for mpmath 1.4
compatibility
    
URL: sagemath#41728
Reported by: Antonio Rojas
Reviewer(s):
@vbraun vbraun merged commit 5949d61 into sagemath:develop Mar 22, 2026
31 of 33 checks passed
@antonio-rojas antonio-rojas deleted the mpmath-1.4 branch March 22, 2026 23:00
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.

6 participants