Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC: plot-directive warning filter option #27076

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

Closed
wants to merge 1 commit into from

Conversation

story645
Copy link
Member

PR summary

Ended up not needing it in #26989, but figure an option to filter a warning might be useful? This is the most basic implementation

.. plot-directive::
  :filter-warning: Ignore

where the string input is whatever can be passed into warnings.filterwarning, Possibly needs tests.

PR checklist

@jklymak
Copy link
Member

jklymak commented Oct 13, 2023

I don't understand why this would be a good idea? If we explicitly need to catch a warning can't we do it in the plot code?

@story645
Copy link
Member Author

If we explicitly need to catch a warning can't we do it in the plot code?

Yes, but that would distract from the plot code. In the original use case, the plot still works - the warnings were of the font not found/missing glyph but fallback variety.

@jklymak
Copy link
Member

jklymak commented Oct 13, 2023

I don't think we should have code that warns in the docs unless we make it clear to users. If you have the distracting filter in there, at least it's clear to potential users that the warning may be triggered.

@story645
Copy link
Member Author

story645 commented Oct 13, 2023

I don't think we should have code that warns in the docs

We already do, we just use simplefilters to keep it out of the doc builds. This was for the use cases where a bulk filter isn't appropriate. Though granted, I also kinda wrote those more as a debugging aide that's nice to have in the directive than necessarily something I think is broadly good practice.

@story645 story645 force-pushed the plot-directive-filter branch from 19ca024 to 9b130e0 Compare October 13, 2023 01:41
@story645 story645 marked this pull request as draft November 2, 2023 01:23
@story645
Copy link
Member Author

sphinx-gallery/sphinx-gallery#930 seems like a more elegant version of this

@story645 story645 closed this Nov 14, 2023
@story645 story645 deleted the plot-directive-filter branch May 2, 2024 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation: build building the docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants