Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Migration to sphinx-gallery#8247

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
NelleV wants to merge21 commits intomatplotlib:masterfromNelleV:sphinx_gallery
Closed

Migration to sphinx-gallery#8247

NelleV wants to merge21 commits intomatplotlib:masterfromNelleV:sphinx_gallery

Conversation

NelleV
Copy link
Member

@NelleVNelleV commentedMar 9, 2017
edited
Loading

This work is still in progress.

Right now, the documentation builds two gallery. The old one, which stays identical as on current master and a sphinx-gallery one. The sphinx-gallery one needs specific examples formatting, hence only includes so far a subset of our example.

I'll slowly update this PR with progress and build this on a local website to show how it looks. Once we decide it is "good enough", the switch can easily be done through a URL switch.

Here is the sphinx-gallery build

@NelleVNelleV added the MEP: MEP12gallery and examples improvements labelMar 11, 2017
@NelleVNelleV changed the title[WIP] Migration to sphinx-gallery[MRG] Migration to sphinx-galleryMar 23, 2017
@tacaswelltacaswell changed the title[MRG] Migration to sphinx-gallery[MRG+1] Migration to sphinx-galleryMar 23, 2017
Copy link
Member

@tacaswelltacaswell left a comment

Choose a reason for hiding this comment

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

I still have reservations about needing to re-name all of the examples, but the benefits out weigh the cost.

@@ -12,3 +12,4 @@ ipython
mock
colorspacious
pillow
sphinx-gallery
Copy link
Member

Choose a reason for hiding this comment

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

we need to add graphviz to this list

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

unfortunately, we can't as this file is meant to be used by pip, and graphviz is not pip installable.

@QuLogicQuLogic added this to the2.1 (next point release) milestoneMar 24, 2017
@@ -30,7 +30,7 @@ if [[ $BUILD_DOCS == false ]]; then
fi
else
cd doc
python make.py html -n 2
python make.py html
Copy link
Member

Choose a reason for hiding this comment

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

Does parallel build not work?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

No, but ironically, the parallel build doesn't change the run time :D
We can easily activate the flags in sphinx-gallery to make it parallel-safe, but considering there is no gain at all, I haven't created the PR yet.
Actually making the code parallel requires more work, but should be doable.

Copy link
Member

Choose a reason for hiding this comment

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

I I have definitely seen good speed up on building the docs (as they are now) but have found you need to use ~2x the number of workers compared to the number of core.

doc/conf.py Outdated
@@ -54,6 +55,12 @@
"numpydoc to build the documentation.")

try:
import sphinx_gallery
except ImportError:
raise ImportError("No module named sphinx-gallery - you need to install "
Copy link
Member

Choose a reason for hiding this comment

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

The module is calledsphinx_gallery.

doc/conf.py Outdated
import sphinx_gallery
except ImportError:
raise ImportError("No module named sphinx-gallery - you need to install "
"numpydoc to build the documentation.")
Copy link
Member

Choose a reason for hiding this comment

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

Need to installsphinx-gallery, notnumpydoc.

# path to your examples scripts
'examples_dirs' : '../examples',
# path where to save gallery generated examples
'gallery_dirs' : 'auto_examples'}
Copy link
Member

Choose a reason for hiding this comment

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

Can we not put it ingallery instead? Or if it werempl_examples, then some of the lines that were changed would not have been necessary.

Whatever it becomes, I don't like theauto_ prefix; it's an internal concern and doesn't really make any sense to present that in the URL to a user from a semantic point of view.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

It's the default and is a convention followed by many (if not all) the projects. I'd rather stick with it for consistency.
We can't rename this to mpl_examples as mpl_examples still exists.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure those are compelling reasons. I went back through the blame 7 years and couldn't find any reasoning behind it (that's not to say that there wasn't one.) My reasoning here is that URLs should be discoverable, simple, and at least try to give some semantic meaning.

A user might go tomatplotlib.org/gallery ormatplotlib.org/examples directly (yes, there's Google, but let's assume they're not using it for some reason), but there's a 99% chance that no-one will spontaneously go tomatplotlib.org/auto_examples.

And what does the "auto_" prefix mean? It means that the rst was automatically generated from the example Python code. This is a meaningless distinction to a user. When they see "auto", they see "automatically generated" aka "not hand-written" aka "not very good". I'm not going to claim that all of our examples are 100% clear, but they've all been hand-written in some fashion, and some of them are even quite amazing.

In fact, for that same reasoning, I've just talked myself into retracting the "mpl_examples" suggestion, since the "mpl_" prefix is redundant and meaningless in this context. Also, our existing site usesmatplotlib.org/examples/ andmatplotlib.org/gallery.html; I don't think we should break that.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

For the time being, the folder cannot be neither "examples" nor "mpl_examples", and this will not change in the foreseeable future considering the state of our examples (unless we remove all examples that are not SG compatible).

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not possible to rename the current examples/mpl_examples to make room for the gallery-based examples? I strongly dislike theauto_examples name as well--I've overridden that name for sphinx-gallery in my own projects.

Copy link
Member

Choose a reason for hiding this comment

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

Will this end up exposed in the URL?

If so, I think we should pick something either a) shorter (exsg orae) or b) something more meaningful.

