-
Notifications
You must be signed in to change notification settings - Fork 39
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
Fix ALL Sphinx warnings #393
Conversation
@@ -305,6 +308,38 @@ def add_google_calendar_secrets(app, docname, source): | |||
if docname == 'community/meeting_schedule': | |||
source[0] = source[0].replace('{API_KEY}', GOOGLE_CALENDAR_API_KEY) | |||
|
|||
class FilterSphinxWarnings(logging.Filter): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you could filter warnings like this: https://github.com/sphinx-gallery/sphinx-gallery/pull/521/files
But I can't yet find documentation on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually yes - but this warning in particular you can't (or I couldn't!). See https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-suppress_warnings for a list of warnings that can be explicitly silenced. I think it falls into a similar category as sphinx-doc/sphinx#9750 - if you find a way to filter it, that would be great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh man I didn't know any of this. Using warnings.filterwarnings
in the conf.py
file - how does this even work? I can't find documentation of this. Is this a Sphinx thing?
I guess in sphinx-gallery/sphinx-gallery#521 , the warning is passed on by the extension Sphinx-Gallery? In the Sphinx docs it says:
Then extensions can also define their own warning types.
Does that mean that extension warning types are also able to be suppressed?
Anyway, I had no idea, this seems reasonable way to fix it AFAICT! Thanks!
Looking at CircleCI output: Looks like a few are fixed by: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
b4f7a69
to
a9aa9ec
Compare
Look at this https://github.com/napari/docs/actions/runs/8600978497/job/23567119812?pr=393#step:9:1522 😍 Finally! |
This duplicated warning is signalig problem with cross references? |
Interesting this barks:
The relevant code, as far as I can tell: docs/docs/developers/contributing/testing.md Lines 243 to 255 in 1c6155f
And on napari.org/dev/ it's broken: https://napari.org/dev/developers/contributing/testing.html#make-napari-viewer But with this PR it's working! https://output.circle-artifacts.com/output/job/54961a00-f23c-4027-bc52-acec2f1e3e84/artifacts/0/docs/docs/_build/html/developers/contributing/testing.html#make-napari-viewer |
Not really. As far as I can tell, this happens because some Attributes and Properties have the same name, which confuses sphinx (which doesn't deal with Attributes very well). In addition, in some cases when you have subclasses that inherit the parent's docstrings this can also happen (since both objects will be documented with the same parameters/attributes). But I will confess that as much as I've investigated this, it seems like nobody really knows what's going on exactly, including me 😅 (see, for example, sphinx-doc/sphinx#7817 which is the closest I could find) We could potentially fix this without ignoring the errors, but that would mean having multiple templates for different classes which would make the docs generation less automatic and more manual. Since these warnings do not impact the rendering of the docs, I think they are safe to ignore. |
I think we'd have to include pytest as a dependency for building the docs for this to work without this warning? Not sure why I didn't see this locally... |
Local build instructions use dev install of napari, so you probably have it. Line 35 in 1c6155f
🤷 |
Maybe we could add this info in the |
This PR includes fixes to broken references and markdown syntax fixes. It also includes a new filter for napari.qt.threading module docstrings that were creating a few syntax warnings. These are not easily ignored by Sphinx and can't be fixed, as they are Markdown being injected into rst docstrings through the napari.qt module.
a9aa9ec
to
32ec08c
Compare
@lucyleeow let me know if this is enough or if I should elaborate! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
everything looks good to me -- and it's working!
Thanks!!
SO I don't get the lxml warning: I tested locally and I also get it, but yet both lxml and lxml_html_clean are installed. Why is it referring to |
I don't get this warning locally - but it looks like changing that requirement did it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good, so this is great, will make real warnings be so much more obvious now.
ping @psobolewskiPhD could this go in? 😬 |
Yeah sorry; i'm terrible at circling back to merge things. |
References and relevant issues
Closes #111
Addresses #227 (will need a follow-up turning on
sphinx -W
option)Description
This PR includes fixes to broken references and markdown syntax fixes. It also includes a new filter for napari.qt.threading module docstrings that were creating a few syntax warnings. These are not easily ignored by Sphinx and can't be fixed, as they are Markdown being injected into rst docstrings through the napari.qt module.
After this is merged, we will be able to make the build docs CI check to fail on new warnings, and new errors will be more visible.