-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add pep 519 #8481
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
Add pep 519 #8481
Conversation
Only quickly skimmed through this, so I may have missed something. |
I am not sure, I just rebased @aragilar PR ... |
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.
We should figure out whether this fspath_no_except business is actually needed.
_png.write_png(renderer._renderer, filename_or_obj, | ||
self.figure.dpi, metadata=metadata) | ||
_png.write_png( | ||
renderer._renderer, fspath_no_except(filename_or_obj), |
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 conversion should almost certainly occur higher, around line 554.
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.
Yeah, that looks wrong, I don't remember why I did this...
Sorry, this kinda dropped off my todo list... The logic behind fspath_no_except was that there were numerous places where matplotlib allowed either strings/unicode/bytes (which fspath is fine with), or actual files, which fspath would blow up on. fspath_no_except allows them to pass through with no issues. It's written in such a way that when matplotlib drops support for older python versions, the backport of fspath can just be removed without any reworking. |
That makes sense. This is short enough I would rather vendor this than pick up another tiny dependency. |
@@ -349,6 +350,7 @@ def _run(self): | |||
output = sys.stdout | |||
else: | |||
output = subprocess.PIPE | |||
command = [fspath_no_except(cmd) for cmd in command] |
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 should probably just be done on self.output
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.
or even better to matplotlib.compat.{Popen,check_output}:
subprocess.Popen([Path("ls"), Path("-a"), Path(".")])
works (even though this is arguably silly...)
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.
by 'output', I think I meant 'outfile'..
I still think there should be a better way than fspath_no_except, but don't block on that.
Thank you so much for your PR! To help us review, fill out the form to the best of your ability. Also, please make use of the development guide at http://matplotlib.org/devdocs/devel/index.html
Replaces #6788 to support the Path protocol (pep 519)
PR Summary
PR Checklist