Copy link
Contributor

Choose a reason for hiding this comment

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

I does show up in the URL, for examplethis is our gallery at MNE-python. It does have auto-examples in the page, though that's sorta become the convention with sphinx-gallery (same goes for scikit-learn:http://scikit-learn.org/stable/auto_examples/index.html).

I seem to remember conversations with folks that this was a non-trivial thing to change but I could be wrong...it's been working out well enough for us. If you want you could use an.rst file that contains the gallery itself, then the objects that the gallery links to would be in theauto_examples folder.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nope, it's completely trivial to change:https://unidata.github.io/MetPy/examples/index.html

I'm going to argue one more timeNOT to useauto_examples. Whether they're generated automatically or not is immaterial to the user, so we should NOT be bleeding that implementation detail of our documentation build procedure to the outside world.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

It's not that trivial, because matplotlib somehow does I don't know what in the plot directive that makes this a pain in the butt to change. Which is why I asked for feedback a month ago.

Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW I'll give this a shot to change the name toexamples_gallery. It doesn't look completely trivial in the sense that there are links hard-coded all over the codebase. There are also some weird errors happening inside the plot directive that I can try to debug. I'll open a separate PR then if I can figure it out.

# path where to save gallery generated examples
'gallery_dirs' : 'auto_examples'}

plot_gallery = True
Copy link
Member

Choose a reason for hiding this comment

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

Blank line after.

# Sphinx gallery configuration
sphinx_gallery_conf = {
# path to your examples scripts
'examples_dirs' : '../examples',
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean we can delete thempl_examples symlink?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Not yet. Our plot directive writes into mpl_examples, and unfortunately we have a bit more work to do before getting rid of this (including more examples to migrate). This will be my next step.

@QuLogic
Copy link
Member

Is there a way to make sphinx-gallery less verbose? It prints out that it's going to run an example, then that it ran the example and how long it took plus a blank line, then at the end, it prints out how long it took to run all the examples again. That's 4 lines for each example.

tacaswell reacted with thumbs up emoji

@NelleV
Copy link
MemberAuthor

I don't think there is a way to make sphinx-gallery less verbose. It also doesn't bother me: it's actually great for debugging.

- Added sphinx-gallery to doc/conf.y- Renamed all conflicting README.txt to README in our example folders
@choldgraf
Copy link
Contributor

Looking forward to seeing this get merged into the website! Once it's merged I can spend a little time trying to create more narrative-driven examples out of the ones that are there and generally improving them. Is there anything holding this back right now?

@@ -75,7 +75,8 @@
<p>Matplotlib tries to make easy things easy and hard things possible.
You can generate plots, histograms, power spectra, bar charts,
errorcharts, scatterplots, etc., with just a few lines of code.
For a sampling, see the <a href="{{ pathto('users/screenshots') }}">screenshots</a>, <a href="{{ pathto('gallery') }}">thumbnail</a> gallery, and
For a sampling, see the <a href="{{ pathto('users/screenshots')
}}">screenshots</a>, <a href="{{ pathto('auto_examples/index') }}">thumbnail</a> gallery, and
Copy link
Member

Choose a reason for hiding this comment

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

I assume the linebreak does not affect the templating?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

No, it works fine

@NelleVNelleV closed thisApr 10, 2017
@NelleV
Copy link
MemberAuthor

Chris is taking over this work. I don't have time and the energy to continue working on matplotlib's migration to sphinx-gallery.

@QuLogicQuLogic changed the title[MRG+1] Migration to sphinx-galleryMigration to sphinx-galleryApr 30, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell approved these changes

@dopplershiftdopplershiftdopplershift left review comments

@QuLogicQuLogicQuLogic left review comments

@choldgrafcholdgrafcholdgraf left review comments

@phobsonphobsonphobson approved these changes

Assignees
No one assigned
Labels
DocumentationMEP: MEP12gallery and examples improvementsstatus: duplicate
Projects
None yet
Milestone
v2.1
Development

Successfully merging this pull request may close these issues.

7 participants
@NelleV@QuLogic@choldgraf@tacaswell@dopplershift@phobson@dstansby

[8]ページ先頭

©2009-2025 Movatter.jp