-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
backend_driver.py overhaul #8069
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
Conversation
Given how you keep hitting this file in your docathon PRs, I think we should merge this sooner rather than later. |
Okay, I think this is almost good to go. The only thing I have left to do is to actually run this on a variety of backends and update the files to exclude. If anyone else wants a go, feel free to push to my branch with files to exclude. |
Is this complete? Do you want to rebase and squash a bit? There are a quite a few commits for just one file change. In any case, a rebase is needed because of the conflicts. |
I think this is almost done, I'll give it a squash/rebase/check sometime soon. |
17664d0
to
5a0ed16
Compare
There's a big ol' squash, I will test this on Testing on other backends can probably then be added a 'new contributor friendly' issue. |
Right, this is now working fully on Current todo, which I think could each be opened as new-contributor-friendly issues:
|
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 otherwise.
This file should probably be moved to the tools folder. |
@NelleV would you mind if I added that move to "Re-factor so running the script works if not in the examples/tests directory"? It seems a logical thing to do at the same time. |
Are you referring to a different PR? |
Sorry, I'm referring to my mini todo list here in my above comment #8069 (comment) |
d22326d
to
1d19358
Compare
I have rebased this on to current |
Current output: Some of these are because the existing
|
28e8c12
to
a51cfc8
Compare
I would just run the file as it is, without trying to play with stripped lines. sys.path can by set by PYTHONPATH and the backend can be set by MPLBACKEND (and if the backend is Agg, then plt.show() is already a noop). If we worry about spurious savefigs (which we probably should indeed, we should just move to a tmpdir before running the examples (and we can append importing savefig and calling savefig). Examples that need to call np.seterr should do so themselves. Edit: I was worried this would fail if the example explicitly wanted to set a backend itself but it looks like it can actually do that:
works. |
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.
Maybe rethink how we handle the imports and removing show.
punting to 2.2 |
fa939b7
to
1c9f576
Compare
Attempting to revive this, so I've rebased. I think it's really quite a useful thing to be able to check all the examples run properly. |
Remove old pylab option Do plt. search for lines to strip PEP8 Print fname if excluding Use pylab_examples as default directory Create file and directory list in same loop Add docstring to end of --help Remove reporting of missing tests By default test all discovered files Don't test user interface examples Properly exclued excluded files Clean up configuration of files to not run dict formatting backend_driver fixes Use argparser Use argparse better Revert wrong changes Remove redundant elif
These are demos that require user interaction
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 cleanup itself looks technically good (and it's not critical anyway as this is not part of the shipped library).
I'm wondering though, how realistic this is when we leave out the rendering. Would it make sense to always use savefig? OTOH, this feels like a reimplementation of sphinx-gallery. Can't we use just that for testing?
That's a good point, this PR is so old that it pre-dates sphinx-gallery (at least used by us). Maybe it is obsolete now. On the other hand, probably no harm in merging this and making the script useable (as you say). |
Replaced by #17226. |
🎉 happy that this (or a variant on it) finally ended up being merged! |
Whilst doing some documentation changes, I noticed
backend_driver.py
is very out of date. Annoyingly each example has to be explicitly set in the file for it to be tested. This PR updatesbackend_driver.py
to:plt.show
calls etc.In the future this file might be a way provide a good way of benchmarking (#2188) by timing how long all the examples take to run.