Skip to content

Conversation

@Titan-C
Copy link
Member

@Titan-C Titan-C commented Dec 10, 2015

This PR need comments.
First there is the situation of how to deal with a broken build #45, discussion shall continue there.
Here I address, for the moment, that the traceback of a broken example should be also printed in the HTML output of the gallery following my comment on #65 (comment)

@agramfort
Copy link
Contributor

that's fine with me

other option is to stop the doc build with a meaningful crash message

@GaelVaroquaux
Copy link
Contributor

other option is to stop the doc build with a meaningful crash message

It should be controlled by an option (just like the building of the
gallery is).

@lesteve
Copy link
Member

lesteve commented Dec 14, 2015

other option is to stop the doc build with a meaningful crash message

It should be controlled by an option (just like the building of the gallery is).

My 2 cents: I think the current behaviour is fine for now. The general use case is to build all the examples to find all the broken ones rather than fail on the first error.

Something I would actually find useful (not sure how easy this is): have a special image for broken examples allowing them to identify quite easily in the gallery.

Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: in order not to do traceback.print_exc() and then traceback.format_exc() which is kind of doing the same thing twice, you can do:

formatted_exception = traceback.format_exc()

print(formatted_exception)

exception_msg = indent(formatted_exception, ' ' * 4)

@lesteve
Copy link
Member

lesteve commented Dec 17, 2015

Just tried this out and here is a snapshot:

sphinx_gallery_traceback

It would be nice to have a fixed-width font in the HTML traceback. This makes a huge difference for long tracebacks.

@Titan-C
Copy link
Member Author

Titan-C commented Dec 17, 2015

Now it's improved.
I painted the broken image that takes over in the gallery thumbnails on failed examples. And the traceback message is not anymore in the sphinx warning box that changes font style but uses just a container.

@lesteve
Copy link
Member

lesteve commented Dec 17, 2015

Now it's improved.
I painted the broken image that takes over in the gallery thumbnails on failed examples. And the traceback message is not anymore in the sphinx warning box that changes font style but uses just a container.

The image thing is quite nice, although we can think about tweaking the "broken" image.

I still get non fixed-width font in the warnings when generating the gallery locally though.

@Titan-C
Copy link
Member Author

Titan-C commented Dec 17, 2015

I still get non fixed-width font in the warnings when generating the gallery locally though.

No idea here. What does you browser tell you the CSS style is. The block shall be a sphx-glr-traceback. That one has no style for fonts. The example I'm providing gives me this

snapshot1

@lesteve
Copy link
Member

lesteve commented Dec 17, 2015

I have to say not sure whether the technical term for it is fixed-font or not but basically what I was trying to say is that I would have the same font in the traceback and in the code cell.

@Titan-C
Copy link
Member Author

Titan-C commented Dec 29, 2015

I would have the same font in the traceback and in the code cell.

I just learned that is syntax hightlighting for python traceback messages. Thus I'm making the traceback outputs be parsed as that. Plus an additional light red box to call attention is a traceback and that the example fails.

image

@Titan-C Titan-C force-pushed the Traceback branch 2 times, most recently from f363e74 to 2da5e45 Compare December 29, 2015 16:44
@Titan-C
Copy link
Member Author

Titan-C commented Dec 29, 2015

As here I change some CSS I would like PR #80 to be merged first. This branch is already rebased to it, but it did not generate a branch dependency as I expected.

@agramfort
Copy link
Contributor

is it possible to have the build stop if an example fails? to me that should be the default behavior. It happened to me too many times to push a website update with broken examples... it happens quickly when you have dozens of examples.

@Titan-C
Copy link
Member Author

Titan-C commented Jan 1, 2016

I added the quick fail option to break the gallery build process as soon as an example trows an Exception, added the documentation what to put in the makefile for that. But I have not made it the default behavior, as building the complete gallery and scanning for the broken examples visually from the rendered website seems more intuitive for me. You can vote on that.

Copy link
Contributor

Choose a reason for hiding this comment

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

visiulization

Copy link
Contributor

Choose a reason for hiding this comment

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

take -> takes

display -> to display

@agramfort
Copy link
Contributor

besides LGTM

Copy link
Contributor

Choose a reason for hiding this comment

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

For readability, I would suggest being explicit about the keyword argument here, by writing:

    ..., lang='pytb')

@GaelVaroquaux
Copy link
Contributor

I agree with your various design choices (in particular the default).

+1 for merge. I have suggested a tiny style change.

@agramfort
Copy link
Contributor

it's fine to merge as is for me

thx @Titan-C

doc/Makefile Outdated
Copy link
Member

Choose a reason for hiding this comment

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

maybe html-quick-fail in order not to mix - and _

@lesteve
Copy link
Member

lesteve commented Jan 4, 2016

Is broken_stamp.svg actually used?

Slightly related is do you know why the "broken" image png appears with a black background in the gallery:
sphinx-gallery

@lesteve
Copy link
Member

lesteve commented Jan 4, 2016

My contribution for the 'quick_fail' naming: abort_on_example_error.

@lesteve
Copy link
Member

lesteve commented Jan 4, 2016

Could you rebase on master so that we make sure no extra CSS changes has slipped through in this PR?

@Titan-C
Copy link
Member Author

Titan-C commented Jan 4, 2016

broken_stamp.svg is not used now, but is the source of for the png file. Not sure if it will become useful in the future if we want to tune the image or if #61

The background of the image is black in the thumbnails because in the sphinx-classic css theme all body backgrounds are black, and the png image is transparent.

Copy link
Member

Choose a reason for hiding this comment

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

Singular seems more fitting here: Example that fails to execute

@GaelVaroquaux
Copy link
Contributor

Overall, LGTM. +1 for merge (ideally, please address the comments of the others).
Thanks!

@GaelVaroquaux GaelVaroquaux changed the title Traceback message in Gallery output [MRG+1] Traceback message in Gallery output Jan 9, 2016
@agramfort
Copy link
Contributor

fine with me

This allows easy identification of failled examples in the gallery view
Sphinx with Pygments provides syntax highlighting for python traceback
messages is the same way as for python code. Use those
The current gallery behavior is that when using the no plot flag during
build the whole gallery building process is skipped. Now, all examples
are parsed into rst files but not executed, embedding of links to
documentation in not performed either
@Titan-C
Copy link
Member Author

Titan-C commented Jan 10, 2016

Rebased to master and comments addressed

@Titan-C Titan-C added this to the Release v0.0.12 milestone Jan 10, 2016
@GaelVaroquaux
Copy link
Contributor

@agramfort was good with this. I am too. Let's merge!

GaelVaroquaux added a commit that referenced this pull request Jan 10, 2016
[MRG+1] Traceback message in Gallery output
@GaelVaroquaux GaelVaroquaux merged commit 1a7eb4d into sphinx-gallery:master Jan 10, 2016
@Titan-C Titan-C deleted the Traceback branch January 10, 2016 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants