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
ENH: determine compatible matplotlib backend semi-dynamically. Incidentally add support for .svgz image format. #3410
ENH: determine compatible matplotlib backend semi-dynamically. Incidentally add support for .svgz image format. #3410
Conversation
6b22c98
to
49f7441
Compare
49f7441
to
fddabf9
Compare
@yt-fido test this please |
I don't remember why you triggered a new job on Jenkins, but I imagine you'd like to revisit this, @Xarthisius ? |
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; pending question about idioms, good to merge.
if s in cls.get_supported_filetypes(): | ||
return cls | ||
raise RuntimeError( | ||
"Something went terribly wrong. " |
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.
terribly wrong
:)
|
||
|
||
def normalize_extension_string(s: str) -> str: | ||
return f".{s.lstrip('.')}" | ||
if sys.version_info < (3, 9): |
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.
Is this the idiomatic way?
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.
Yes. It is so idiomatic that it's the only way pyupgrade
knows how to clean https://github.com/asottile/pyupgrade#python2-and-old-python3x-blocks
in fact, see : asottile/pyupgrade#530
(notice me sempai !)
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.
sounds good
I'm good with this post resolution |
Alright I'll resolve the conflict now and come back later to rettriger Jenkins ! |
…ntally add support for .svgz image format.
fddabf9
to
1150fd6
Compare
@matthewturk I assume you'd want to use the auto-merge button here :) |
@yt-fido test this please |
@meeseeksdev backport to yt-4.0.x |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove If these instruction are inaccurate, feel free to suggest an improvement. |
@meeseeksdev backport to yt-4.0.x |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove If these instruction are inaccurate, feel free to suggest an improvement. |
Backporting this manually with a risk of introducing a new bug in handling the conflict doesn't seem worth it, I'll remove the "Needs Manual Backport label" |
…_format_support ENH: determine compatible matplotlib backend semi-dynamically. Incidentally add support for .svgz image format.
PR Summary
Drop a hard-coded list of supported file formats and discover them at runtime via Matplotlib instead.
Incidentally, this adds support for saving to .svgz, which is compatible with
FigureCanvasSVG
but was left outon our side, likely because it wasn't a thing at the time this code was written. The list of supported file format will then naturally expand if more formats are added upstream, and reciprocally, this avoids creating a situation where we list a format as supported even though it requires a more recent version of Matplotlib than is installed.
This refactor passes yt/visualization/tests/test_commons.py
for reproduction:
fails on the main branch, but succeeds here