-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
Support for matplotlib-3.8.0 #36279
Support for matplotlib-3.8.0 #36279
Conversation
56da40f
to
1986d9a
Compare
src/sage/plot/graphics.py
Outdated
@@ -36,6 +36,8 @@ | |||
# **************************************************************************** | |||
|
|||
import os | |||
import contextlib | |||
import numbers |
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 could probably be moved local to the function to avoid the import until someone needs it. But only if matplotlib()
is not called in a tight loop.
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.
numbers
is most probably already loaded, we just want to bring numbers.Integral
in scope so I replaced it with from numbers import Integral
. I don't see any difference between that and the next line from collections.abc import Iterable
, etc.
As your other suggestion, I'm not importing contextlib anymore so it's only that one.
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.
Ok, thanks, it's not too important. I know that new top-level imports can sometimes slow down sage at startup but it's something that can easily be profiled and refactored later if it is really an issue.
1986d9a
to
92a8a96
Compare
I t appears CI is using cython-3 which of course lead to failures. But the PR makes the doctest failures in |
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.
LGTM
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.
kiwifb approved this PR
Documentation preview for this PR (built with commit 92a8a96; changes) is ready! 🎉 |
sagemathgh-36320: Update `matplotlib` to 3.8.0, `pillow` to 10.0.1 <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes sagemath#1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes sagemath#12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [ ] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - sagemath#12345: short description why this is a dependency - sagemath#34567: ... --> - Depends on sagemath#34816 - Depends on sagemath#36279 - <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: sagemath#36320 Reported by: Matthias Köppe Reviewer(s): John H. Palmieri, Matthias Köppe
In matplotlib 3.8.0 there is a minor change that affects sagemath. The parameter to
loc
is supposed to be a string or an integer from 0 to 10 representing different positions. It used to work with sage integers, but now it doesn't.This PR fixes it by coercing any
numbers.Integral
type intoint
before calling matplotlib.