Skip to content

ENH: Improve logging visibility of errors and filenames#1225

Merged
larsoner merged 3 commits intosphinx-gallery:masterfrom
larsoner:logging
Nov 10, 2023
Merged

ENH: Improve logging visibility of errors and filenames#1225
larsoner merged 3 commits intosphinx-gallery:masterfrom
larsoner:logging

Conversation

@larsoner
Copy link
Copy Markdown
Contributor

@larsoner larsoner commented Nov 9, 2023

I recently had a build that I knew would have a bunch of failures. It seemed harder than it should have been to find the failing examples when I browsed CircleCI. So this improves logging of failures by:

  1. Highlighting the filename in color, leaving the traceback in regular (white) at the end of the build
  2. Indenting the traceback (makes filenames act like a definition list)
  3. Using relative paths for filenames, since it's almost always something relative to src_dir and the potentially very long leading path typically doesn't matter

in-build

master:

Screenshot from 2023-11-09 13-59-43

PR:

image

end-of-build

master:
Screenshot from 2023-11-09 14-00-11

PR:

Screenshot from 2023-11-09 14-07-43 |

@larsoner
Copy link
Copy Markdown
Contributor Author

larsoner commented Nov 9, 2023

FYI color difference during build vs end of build is intentional -- during build it's nice to have a larger block of colorful text so you're more likely to see it, plus good / non-failing examples will appear in between in white. At the end of the build when the exception is raised your attention is already down there, so you're looking for relevant information, and having just the filenames in color helps break up any multiple failures better.

Copy link
Copy Markdown
Contributor

@GaelVaroquaux GaelVaroquaux left a comment

Choose a reason for hiding this comment

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

Super nice feature 👍

@lucyleeow
Copy link
Copy Markdown
Contributor

This is great! I hate to be that person but I wonder if the red/purple are colour deficient friendly. I know there is a association with red = bad so I don't know what to do about that but we could amend the purple to be yellow - most people with colour deficiencies are red/green deficient (protanopia/deuteranopia) and yellow would be seen as very different to black (I used to be an optometrist)

Copy link
Copy Markdown
Contributor

@lucyleeow lucyleeow left a comment

Choose a reason for hiding this comment

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

Thanks for this!

"Here is a summary of the problems encountered "
"when running the examples\n\n" + "\n".join(fail_msgs) + "\n" + "-" * 79
fail_message = bold(
purple(
Copy link
Copy Markdown
Contributor

@lucyleeow lucyleeow Nov 10, 2023

Choose a reason for hiding this comment

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

maybe a yellow (or yellow-ish) colour?

@larsoner
Copy link
Copy Markdown
Contributor Author

Pushed yellow, which is okay but not quite as nice I think:

Screenshot 2023-11-09 at 9 28 24 PM

Thinking about purple/red, putting my image above into https://pilestone.com/pages/color-blindness-simulator-1# for example and looking at the protanopia/deuteranopia simulations look differentiable to me, do you think that's sufficient? FWIW people can remap ANSI terminal color codes to other colors as they want (even my Ubuntu screenshot above is solarized or something, I'd have to check), but we probably shouldn't rely on that.

But if you think yellow is the way to go I can live with it!

@lucyleeow
Copy link
Copy Markdown
Contributor

Yeah fair, go back to purple. Thanks for checking.

This reverts commit d611b29.
@larsoner larsoner enabled auto-merge (squash) November 10, 2023 02:45
@larsoner larsoner merged commit b9f3b82 into sphinx-gallery:master Nov 10, 2023
@larsoner larsoner deleted the logging branch November 10, 2023 14:40
clrpackages referenced this pull request in clearlinux-pkgs/pypi-sphinx_gallery Nov 28, 2023
… to version 0.15.0

v0.15.0
-------

Support for Python 3.7 dropped in this release. Requirement is now Python >=3.8.
Pillow added as a dependency.

**Implemented enhancements:**

-  ENH: Improve logging visibility of errors and filenames `#1225 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1225>`__ (`larsoner <https://github.com/larsoner>`__)
-  ENH: Improve API usage graph `#1203 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1203>`__ (`larsoner <https://github.com/larsoner>`__)
-  ENH: Always write sg_execution_times and make DataTable `#1198 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1198>`__ (`larsoner <https://github.com/larsoner>`__)
-  ENH: Write all computation times `#1197 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1197>`__ (`larsoner <https://github.com/larsoner>`__)
-  ENH: Support source files in any language `#1192 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1192>`__ (`speth <https://github.com/speth>`__)
-  FEA Add examples recommender system `#1125 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1125>`__ (`ArturoAmorQ <https://github.com/ArturoAmorQ>`__)

(NEWS truncated at 15 lines)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants