-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
get_backend() backward compatibility #11852
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
Comments
The issue is #11600 (comment) and I think (quite strongly) that it makes sense for |
I don't really care too much what type |
I don't understand this. I am on v3.0.0rc1 on my git version but |
That's likely because this should only happen if you don't have a backend set in your matplotlibrc. |
That seems like a strange api to me. Why do it return an object when the backend is not set and not for example
Why? The docstring for |
As explained above, it's a bug (IMO) and should be fixed. |
The simplest fix may be to switch the sentinel to the string I would prefer that if we keep the non-string sentinel that the backend resolution logic moves up to |
Closing this in favor of #11844 which is addressing a slightly larger set of issues to keep the discussion from getting too fragmented. |
Under matplotlib 3.0.0rc1, the return value of matplotlib.get_backend() is a sentinel object:
Under matplotlib 2.2.3 I get:
For backward compatibility purposes it would be really nice if matplotlib 3.0.0 could return an object that at least acted like a string. In particular right now I'd like it to have a
lower()
method. I'd also like it if it had a nice__repr__
or__str__
implementation instead of printing out as an opaque object of typeobject
.The former is for backward compatibility, as the change breaks some of the yt plotting code --- in particular here's a failure from the test suite:
This is code that's internal to yt's test suite, but I wouldn't be at all surprised if there's other code out there that assumes
matplotlib.get_backend()
returns a string. For example:https://github.com/search?q=matplotlib+get_backend+lower&type=Code
The text was updated successfully, but these errors were encountered: