-
-
Notifications
You must be signed in to change notification settings - Fork 8k
migrate examples to sphinx-gallery #8472
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
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.
two _sgskip suffix in filename
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.
good catch - ran my script one too many times :)
(I'll fix these and will overwrite the commit so that we don't have tons and tons of changes)
If you have this automated, I would suggest switching everything as you suggested, send to travis+appveyor to see what needs to be renamed, rename the minimal set, and then for later PRs have a very liberal policy of docstring fixes and removal of old examples.
@anntzer sounds good - I'll take a stab at this and we can look at how well it does the conversion. Seems to be working reasonably well (famous last words)
238a0a8
to
69c8e6b
Compare
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.
Why delete this?
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.
accidental delete in this push - it'll be back in the next one. However if the examples are ever built entirely from sphinx gallery, I don't believe these lines will be necessary anymore
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.
oops just realized you were talking about the whole file and not just the noplot
line...I just meant noplot
won't be needed with sphinx gallery
527dbbe
to
3bac105
Compare
ok that took a bit more work than I expected :)
BUT, I think that the examples should be more or less good to go now. I'm sure there are some things that I've missed, so let's see if they build properly and I can spot check some fixes if needed tomorrow.
If this is not too much work (hehe...), could you consider rewriting the history so that this is easier to review?
Specifically
- one commit with all the automated changes -- either put the script in the commit message if it's short enough, or just describe what it did. This way I can simply skim through the diff and trust that it is the automated output.
- one or more commits with the manual changes that actually need to be reviewed.
git rebase -i may be helpful :-) Alternatively, you can copy the entire repo in its current state, go back to master, apply the automated changes, commit, overwrite the repo with the copy that also has the manual changes, and commit again.
3bac105
to
a335738
Compare
@anntzer fair point - this is a lot of files to change :)
I just went through and rebased onto master + squashed some commits. So now there are 3 commits: 1 that just changes the regex match, 1 that contains most of the auto stuff, 1 that has more manual tweaks, renaming, ensuring links work, etc.
The docs build on my machine, so hopefully the same will be true for travis.
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.
You could use slightly more lightweight markup: https://thomas-cokelaer.info/tutorials/sphinx/rest_syntax.html#how-to-include-simple-code
Same comment applies throughout the 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.
yeah there were examples where just a tab was being used, and it seemed to keep causing errors. so adding the .. code::
just ensured that it worked.
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.
ahh I see what I was getting wrong before - I wasn't adding the ::
at the end of paragraphs. will switch this back, agree it's cleaner
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.
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.
a properly set table would be nice here too
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.
sgskip is not enough? should this be reported as an issue with s-g?
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.
already did this ;) sphinx-gallery/sphinx-gallery#224
Also just a quick rehash of the scope of this PR
I would suggest switching everything as you suggested, send to travis+appveyor to see what needs to be renamed, rename the minimal set, and then for later PRs have a very liberal policy of docstring fixes and removal of old examples.
I think the goal here is to get all the examples working / displaying in the gallery (and potentially to deprecate the examples page, since at this point they will be copies of one another, I think...).
For formatting improvements in docstrings, etc I think we should have an issue to keep track of these things that can be tackled in future PRs (unless there aren't too many in which case I can fix them)
Sure, that's why I'm 1. not blocking on these changes, and 2. only suggesting a few improvements to the manually edited parts of the markup.
Cool! Just making sure we're all on the same page :) I think it was a good idea to squash into one auto commit and one manual commit.
a335738
to
adcb2d0
Compare
latest push removes the .. code::
blocks and formats the tables you pointed out
adcb2d0
to
04aa84f
Compare
It looks like the builds are passing on travis (!!!)
Shall we take care of small things in subsequent PRs?
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.
conditional on appveyor passing
Woot, tests passing. Anyone wanna take a look? @phobson or @dopplershift? I think we are in good shape with this given that there will be some subsequent prs to clean things up.
Sorry, I broke this by merging a different PR :(
04aa84f
to
eee5fd0
Compare
just pushed a rebase - I think the problem was in the file getting renamed, should be fixed now
@choldgraf Looks like we've still got merge conflict. I should be able to take a good long look at this tomorrow night.
eee5fd0
to
8e7857b
Compare
OK just rebased again.
I think that was actually another new file that got merged after I had rebased the last time :P I think this is going to keep happening since there are so many files changed in this PR.
@phobson another option is to get this merged and then I can spend a little time tomorrow on converting the remaining examples to mpl_examples
etc and we can do a review on that. LMK what you think is best.
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.
Stuff to fix; probably not 100% comprehensive. Can be done here or in another PR.
examples/api/agg_oo_sgskip.py
Outdated
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.
Extra line.
examples/api/font_file_sgskip.py
Outdated
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.
Extra line.
examples/axes_grid1/demo_axes_rgb.py
Outdated
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.
Capitalize RGB.
examples/event_handling/pipong.py
Outdated
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.
Matplotlib
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.
Link is dead.
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.
Capitalize GTK.
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.
Capitalize GTK.
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.
Capitalize SVG.
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.
Capitalize SVG.
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.
ToolManager
ok...I'll spot check those points from @QuLogic ...after that it would be great if we could get this PR merged because I don't want to keep having to rebase every 30 minutes.
8e7857b
to
bf8cb51
Compare
bf8cb51
to
d9268bd
Compare
ok the changes have been made per @QuLogic 's suggestions
I'm pretty sure that one Travis failure is not related to these changes. Since these were all tiny changes, and since appveyor was passing on the last iteration, can we assume it will follow suit?
looks like tests are all passing...
Now that sphinx gallery is active on the dev docs, I think we should try to use the momentum to get the rest of the examples building with SG.
Since there are many, many examples, I've taken a stab at semi-automatic the conversion process so that the current examples will build with SG. This PR does this for one folder of the examples so we can see what it looks like.
Basically, the only thing we need for SG to build an example is a title header at the top of each example. Ideally we'd also like to have a comment below it, though a blank line is fine if there is no comment. To that extent here's roughly what the automation does:
_
, capitalize the first letter of each word. That’s the title._sgskip
to the filename._sgskip
in them.This seems to do a pretty good job of converting the examples and generating descriptions when possible. Basically, this will give us >= whatever the current non-SG examples setup is doing.
If folks (maybe @anntzer and @dopplershift ?) could give some thoughts on this approach, and if we think this is a good shot at doing conversion, then I can do it for the rest of the examples and we can have a fully functioning sphinx gallery!