Skip to content

Minor improvements to mechanics of example gallery - #4924

Merged
eteq merged 2 commits into
astropy:masterfrom
eteq:gallery-tweaks
May 19, 2016
Merged

eteq merged 2 commits into
astropy:masterfrom
eteq:gallery-tweaks

Conversation

@eteq

@eteq eteq commented May 16, 2016

Copy link
Copy Markdown
Member

This PR makes two changes to the new example gallery.

  1. Inspired by @MSeifert04's Fix RTD build #4915 (comment), the first commit makes it so that the docs still build even of the gallery extension doesn't exist. Turns out this was easier than I feared. The down side is that it leads to a bunch of additional warnings because the gallery extension generates a bunch of documents that are linked to elsewhere in the docs, and of course they don't exist if the extension is missing. So there's a bunch of "broken link" warnings without the extension. But this is still probably a change that's worth doing to make quick doc-building a bit easier, do you agree @adrn?
  2. The second commit re-arranges where the build products of the gallery extension land, so that they're all in docs/generated/<something>. I think this is more clear, and on top of that, it makes it easier to work cleanly with the -l argument of python setup.py build_sphinx. Will issue a PR against astropy_helpers shortly to close the loop on that. Does this re-organization sound ok to you, @adrn ?

@eteq

eteq commented May 16, 2016

Copy link
Copy Markdown
Member Author

(the travis failure is a red herring due to #4908 - just fixed it in master)

@eteq eteq mentioned this pull request May 16, 2016
Comment thread docs/conf.py
'mod_example_dir': 'generated/modules', # path to store the module using example template
'filename_pattern': '^((?!skip_).)*$', # execute all examples except those that start with "skip_"
'examples_dirs': '..{}examples'.format(os.sep), # path to the examples scripts
'gallery_dirs': 'generated/examples', # path to save gallery generated examples

@bsipocz bsipocz May 16, 2016 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about putting it into the same place the rest of the generated docs, e.g. docs/_build/generated? Although I can see similarity with docs/api that also contains generated stuff and doesn't live in the build directory (although I think it also should).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recently changed this for SunPy so that it results in a nice URL for the gallery: http://docs.sunpy.org/en/latest/gallery/ which is maybe something to think about.

@eteq eteq May 16, 2016 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bsipocz - I thought the same at first, but decided not because that yields the final HTML urls as "docs.astropy.org/en/stable/_build/generated/whatever.html" which is rather ugly and reveals "implementation details" in the final product.

@Cadair - I could also change it just gallery (or better yet examples, because I think "gallery" is a less-clear term for this... gallery of what?), but that then means that the sphinx command has to include gallery/example. I think it's better to be consistent and put all generated things in generated, so that poor users who don't know sphinx very well can tell that that's where the generated things show up. (One could imagine also moving the API to generated/api... But my thinking is that there are already lots of things on the web using the docs.astropy.org/en/stable/api/... URL, so it's better to maintain backwards compatibility)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, I share the preference of having cleaner, nicer URLs, and I didn't think about it when wrote the comment.

@eteq

eteq commented May 16, 2016

Copy link
Copy Markdown
Member Author

Oh, and @Cadair - one thing you comment above implies is that python setup.py build_sphinx -l does not actually clear out the example gallery in sunpy... so it might make sense for to agree on the convention so that the helpers can do it right.

@Cadair

Cadair commented May 16, 2016

Copy link
Copy Markdown
Member

@eteq yes that's true, it will not. I do like the idea of having a nice URL for the examples gallery. I think a little pain for the developers is worth it for the end user.

@pllim pllim added the Docs label May 16, 2016
@eteq

eteq commented May 16, 2016

Copy link
Copy Markdown
Member Author

@Cadair - well, it's not just a "little pain for the developers", it's a standard location to put generated things in to allow other ideas like sphinx-gallery to happen without someone manually going in and issuing a PR to astropy_helpers. We could imagine setting up a way to "register" which directories are to be cleaned I supposed... but that seems complicated.

Also I think it's important for advanced users/novice devs who have reason to try to build the docs themselves. A very common confusion I see in sphinx is a misunderstanding about what is generated and what is "real" content. So this is a way to be a bit more transparent.

But this is all driven by the fact that I don't really see generated/gallery/ as much different from gallery/ in terms of "nice URL". I guess maybe you think otherwise?

@eteq eteq added this to the v1.2.0 milestone May 16, 2016
@mhvk

mhvk commented May 17, 2016

Copy link
Copy Markdown
Contributor

👍 to not making gallery essential for building the docs, or to anything really that makes testing building the docs as easy as it is to test the code... As is, I find it rather complicated to check locally whether the documentation builds (in the sense that I get warnings which don't appear on travis).

@adrn

adrn commented May 17, 2016

Copy link
Copy Markdown
Member

@eteq 👍 nice! This seems like a sensible idea - thanks!

@mhvk mhvk mentioned this pull request May 19, 2016
@eteq

eteq commented May 19, 2016

Copy link
Copy Markdown
Member Author

(travis is a red herring - an unrelated problem in master)

Had an out-of-band conversation with @Cadair and he agrees generated makes sense, but also wants the api to go into generated/api. I'll merge this now to get things going again, but there might be a follow-on PR to move api (which we can discuss there).

@eteq
eteq merged commit 8818327 into astropy:master May 19, 2016
@eteq
eteq deleted the gallery-tweaks branch May 19, 2016 21:57
@eteq eteq mentioned this pull request May 19, 2016
13 of 14 tasks
Cadair added a commit to Cadair/sunpy that referenced this pull request May 20, 2016
@astrofrog astrofrog added the Affects-dev PRs and issues that do not impact an existing Astropy release label May 30, 2016
astrofrog pushed a commit that referenced this pull request May 30, 2016
Minor improvements to mechanics of example  gallery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Affects-dev PRs and issues that do not impact an existing Astropy release Docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants