-
-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sagemath-mpmath #35906
sagemath-mpmath #35906
Conversation
f1f81fb
to
53ec31a
Compare
Documentation preview for this PR (built with commit 1e3218c; changes) is ready! 🎉 |
what kinds of simplifications could be done on |
I would suggest that they remove the condition Other than that, I don't think anything gets simpler for mpmath itself; but for users of mpmath and Sage, the situation becomes clearer and more robust. |
I don't like vendoring, and this looks way overblown anyway. |
before doing anything here, we should check whether just getting rid of Sage backend in mpmath (which is a very old hack) is the right thing to do. I.e. whether there is a serious speed regression, something I doubt. |
+1. Do you know how to benchmark it, or should we get help from upstream? |
it's a mixed bag - some tests are slower, some are faster. E.g. here are 5 slowest tests from
So overall with Sage backend it's about 20% faster. OTOH one test there is must faster without Sage backend:
|
build/pkgs/vendoring/dependencies
Outdated
@@ -0,0 +1,4 @@ | |||
$(PYTHON) rich click toml | $(PYTHON_TOOLCHAIN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no toml
package in Sage. Should this be tomli
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the toml package was removed from Sage in the meantime; we'll have to re-add it for sagemath-mpmath
@@ -0,0 +1,4 @@ | |||
$(PYTHON) markdown_it_py | $(PYTHON_TOOLCHAIN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to require poetry-core
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not any more, I've now made it a wheel package, so there's no more build dependency.
4f66aaa
to
984cf52
Compare
984cf52
to
efaffe6
Compare
…o run vendoring script # Conflicts: # build/pkgs/sagelib/dependencies
…SymPy) does not use Sage types
pkgs/sagemath-mpmath/pyproject.toml.m4: Protect the nodoctest file
…install, do not erase sage in site-packages
…py files in doctest
efaffe6
to
0527c26
Compare
partially squashed |
@dimpase, I assume you did tests without gmpy2. Is there advantages of using sage backend c.f. gmpy?
Which will be a simplest solution for mpmath/mpmath#705... |
Closing this PR as this change appears to be slated for inclusion in mpmath 1.4: |
📚 Description
Instead of relying on mpmath's mechanism to select a backend, which is problematic when other libraries use mpmath too (#25445), we create an isolated copy of mpmath in
sage.libs.mpmath._vendor.mpmath
. The copy is created at build/sdist time using the pypa vendoring tool; we do not put a copy of the sources into our git source tree.All uses of mpmath in the Sage library are updated. The Sage library no longer imports from
mpmath
and no longer sets environment variables that forcempmath
(when imported by another library) to use the Sage backend.The library is intended to be shipped by the pip-installable distribution sagemath-mpmath (added here on the PR), which only has sagemath-categories as a Python dependency.
Downstream projects that wish to use this version of mpmath should declare a dependency (install-requires) on sagemath-mpmath and use
import sage.libs.mpmath.all
instead ofimport mpmath
.📝 Checklist
⌛ Dependencies